Java Code Examples for javax.swing.table.TableColumn#getIdentifier()
The following examples show how to use
javax.swing.table.TableColumn#getIdentifier() .
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 |
protected TableCellEditor getCellEditor(int row, int column) { TableColumn tableColumn = impl.getColumnModel().getColumn(column); if (tableColumn.getIdentifier() instanceof Column) { Column columnConf = (Column) tableColumn.getIdentifier(); if (editableColumns != null && columnConf.getId() instanceof MetaPropertyPath && editableColumns.contains(columnConf.getId())) { return tableFieldFactory.createEditComponent(row, columnConf); } } return null; }
Example 2
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
protected TableCellEditor getColumnEditor(int column) { TableColumn tableColumn = impl.getColumnModel().getColumn(column); if (tableColumn.getIdentifier() instanceof Table.Column) { Table.Column columnConf = (Table.Column) tableColumn.getIdentifier(); if (columnConf.getId() instanceof MetaPropertyPath && !(isEditable() && columnConf.isEditable()) && !getTableModel().isGeneratedColumn(columnConf)) { MetaPropertyPath propertyPath = (MetaPropertyPath) columnConf.getId(); final CellProvider cellProvider = getCustomCellEditor(propertyPath); if (cellProvider != null) { return new CellProviderEditor(cellProvider); } } } return null; }
Example 3
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
protected TableCellRenderer getColumnRenderer(int column) { TableColumn tableColumn = impl.getColumnModel().getColumn(column); if (tableColumn.getIdentifier() instanceof Table.Column) { Table.Column columnConf = (Table.Column) tableColumn.getIdentifier(); if (columnConf.getId() instanceof MetaPropertyPath && !(isEditable() && columnConf.isEditable()) && !getTableModel().isGeneratedColumn(columnConf)) { MetaPropertyPath propertyPath = (MetaPropertyPath) columnConf.getId(); final CellProvider cellViewProvider = getCustomCellView(propertyPath); if (cellViewProvider != null) { return new CellProviderRenderer(cellViewProvider); } else if (multiLineCells && String.class == columnConf.getType()) { return new MultiLineTableCellRenderer(); } } } return null; }
Example 4
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Entity item = getTableModel().getItem(row); TableColumn tableColumn = impl.getColumnModel().getColumn(column); Column columnConf = (Column) tableColumn.getIdentifier(); Component component = cellProvider.generateCell(item, (MetaPropertyPath) columnConf.getId()); if (component == null) { return new JLabel(""); } if (component instanceof JComponent) { ((JComponent) component).putClientProperty(DesktopTableCellEditor.CELL_EDITOR_TABLE, impl); } return component; }
Example 5
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Entity item = getTableModel().getItem(row); TableColumn tableColumn = impl.getColumnModel().getColumn(column); Column columnConf = (Column) tableColumn.getIdentifier(); Component component = cellViewProvider.generateCell(item, (MetaPropertyPath) columnConf.getId()); if (component == null) { return new JLabel(""); } if (component instanceof JComponent) { ((JComponent) component).putClientProperty(DesktopTableCellEditor.CELL_EDITOR_TABLE, impl); } String style = getStylename(table, row, column); applyStylename(isSelected, hasFocus, component, style); return component; }
Example 6
Source File: ApplyColumnLayoutAction.java From otroslogviewer with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionEvent actionEvent) { List<String> colNames = columnLayout.getColumns(); LOGGER.debug(String.format("Retrieved %d col names: <<%s>>", colNames.size(), colNames.toString())); List<TableColumns> visCols = new ArrayList<>(); Map<String, TableColumns> colNameToEnum = new HashMap<>(); for (TableColumns tcEnum : TableColumns.values()) { colNameToEnum.put(tcEnum.getName(), tcEnum); } for (TableColumn tableColumn : table.getColumns()) { Object o = tableColumn.getIdentifier(); if (!(o instanceof TableColumns)) { LOGGER.error("TableColumn identifier of unexpected type: " + tableColumn.getIdentifier().getClass().getName()); return; } TableColumns tcs = (TableColumns) o; table.getColumnExt(tcs).setVisible(false); } visCols.addAll(colNames.stream().map(colNameToEnum::get).collect(Collectors.toList())); TablesUtils.showOnlyThisColumns(table, visCols.toArray(new TableColumns[visCols.size()])); TablesUtils.sortColumnsInOrder(columnLayout, table); LOGGER.debug("Column changes applied"); }
Example 7
Source File: VersionHistoryPanel.java From ghidra with Apache License 2.0 | 5 votes |
private void create() { tableModel = new VersionHistoryTableModel(new Version[0]); table = new GTable(tableModel); JScrollPane sp = new JScrollPane(table); table.setPreferredScrollableViewportSize(new Dimension(600, 120)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(sp, BorderLayout.CENTER); TableColumnModel columnModel = table.getColumnModel(); MyCellRenderer cellRenderer = new MyCellRenderer(); for (int i = 0; i < columnModel.getColumnCount(); i++) { TableColumn column = columnModel.getColumn(i); GTableHeaderRenderer headRenderer = new GTableHeaderRenderer(); column.setHeaderRenderer(headRenderer); column.setCellRenderer(cellRenderer); String name = (String) column.getIdentifier(); if (name.equals(VersionHistoryTableModel.VERSION)) { column.setPreferredWidth(80); } else if (name.equals(VersionHistoryTableModel.DATE)) { column.setPreferredWidth(210); } else if (name.equals(VersionHistoryTableModel.COMMENTS)) { column.setPreferredWidth(250); } else if (name.equals(VersionHistoryTableModel.USER)) { column.setPreferredWidth(125); } } }
Example 8
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 5 votes |
protected void setColumnIdentifiers() { int i = 0; for (TableColumn tableColumn : getAllColumns()) { Column column = columnsOrder.get(i++); if (!(tableColumn.getIdentifier() instanceof Column)) { tableColumn.setIdentifier(column); } } }
Example 9
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 5 votes |
protected void setVisibleColumns(List<?> columnsOrder) { for (TableColumn tableColumn : getAllColumns()) { Column columnIdentifier = (Column) tableColumn.getIdentifier(); if (!columnsOrder.contains(columnIdentifier.getId())) { impl.removeColumn(tableColumn); } } }
Example 10
Source File: DesktopAbstractTable.java From cuba with Apache License 2.0 | 5 votes |
protected boolean isCustomCellEditable(int row, int column) { TableColumn tableColumn = impl.getColumnModel().getColumn(column); if (tableColumn.getIdentifier() instanceof Table.Column) { Table.Column columnConf = (Table.Column) tableColumn.getIdentifier(); if (columnConf.getId() instanceof MetaPropertyPath && !getTableModel().isGeneratedColumn(columnConf)) { return isCustomCellEditable(tableModel.getItem(row), (MetaPropertyPath) columnConf.getId()); } } return false; }
Example 11
Source File: EditableTableHeaderColumn.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public void copyValues(TableColumn base) { modelIndex = base.getModelIndex(); identifier = base.getIdentifier(); width = base.getWidth(); minWidth = base.getMinWidth(); setPreferredWidth(base.getPreferredWidth()); maxWidth = base.getMaxWidth(); headerRenderer = base.getHeaderRenderer(); headerValue = base.getHeaderValue(); cellRenderer = base.getCellRenderer(); cellEditor = base.getCellEditor(); isResizable = base.getResizable(); }
Example 12
Source File: EditableHeaderTableColumn.java From chipster with MIT License | 5 votes |
public void copyValues(TableColumn base) { modelIndex = base.getModelIndex(); identifier = base.getIdentifier(); width = base.getWidth(); minWidth = base.getMinWidth(); setPreferredWidth(base.getPreferredWidth()); maxWidth = base.getMaxWidth(); headerRenderer = base.getHeaderRenderer(); headerValue = base.getHeaderValue(); cellRenderer = base.getCellRenderer(); cellEditor = base.getCellEditor(); isResizable = base.getResizable(); }
Example 13
Source File: FindCheckoutsDialog.java From ghidra with Apache License 2.0 | 4 votes |
private void create() { model = new FindCheckoutsTableModel(folder, plugin.getTool()); model.addInitialLoadListener(new ThreadedTableModelListener() { @Override public void loadPending() { // don't care } @Override public void loadingStarted() { // don't care } @Override public void loadingFinished(boolean wasCancelled) { if (wasCancelled) { setStatusText("Find Checkouts Cancelled"); return; } boolean hasData = model.getRowCount() > 0; if (!hasData && showMessage) { Msg.showInfo(getClass(), threadedTablePanel, "Find Checkouts", "No checkouts were found."); FindCheckoutsDialog.this.close(); } } }); threadedTablePanel = new GThreadedTablePanel<>(model); table = threadedTablePanel.getTable(); TableColumnModel columnModel = table.getColumnModel(); MyCellRenderer cellRenderer = new MyCellRenderer(); for (int i = 0; i < columnModel.getColumnCount(); i++) { TableColumn column = columnModel.getColumn(i); column.setCellRenderer(cellRenderer); String name = (String) column.getIdentifier(); if (name.equals(FindCheckoutsTableModel.CHECKOUT_DATE)) { column.setPreferredWidth(180); } } table.setPreferredScrollableViewportSize( new Dimension(threadedTablePanel.getPreferredSize().width, 150)); addWorkPanel(threadedTablePanel); addDismissButton(); }
Example 14
Source File: LabelHistoryPanel.java From ghidra with Apache License 2.0 | 4 votes |
private void create(java.util.List<LabelHistory> list) { tableModel = new LabelHistoryTableModel(list, showAddresses); // set up table sorter stuff //sorter.sortByColumn(tableModel.getDefaultSortColumn()); historyTable = new GhidraTable(tableModel); JScrollPane sp = new JScrollPane(historyTable); Dimension d = new Dimension(showAddresses ? 600 : 520, 200); historyTable.setPreferredScrollableViewportSize(d); historyTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(sp, BorderLayout.CENTER); TableColumnModel columnModel = historyTable.getColumnModel(); for (int i = 0; i < columnModel.getColumnCount(); i++) { TableColumn column = columnModel.getColumn(i); String name = (String) column.getIdentifier(); if (name.equals(LabelHistoryTableModel.DATE)) { column.setCellRenderer(new GenericDateCellRenderer()); column.setPreferredWidth(190); } else if (name.equals(LabelHistoryTableModel.LABEL)) { column.setPreferredWidth(280); column.setCellRenderer(new LabelCellRenderer()); } else if (name.equals(LabelHistoryTableModel.ADDRESS)) { column.setPreferredWidth(130); } else if (name.equals(LabelHistoryTableModel.USER)) { column.setPreferredWidth(190); } } historyTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (!e.isPopupTrigger()) { handleMouseClicked(); } } }); }