protected void fireColumnMarginChanged() { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener64.class) { if (changeEvent == null) { changeEvent = new ChangeEvent(this); } ((TableColumnModelListener64) listeners[i + 1]).columnMarginChanged(changeEvent); } else if (listeners[i] == TableColumnModelListener.class) { if (changeEvent == null) { changeEvent = new ChangeEvent(this); } ((TableColumnModelListener) listeners[i + 1]).columnMarginChanged(changeEvent); } } }
/** * @param columnModel */ public ExtColumnModel(final TableColumnModel org) { super(); this.setColumnMargin(org.getColumnMargin()); this.setColumnSelectionAllowed(org.getColumnSelectionAllowed()); this.setSelectionModel(org.getSelectionModel()); for (int i = 0; i < org.getColumnCount(); i++) { this.addColumn(org.getColumn(i)); } if (org instanceof DefaultTableColumnModel) { for (final TableColumnModelListener cl : ((DefaultTableColumnModel) org).getColumnModelListeners()) { this.addColumnModelListener(cl); } } }
public void moveColumn(int fromIndex, int toIndex) { if (!MainFrame.getInstance().canNavigateAway()) return; MainFrame.getInstance().updateDesignationDisplay(); TableColumn from = columnList.get(fromIndex); TableColumn to = columnList.get(toIndex); columnList.set(fromIndex, to); to.setModelIndex(fromIndex); columnList.set(toIndex, from); from.setModelIndex(toIndex); orderUpdate(); for (TableColumnModelListener w : new ArrayList<TableColumnModelListener>(watchers)) { w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex)); } }
protected void fireColumnAdded(TableColumnModelEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener.class) { ((TableColumnModelListener) listeners[i + 1]).columnAdded(e); } } }
protected void fireColumnRemoved(TableColumnModelEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener.class) { ((TableColumnModelListener) listeners[i + 1]).columnRemoved(e); } } }
protected void fireColumnMoved(TableColumnModelEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener.class) { ((TableColumnModelListener) listeners[i + 1]).columnMoved(e); } } }
protected void fireColumnSelectionChanged(ListSelectionEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener.class) { ((TableColumnModelListener) listeners[i + 1]).columnSelectionChanged(e); } } }
protected void fireColumnMarginChanged() { Object[] listeners = listenerList.getListenerList(); ChangeEvent changeEvent = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TableColumnModelListener.class) { if (changeEvent == null) changeEvent = new ChangeEvent(this); ((TableColumnModelListener) listeners[i + 1]) .columnMarginChanged(changeEvent); } } }
/** * Sends a {@link ChangeEvent} to the model's registered listeners to * indicate that the column margin was changed. * * @see #setColumnMargin(int) */ protected void fireColumnMarginChanged() { EventListener[] listeners = getListeners(TableColumnModelListener.class); if (changeEvent == null && listeners.length > 0) changeEvent = new ChangeEvent(this); for (int i = 0; i < listeners.length; ++i) ((TableColumnModelListener) listeners[i]).columnMarginChanged(changeEvent); }
/** * Returns the listener to table's column model. The listener is * lazily created if necessary. * @return the <code>TableColumnModelListener</code> for use with the * table's column model, guaranteed to be not <code>null</code>. */ protected TableColumnModelListener getColumnModelListener() { if (columnModelListener == null) { columnModelListener = createColumnModelListener(); } return columnModelListener; }
/** * {@inheritDoc} <p> * * Overridden to uninstall enhanced notification of listeners of type. * TableColumnModelListenerExt about property changes of contained columns. */ @Override public void removeColumnModelListener(TableColumnModelListener x) { super.removeColumnModelListener(x); if (x instanceof TableColumnModelExtListener) { listenerList.remove(TableColumnModelExtListener.class, (TableColumnModelExtListener) x); } }
public void addColumnModelListener(TableColumnModelListener x) { if (x instanceof TableColumnModelListener64) { super.addColumnModelListener(x); } else { throw new IllegalArgumentException("use TableColumnModelListener64"); } }
public void removeColumnModelListener(TableColumnModelListener x) { if (x instanceof TableColumnModelListener64) { super.removeColumnModelListener(x); } else { throw new IllegalArgumentException("use TableColumnModelListener64"); } }
/** * Returns the listener to table's column model. The listener is lazily created if necessary. * * @return the <code>TableColumnModelListener</code> for use with the table's column model, guaranteed to be not <code>null</code>. */ private TableColumnModelListener getColumnModelListener() { if (columnModelListener == null) { columnModelListener = createColumnModelListener(); } return columnModelListener; }
@Override public void propertyChange( PropertyChangeEvent e ) { String name = e.getPropertyName(); if ( ( "width".equals( name ) || "preferredWidth".equals( name ) ) && table.getAutoResizeMode() != JTable.AUTO_RESIZE_ALL_COLUMNS && e.getSource() instanceof JBroTableColumn && e.getNewValue() instanceof Integer && e.getOldValue() instanceof Integer ) { if ( ( ( Integer )e.getNewValue() ).intValue() == ( Integer )e.getOldValue() ) return; totalColumnWidth = -1; Object listeners[] = listenerList.getListenerList(); WidthChangeEvent changeEvent = new WidthChangeEvent( this, ( JBroTableColumn )e.getSource(), ( Integer )e.getOldValue(), ( Integer )e.getNewValue(), "preferredWidth".equals( name ) ); for ( int i = listeners.length - 2; i >= 0; i -= 2 ) if ( listeners[ i ] == TableColumnModelListener.class ) ( ( TableColumnModelListener )listeners[ i + 1 ] ).columnMarginChanged( changeEvent ); } else super.propertyChange( e ); }
public void testAddRemoveGetTableColumnModelListener() throws Exception { assertEquals(0, model.getColumnModelListeners().length); TableColumnModelListener listener = new TestTableColumnModelListener(); model.addColumnModelListener(listener); model.addColumnModelListener(new TestTableColumnModelListener()); assertEquals(2, model.getColumnModelListeners().length); model.removeColumnModelListener(listener); assertEquals(1, model.getColumnModelListeners().length); }
public void addColumnModelListener(TableColumnModelListener x) { columnModel.addColumnModelListener(x); }
public void removeColumnModelListener(TableColumnModelListener x) { columnModel.removeColumnModelListener(x); }
public void addColumnModelListener(TableColumnModelListener x) { listenerList.add(TableColumnModelListener.class, x); }
public void removeColumnModelListener(TableColumnModelListener x) { listenerList.remove(TableColumnModelListener.class, x); }
public TableColumnModelListener[] getColumnModelListeners() { return listenerList.getListeners(TableColumnModelListener.class); }
@Override public void addColumnModelListener( TableColumnModelListener x ) { JBroTableColumnModel.this.addColumnModelListener( x ); }
@Override public void removeColumnModelListener( TableColumnModelListener x ) { JBroTableColumnModel.this.removeColumnModelListener( x ); }
/** * {@inheritDoc} */ @Override public void addColumnModelListener(TableColumnModelListener l) { listeners.add(l); }
/** * {@inheritDoc} */ @Override public void removeColumnModelListener(TableColumnModelListener l) { listeners.remove(l); }
protected void fireColumnSelectionChanged(ListSelectionEvent e) { for(TableColumnModelListener l : listeners.toArray(new TableColumnModelListener[]{})){ l.columnSelectionChanged(e); } }
public void fireColumnMarginChanged(int aMargin) { ChangeEvent event = new ChangeEvent(this); for(TableColumnModelListener l : listeners.toArray(new TableColumnModelListener[]{})){ l.columnMarginChanged(event); } }
protected void fireColumnRemoved(int aPosition) { TableColumnModelEvent event = new TableColumnModelEvent(this, aPosition, 0); for(TableColumnModelListener l : listeners.toArray(new TableColumnModelListener[]{})){ l.columnRemoved(event); } }
protected void fireColumnAdded(int aPosition) { TableColumnModelEvent event = new TableColumnModelEvent(this, 0, aPosition); for(TableColumnModelListener l : listeners.toArray(new TableColumnModelListener[]{})){ l.columnAdded(event); } }
protected void fireColumnMoved(int sourceIndex, int destIndex) { TableColumnModelEvent event = new TableColumnModelEvent(this, sourceIndex, destIndex); for(TableColumnModelListener l : listeners.toArray(new TableColumnModelListener[]{})){ l.columnMoved(event); } }
public void addColumnModelListener(final TableColumnModelListener listener) { listenerList.add(TableColumnModelListener.class, listener); }