org.jdesktop.swingx.table.TableColumnExt Java Examples
The following examples show how to use
org.jdesktop.swingx.table.TableColumnExt.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
@Override public void setColumnCollapsed(Column column, boolean collapsed) { if (!getColumnControlVisible()) { return; } checkNotNullArgument(column, "column must be non null"); if (column.isCollapsed() != collapsed) { column.setCollapsed(collapsed); } TableColumn tableColumn = getColumn(column); if (tableColumn instanceof TableColumnExt) { ((TableColumnExt) tableColumn).setVisible(!collapsed); } }
Example #2
Source File: TokenGenMessagesTable.java From zap-extensions with Apache License 2.0 | 6 votes |
@Override public void configureTableColumn(final TableModel model, final TableColumnExt columnExt) { super.configureTableColumn(model, columnExt); if (columnExt.getModelIndex() == TokenGenMessagesTableModel.RTT_COLUMN_INDEX && TimeDurationStringValue.isTargetClass( model.getColumnClass(TokenGenMessagesTableModel.RTT_COLUMN_INDEX))) { columnExt.setCellRenderer(new DefaultTableRenderer(new TimeDurationStringValue())); } if (columnExt.getModelIndex() == TokenGenMessagesTableModel.RESPONSE_BODY_SIZE_COLUMN_INDEX && SizeBytesStringValue.isTargetClass( model.getColumnClass( TokenGenMessagesTableModel.RESPONSE_BODY_SIZE_COLUMN_INDEX))) { columnExt.setCellRenderer(new DefaultTableRenderer(new SizeBytesStringValue())); } }
Example #3
Source File: DSWorkbenchSOSRequestAnalyzer.java From dsworkbench with Apache License 2.0 | 6 votes |
public void updateCountdown() { if (!jSupportsTable.isVisible()) { return; } TableColumnExt col = jSupportsTable.getColumnExt("Countdown"); if (col.isVisible()) { int startX = 0; for (int i = 0; i < jSupportsTable.getColumnCount(); i++) { if (jSupportsTable.getColumnExt(i).equals(col)) { break; } startX += (jSupportsTable.getColumnExt(i).isVisible()) ? jSupportsTable.getColumnExt(i).getWidth() : 0; } jSupportsTable.repaint(startX, (int) jSupportsTable.getVisibleRect().getY(), startX + col.getWidth(), (int) jSupportsTable.getVisibleRect().getHeight()); } }
Example #4
Source File: DSWorkbenchConquersFrame.java From dsworkbench with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Find")) { BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT); Graphics g = back.getGraphics(); g.setColor(new Color(120, 120, 120, 120)); g.fillRect(0, 0, back.getWidth(), back.getHeight()); g.setColor(new Color(120, 120, 120)); g.drawLine(0, 0, 3, 3); g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxFilterPane.setBackgroundPainter(new MattePainter(paint)); DefaultListModel model = new DefaultListModel(); for (int i = 0; i < jConquersTable.getColumnCount(); i++) { TableColumnExt col = jConquersTable.getColumnExt(i); if (col.isVisible() && !col.getTitle().equals("Entfernung") && !col.getTitle().equals("Dorfpunkte")) { model.addElement(col.getTitle()); } } jXColumnList.setModel(model); jXColumnList.setSelectedIndex(0); jxFilterPane.setVisible(true); } }
Example #5
Source File: DSWorkbenchDoItYourselfAttackPlaner.java From dsworkbench with Apache License 2.0 | 5 votes |
protected void updateCountdown() { TableColumnExt col = jAttackTable.getColumnExt("Verbleibend"); if (col.isVisible()) { int startX = 0; for (int i = 0; i < jAttackTable.getColumnCount(); i++) { if (jAttackTable.getColumnExt(i).equals(col)) { break; } startX += (jAttackTable.getColumnExt(i).isVisible()) ? jAttackTable.getColumnExt(i).getWidth() : 0; } jAttackTable.repaint(startX, 0, startX + col.getWidth(), jAttackTable.getHeight()); } }
Example #6
Source File: GPTreeTableBase.java From ganttproject with GNU General Public License v3.0 | 5 votes |
protected TableColumnExt newTableColumnExt(int modelIndex) { TableColumnExt result = new TableColumnExt(modelIndex); Class<?> columnClass = getTreeTableModel().getColumnClass(modelIndex); TableCellRenderer renderer = createCellRenderer(columnClass); if (renderer != null) { result.setCellRenderer(renderer); } TableCellEditor editor = createCellEditor(columnClass); if (editor != null) { result.setCellEditor(editor); } else { System.err.println("no editor for column=" + modelIndex + " class=" + columnClass); } return result; }
Example #7
Source File: GPTreeTableBase.java From ganttproject with GNU General Public License v3.0 | 5 votes |
ColumnImpl createColumn(int modelIndex, ColumnList.Column stub) { TableColumnExt tableColumn = newTableColumnExt(modelIndex); tableColumn.setPreferredWidth(stub.getWidth()); tableColumn.setIdentifier(stub.getID()); ColumnImpl result = new ColumnImpl(getTreeTable(), tableColumn, stub); myColumns.add(result); return result; }
Example #8
Source File: ResourceTreeTable.java From ganttproject with GNU General Public License v3.0 | 5 votes |
@Override protected TableColumnExt newTableColumnExt(int modelIndex) { TableColumnExt tableColumn = super.newTableColumnExt(modelIndex); if (modelIndex == ResourceDefaultColumn.ROLE.ordinal() || modelIndex == ResourceDefaultColumn.ROLE_IN_TASK.ordinal()) { JComboBox comboBox = new JComboBox(getRoleManager().getEnabledRoles()); comboBox.setEditable(false); tableColumn.setCellEditor(new DefaultCellEditor(comboBox)); } return tableColumn; }
Example #9
Source File: PropertyHelper.java From dsworkbench with Apache License 2.0 | 5 votes |
public static void storeTableProperties(JXTable pTable, Configuration pConfig, String pPrefix) { List<TableColumn> cols = ((TableColumnModelExt) pTable.getColumnModel()).getColumns(true); for (TableColumn c : cols) { TableColumnExt col = (TableColumnExt) c; String title = col.getTitle(); pConfig.setProperty(pPrefix + ".table.col." + title + ".width", col.getWidth()); pConfig.setProperty(pPrefix + ".table.col." + title + ".visible", col.isVisible()); } int sortedCol = pTable.getSortedColumnIndex(); if (sortedCol < 0) { return; } pConfig.setProperty(pPrefix + ".table.sort.col", sortedCol); int sortOrder = 0; switch (pTable.getSortOrder(sortedCol)) { case ASCENDING: sortOrder = 1; break; case DESCENDING: sortOrder = -1; break; default: sortOrder = 0; } pConfig.setProperty(pPrefix + ".table.sort.order", sortOrder); pConfig.setProperty(pPrefix + ".table.horizontal.scroll", pTable.isHorizontalScrollEnabled()); }
Example #10
Source File: UIHelper.java From dsworkbench with Apache License 2.0 | 5 votes |
public static void initTableColums(JXTable table, int width, String... headers) { for (String caption : headers) { TableColumnExt columns = table.getColumnExt(caption); columns.setPreferredWidth(width); columns.setMaxWidth(width); columns.setWidth(width); } }
Example #11
Source File: AttackTableTab.java From dsworkbench with Apache License 2.0 | 5 votes |
public void updateTime() { TableColumnExt col = jxAttackTable.getColumnExt("Abschickzeit"); if (col.isVisible()) { int startX = 0; for (int i = 0; i < jxAttackTable.getColumnCount(); i++) { if (jxAttackTable.getColumnExt(i).equals(col)) { break; } startX += (jxAttackTable.getColumnExt(i).isVisible()) ? jxAttackTable.getColumnExt(i).getWidth() : 0; } jxAttackTable.repaint(startX, 0, startX + col.getWidth(), jxAttackTable.getHeight()); } }
Example #12
Source File: AttackTableTab.java From dsworkbench with Apache License 2.0 | 5 votes |
public void updateCountdown() { TableColumnExt col = jxAttackTable.getColumnExt("Verbleibend"); if (col.isVisible()) { int startX = 0; for (int i = 0; i < jxAttackTable.getColumnCount(); i++) { if (jxAttackTable.getColumnExt(i).equals(col)) { break; } startX += (jxAttackTable.getColumnExt(i).isVisible()) ? jxAttackTable.getColumnExt(i).getWidth() : 0; } jxAttackTable.repaint(startX, (int) jxAttackTable.getVisibleRect().getY(), startX + col.getWidth(), (int) jxAttackTable.getVisibleRect().getHeight()); } }
Example #13
Source File: DSWorkbenchTagFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
private void initialize() { String prop = GlobalOptions.getProperty("tag.frame.table.visibility"); String[] split = prop.split(";"); for (int i = 0; i < split.length; i++) { if (!Boolean.parseBoolean(split[i])) { TableColumnExt col = jTagsTable.getColumnExt(i); col.setVisible(false); } } centerPanel.setMenuVisible(GlobalOptions.getProperties().getBoolean("tag.frame.menu.visible")); }
Example #14
Source File: DSWorkbenchRankFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { RankTableTab activeTab = getActiveTab(); if (e.getActionCommand() != null && activeTab != null) { if (e.getActionCommand().equals("Find")) { BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT); Graphics g = back.getGraphics(); g.setColor(new Color(120, 120, 120, 120)); g.fillRect(0, 0, back.getWidth(), back.getHeight()); g.setColor(new Color(120, 120, 120)); g.drawLine(0, 0, 3, 3); g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxSearchPane.setBackgroundPainter(new MattePainter(paint)); DefaultListModel model = new DefaultListModel(); for (int i = 0; i < activeTab.getRankTable().getColumnCount(); i++) { TableColumnExt col = activeTab.getRankTable().getColumnExt(i); if (col.isVisible()) { if (col.getTitle().equals("Name") || col.getTitle().equals("Tag") || col.getTitle().equals("Stamm")) { model.addElement(col.getTitle()); } } } jXColumnList.setModel(model); jXColumnList.setSelectedIndex(0); jxSearchPane.setVisible(true); } } }
Example #15
Source File: DSWorkbenchReportFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { ReportTableTab activeTab = getActiveTab(); if (e.getActionCommand() != null && activeTab != null) { if (e.getActionCommand().equals("Copy")) { activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.COPY_TO_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("BBCopy")) { activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.CLIPBOARD_BB); } else if (e.getActionCommand().equals("Cut")) { activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.CUT_TO_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("Paste")) { activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.FROM_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("Delete")) { activeTab.deleteSelection(true); } else if (e.getActionCommand().equals("Find")) { BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT); Graphics g = back.getGraphics(); g.setColor(new Color(120, 120, 120, 120)); g.fillRect(0, 0, back.getWidth(), back.getHeight()); g.setColor(new Color(120, 120, 120)); g.drawLine(0, 0, 3, 3); g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxSearchPane.setBackgroundPainter(new MattePainter(paint)); DefaultListModel model = new DefaultListModel(); for (int i = 0; i < activeTab.getReportTable().getColumnCount(); i++) { TableColumnExt col = activeTab.getReportTable().getColumnExt(i); if (col.isVisible()) { if (!col.getTitle().equals("Status") && !col.getTitle().equals("Typ") && !col.getTitle().equals("Sonstiges")) { model.addElement(col.getTitle()); } } } jXColumnList.setModel(model); jXColumnList.setSelectedIndex(0); jxSearchPane.setVisible(true); } } }
Example #16
Source File: DSWorkbenchSOSRequestAnalyzer.java From dsworkbench with Apache License 2.0 | 5 votes |
public void updateTime() { TableColumnExt firstCol = jSupportsTable.getColumnExt("Früheste Abschickzeit"); TableColumnExt lastCol = jSupportsTable.getColumnExt("Späteste Abschickzeit"); if (firstCol.isVisible() && lastCol.isVisible()) { int startX = 0; for (int i = 0; i < jSupportsTable.getColumnCount(); i++) { if (jSupportsTable.getColumnExt(i).equals(firstCol)) { break; } startX += (jSupportsTable.getColumnExt(i).isVisible()) ? jSupportsTable.getColumnExt(i).getWidth() : 0; } jSupportsTable.repaint(startX, 0, startX + firstCol.getWidth() + lastCol.getWidth(), jSupportsTable.getHeight()); } }
Example #17
Source File: DSWorkbenchDistanceFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
public void resetView(boolean pClear) { if (pClear) { DistanceManager.getSingleton().clear(); } jDistanceTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int w0 = 200; for (int i = 0; i < jDistanceTable.getColumnCount(); i++) { TableColumnExt column = jDistanceTable.getColumnExt(i); if (i == 0) { column.setWidth(w0); column.setPreferredWidth(w0); column.setMaxWidth(w0); column.setMinWidth(w0); column.setResizable(false); } else { String v = (String) column.getHeaderValue(); int w = getGraphics().getFontMetrics().stringWidth(v); column.setWidth(w); column.setPreferredWidth(w); } } jDistanceTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); if (pClear) { ((DistanceTableModel) jDistanceTable.getModel()).fireTableStructureChanged(); } else { ((DistanceTableModel) jDistanceTable.getModel()).fireTableDataChanged(); } DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(UnknownUnit.getSingleton()); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); } unitBox.setModel(model); }
Example #18
Source File: DSWorkbenchWatchtowerFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
@Override public void resetView() { KnownVillageManager.getSingleton().addManagerListener(this); MarkerManager.getSingleton().addManagerListener(this); jWatchtowerTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); String[] cols = new String[]{"Stufe", "Farbe"}; for (String col : cols) { TableColumnExt columns = jWatchtowerTable.getColumnExt(col); columns.setPreferredWidth(80); columns.setMaxWidth(80); columns.setWidth(80); } ((WatchtowerTableModel) jWatchtowerTable.getModel()).fireTableDataChanged(); }
Example #19
Source File: HttpFuzzerResultsTable.java From zap-extensions with Apache License 2.0 | 5 votes |
public HttpFuzzerResultsTable(String name, HttpFuzzerResultsTableModel resultsModel) { super(resultsModel, false); setName(name); getSelectionModel().addListSelectionListener(new DisplayMessageOnSelectionValueChange()); setAutoCreateColumnsFromModel(false); getColumnExt(Constant.messages.getString("view.href.table.header.timestamp.request")) .setVisible(false); getColumnExt(Constant.messages.getString("view.href.table.header.method")) .setVisible(false); getColumnExt(Constant.messages.getString("view.href.table.header.url")).setVisible(false); getColumnExt(Constant.messages.getString("view.href.table.header.size.requestheader")) .setVisible(false); getColumnExt(Constant.messages.getString("view.href.table.header.size.requestbody")) .setVisible(false); TableColumnExt stateColumn = getColumnExt( Constant.messages.getString( "fuzz.httpfuzzer.results.tab.messages.table.header.state")); fuzzResultStateHighlighter = new FuzzResultStateHighlighter(stateColumn.getModelIndex()); stateColumn.addHighlighter(fuzzResultStateHighlighter); // Sort on task ID setSortOrder(0, SortOrder.ASCENDING); }
Example #20
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 5 votes |
@Override public List<Column> getNotCollapsedColumns() { List<Column> visibleColumns = new LinkedList<>(); for (Column column : columnsOrder) { TableColumnExt columnExt = impl.getColumnExt(column); if (columnExt != null && columnExt.isVisible()) { visibleColumns.add(column); } } return visibleColumns; }
Example #21
Source File: SwingXTableSettings.java From cuba with Apache License 2.0 | 4 votes |
@Override public boolean saveSettings(Element element) { element.addAttribute("horizontalScroll", String.valueOf(table.isHorizontalScrollEnabled())); saveFontPreferences(element); Element columnsElem = element.element("columns"); if (columnsElem != null) { element.remove(columnsElem); } columnsElem = element.addElement("columns"); final List<TableColumn> visibleTableColumns = table.getColumns(); final List<Table.Column> visibleColumns = new ArrayList<>(); for (TableColumn tableColumn : visibleTableColumns) { visibleColumns.add((Table.Column) tableColumn.getIdentifier()); } List<TableColumn> columns = table.getColumns(true); Collections.sort( columns, new Comparator<TableColumn>() { @SuppressWarnings("SuspiciousMethodCalls") @Override public int compare(TableColumn col1, TableColumn col2) { if (col1 instanceof TableColumnExt && !((TableColumnExt) col1).isVisible()) { return 1; } if (col2 instanceof TableColumnExt && !((TableColumnExt) col2).isVisible()) { return -1; } int i1 = visibleColumns.indexOf(col1.getIdentifier()); int i2 = visibleColumns.indexOf(col2.getIdentifier()); return Integer.compare(i1, i2); } } ); for (TableColumn column : columns) { Element colElem = columnsElem.addElement("column"); colElem.addAttribute("id", column.getIdentifier().toString()); int width = column.getWidth(); colElem.addAttribute("width", String.valueOf(width)); if (column instanceof TableColumnExt) { Boolean visible = ((TableColumnExt) column).isVisible(); colElem.addAttribute("visible", visible.toString()); } } if (table.getRowSorter() != null) { TableColumn sortedColumn = table.getSortedColumn(); List<? extends RowSorter.SortKey> sortKeys = table.getRowSorter().getSortKeys(); if (sortedColumn != null && !sortKeys.isEmpty()) { columnsElem.addAttribute("sortColumn", String.valueOf(sortedColumn.getIdentifier())); columnsElem.addAttribute("sortOrder", sortKeys.get(0).getSortOrder().toString()); } } return true; }
Example #22
Source File: DSWorkbenchAttackFrame.java From dsworkbench with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(ActionEvent e) { AttackTableTab activeTab = getActiveTab(); int idx = jAttackTabPane.getSelectedIndex(); if (e.getActionCommand() != null && activeTab != null) { if (e.getActionCommand().equals("TimeChange")) { activeTab.fireChangeTimeEvent(); } else if (e.getActionCommand().equals("UnitChange")) { activeTab.fireChangeUnitEvent(); } else if (e.getActionCommand().equals("Recolor")) { activeTab.updateSortHighlighter(); } else if (e.getActionCommand().equals("ExportScript")) { activeTab.fireExportScriptEvent(); } else if (e.getActionCommand().equals("Copy")) { activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.COPY_TO_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("BBCopy")) { activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.CLIPBOARD_BB); } else if (e.getActionCommand().equals("Cut")) { activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.CUT_TO_INTERNAL_CLIPBOARD); jAttackTabPane.setSelectedIndex(idx); } else if (e.getActionCommand().equals("Paste")) { activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.FROM_INTERNAL_CLIPBOARD); jAttackTabPane.setSelectedIndex(idx); } else if (e.getActionCommand().equals("Delete")) { activeTab.deleteSelection(true); } else if (e.getActionCommand().equals("Find")) { BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT); Graphics g = back.getGraphics(); g.setColor(new Color(120, 120, 120, 120)); g.fillRect(0, 0, back.getWidth(), back.getHeight()); g.setColor(new Color(120, 120, 120)); g.drawLine(0, 0, 3, 3); g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxSearchPane.setBackgroundPainter(new MattePainter(paint)); DefaultListModel model = new DefaultListModel(); for (int i = 0; i < activeTab.getAttackTable().getColumnCount(); i++) { TableColumnExt col = activeTab.getAttackTable().getColumnExt(i); if (col.isVisible()) { if (!col.getTitle().equals("Einheit") && !col.getTitle().equals("Typ") && !col.getTitle().equals("Sonstiges") && !col.getTitle().equals("Abschickzeit") && !col.getTitle().equals("Ankunftzeit") && !col.getTitle().equals("Verbleibend")) { model.addElement(col.getTitle()); } } } jXColumnList.setModel(model); jXColumnList.setSelectedIndex(0); jxSearchPane.setVisible(true); } } }
Example #23
Source File: GPTreeTableBase.java From ganttproject with GNU General Public License v3.0 | 4 votes |
ColumnImpl(JXTreeTable table, TableColumnExt tableColumn, ColumnList.Column stub) { myTable = table; myTableColumn = tableColumn; myStub = stub; }
Example #24
Source File: GPTreeTableBase.java From ganttproject with GNU General Public License v3.0 | 4 votes |
TableColumnExt getTableColumnExt() { return myTableColumn; }