@Override public void addColumnModelListener(TableColumnModelListener x) { delegate.addColumnModelListener(x); }
private void hookColumns() { table.getColumnModel().addColumnModelListener(new TableColumnModelListener() { public void columnAdded(TableColumnModelEvent e) { repaint(); } public void columnRemoved(TableColumnModelEvent e) { repaint(); } public void columnMoved(TableColumnModelEvent e) { repaint(); } public void columnMarginChanged(ChangeEvent e) { repaint(); } public void columnSelectionChanged(ListSelectionEvent e) { repaint(); } }); listening = true; } };
@Override public void mousePressed(MouseEvent e) { table.getColumnModel().addColumnModelListener(tcml); } @Override
/** * Apply this column settings to given table. This object will also listen * to table column model events. * @param table A JTable to apply column settings. */ public void apply(JTable table) { this.table = table; restoreSettings(); table.getColumnModel().addColumnModelListener(this); }
/** * Construct a new cell renderer. */ public CellRenderer() { foreground = super.getForeground(); background = super.getBackground(); table.getColumnModel().addColumnModelListener(this); }
/** * Reset the TableColumnManager to only manage the TableColumns that are * currently visible in the table. * * Generally this method should only be invoked by the TableColumnManager * when the TableModel of the table is changed. */ public void reset() { table.getColumnModel().removeColumnModelListener(this); columnModel = table.getColumnModel(); columnModel.addColumnModelListener(this); // Keep a duplicate TableColumns for managing hidden TableColumns int count = columnModel.getColumnCount(); allColumns = new ArrayList<>(count); for (int i = 0; i < count; i++) { allColumns.add(columnModel.getColumn(i)); } }
/** * Register all necassary listener to the table objects, so this model can react to click on column headers and display arrows * for sort direction in column headers. * <p> * More than one table can be registerd to this model. * * @param table * the table using this model. */ public void registerToTableColumns(JTable table) { TableColumnModel cm = table.getColumnModel(); cm.addColumnModelListener(columnModelListener); setTableColumnHeaderRenderers(cm, 0, cm.getColumnCount() - 1); JTableHeader tableHeader = table.getTableHeader(); tableHeader.addMouseListener(tableHeaderListener); tableHeaders.add(tableHeader); }
private void hookHeaderColumnResize() { treeTable.getTableHeader().getColumnModel().addColumnModelListener(new TableColumnModelListener() { public void columnAdded(TableColumnModelEvent e) { treeTableViewport.repaint(); } public void columnMoved(TableColumnModelEvent e) { treeTableViewport.repaint(); } public void columnRemoved(TableColumnModelEvent e) { treeTableViewport.repaint(); } public void columnMarginChanged(ChangeEvent e) { treeTableViewport.repaint(); updateScrollBar(true); } public void columnSelectionChanged(ListSelectionEvent e) {} }); }
/** * Hide a column from view in the table. * * @param column * the TableColumn to be removed from the TableColumnModel of the * table */ public void hideColumn(TableColumn column) { if (columnModel.getColumnCount() == 1) { return; } // Ignore changes to the TableColumnModel made by the TableColumnManager columnModel.removeColumnModelListener(this); columnModel.removeColumn(column); columnModel.addColumnModelListener(this); }
private void hookHeaderColumnResize() { if (extendedTable.getTableHeader() != null) { extendedTable.getTableHeader().getColumnModel().addColumnModelListener(new TableColumnModelListener() { public void columnAdded(TableColumnModelEvent e) { extendedTableViewport.repaint(); } public void columnMoved(TableColumnModelEvent e) { extendedTableViewport.repaint(); } public void columnRemoved(TableColumnModelEvent e) { extendedTableViewport.repaint(); } public void columnMarginChanged(ChangeEvent e) { extendedTableViewport.repaint(); } public void columnSelectionChanged(ListSelectionEvent e) { } // Ignored }); } }
public SortByAction(MainFrame mainFrame, Map<String,Object> properties, Column column) { super(mainFrame, properties); this.column = column; mainFrame.addActivePanelListener(this); mainFrame.getLeftPanel().getFileTable().getColumnModel().addColumnModelListener(this); mainFrame.getRightPanel().getFileTable().getColumnModel().addColumnModelListener(this); updateState(mainFrame.getActiveTable()); }
/** * @see AbstractIconFeedback#detach() */ @Override public void attach(JComponent decoratedComponent, AnchorLink anchorLinkWithOwner) { super.attach(decoratedComponent, anchorLinkWithOwner); if (decoratedComponent instanceof JTable) { table = (JTable) decoratedComponent; table.addComponentListener(cellTracker); table.addPropertyChangeListener("columnModel", cellTracker); if (table.getColumnModel() != null) { table.getColumnModel().addColumnModelListener(cellTracker); } table.addPropertyChangeListener("sorter", cellTracker); table.addPropertyChangeListener("rowSorter", cellTracker); if (table.getRowSorter() != null) { table.getRowSorter().addRowSorterListener(cellTracker); } } }
/** * Adjusts internal state after table's column model property has changed. * Handles cleanup of listeners to the old/new columnModel (Note, that * it listens to the column model only if it can control column visibility). * Updates content of popup. * * @param oldModel the old <code>TableColumnModel</code> we had been listening to. */ protected void updateFromColumnModelChange(TableColumnModel oldModel) { if (oldModel != null) { oldModel.removeColumnModelListener(columnModelListener); } populatePopup(); if (canControl()) { table.getColumnModel().addColumnModelListener(getColumnModelListener()); } }
/** * Adjusts internal state after table's column model property has changed. * Handles cleanup of listeners to the old/new columnModel (Note, that * it listens to the column model only if it can control column visibility). * Updates content of popup. * * @param oldModel the old <code>TableColumnModel</code> we had been listening to. */ protected void updateFromColumnModelChange(TableColumnModel oldModel) { if (oldModel != null) { oldModel.removeColumnModelListener(columnModelListener); } populatePopup(); if (canControl()) { table.getColumnModel().addColumnModelListener(getColumnModelListener()); } }
/** * Adjusts internal state after table's column model property has changed. * Handles cleanup of listeners to the old/new columnModel (Note, that * it listens to the column model only if it can control column visibility). * Updates content of popup. * * @param oldModel the old <code>TableColumnModel</code> we had been listening to. */ protected void updateFromColumnModelChange(TableColumnModel oldModel) { if (oldModel != null) { oldModel.removeColumnModelListener(columnModelListener); } populatePopup(); if (canControl()) { table.getColumnModel().addColumnModelListener(getColumnModelListener()); } }
/** * Adjusts internal state after table's column model property has changed. * Handles cleanup of listeners to the old/new columnModel (Note, that * it listens to the column model only if it can control column visibility). * Updates content of popup. * * @param oldModel the old <code>TableColumnModel</code> we had been listening to. */ protected void updateFromColumnModelChange(TableColumnModel oldModel) { if (oldModel != null) { oldModel.removeColumnModelListener(columnModelListener); } populatePopup(); if (canControl()) { table.getColumnModel().addColumnModelListener(getColumnModelListener()); } }
/** * Adjusts internal state after table's column model property has changed. * Handles cleanup of listeners to the old/new columnModel (Note, that * it listens to the column model only if it can control column visibility). * Updates content of popup. * * @param oldModel the old <code>TableColumnModel</code> we had been listening to. */ protected void updateFromColumnModelChange(TableColumnModel oldModel) { if (oldModel != null) { oldModel.removeColumnModelListener(columnModelListener); } populatePopup(); if (canControl()) { table.getColumnModel().addColumnModelListener(getColumnModelListener()); } }
/** * ConstrainedColumnModel constructor. * * @param aDelegate A <code>TableColumnModel</code> instance all significant * work is delegated to. * @param aConstraint A <code>LinearConstraint</code> instacne defining the * constraint. * @see TableColumnModel */ public ConstrainedColumnModel(TableColumnModel aDelegate, LinearConstraint aConstraint) { super(); delegate = aDelegate; constraint = aConstraint; columnSelectionAllowed = delegate.getColumnSelectionAllowed(); columnMargin = delegate.getColumnMargin(); delegate.addColumnModelListener(new DelegatedColumnModelListener()); constraint.addConstraintChangeListener(new ConstraintListener()); }
VFSDirectoryEntryTable(BrowserView browserView) { super(new VFSDirectoryEntryTableModel()); this.browserView = browserView; setShowGrid(false); setIntercellSpacing(new Dimension(0,0)); setDefaultRenderer(VFSDirectoryEntryTableModel.Entry.class, renderer = new FileCellRenderer()); header = getTableHeader(); header.setReorderingAllowed(false); addMouseListener(new MainMouseHandler()); header.addMouseListener(new MouseHandler()); header.setDefaultRenderer(new HeaderRenderer( (DefaultTableCellRenderer)header.getDefaultRenderer())); setRowSelectionAllowed(true); getColumnModel().addColumnModelListener(new ColumnHandler()); setAutoResizeMode(AUTO_RESIZE_OFF); } //}}}
private void initialize() { this.setSize(400, 300); this.setCellSelectionEnabled(true); this.getPopupMenu(); this.getHeaderPopupMenu(); setKeyStroke(); Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(this); setSelectedColor(SELECTED_NODE); setSelectedColor(REV_SELECTED_NODE); setSelectedColor(SELECTED_EDGE); setSelectedColor(REV_SELECTED_EDGE); this.setDefaultRenderer(Object.class, new BrowserTableCellRenderer(false, objectType)); this.getColumnModel().addColumnModelListener(this); this.setDefaultEditor(Object.class, new MultiLineTableCellEditor() ); this.getTableHeader().addMouseMotionListener(this); }