@Override public void itemStateChanged(final ItemEvent e) { if (canControlColumn()) { if ((e.getStateChange() == ItemEvent.DESELECTED) //JW: guarding against 1 leads to #212-swingx: setting // column visibility programatically fails if // the current column is the second last visible // guarding against 0 leads to hiding all columns // by deselecting the menu item. && (table.getColumnCount() <= 1) // JW Fixed #212: basically implemented Rob's idea to distinguish // event sources instead of unconditionally reselect // not entirely sure if the state transitions are completely // defined but all related tests are passing now. && !fromColumn) { reselect(); } else { setSelected(e.getStateChange() == ItemEvent.SELECTED); } } }
/** * Releases actions and clears list of actions. * */ protected void clearColumnVisibilityActions() { if (columnVisibilityActions == null) return; for (ColumnVisibilityAction action : columnVisibilityActions) { action.releaseColumn(); } columnVisibilityActions.clear(); }
/** * Synchs name property to value. This is called on change of * tableColumn's <code>headerValue</code> property. * * @param value */ private void updateFromColumnHeader(Object value) { setName(String.valueOf(value)); }
@Override public void itemStateChanged(final ItemEvent e) { if (canControlColumn()) { if ((e.getStateChange() == ItemEvent.DESELECTED) //JW: guarding against 1 leads to #212-swingx: setting // column visibility programatically fails if // the current column is the second last visible // guarding against 0 leads to hiding all columns // by deselecting the menu item. && (table.getColumnCount() <= 1) // JW Fixed #212: basically implemented Rob's idea to distinguish // event sources instead of unconditionally reselect // not entirely sure if the state transitions are completely // defined but all related tests are passing now. && !fromColumn) { reselect(); } else { setSelected(e.getStateChange() == ItemEvent.SELECTED); } } }
@Override public void itemStateChanged(final ItemEvent e) { if (canControlColumn()) { if ((e.getStateChange() == ItemEvent.DESELECTED) //JW: guarding against 1 leads to #212-swingx: setting // column visibility programatically fails if // the current column is the second last visible // guarding against 0 leads to hiding all columns // by deselecting the menu item. && (table.getColumnCount() <= 1) // JW Fixed #212: basically implemented Rob's idea to distinguish // event sources instead of unconditionally reselect // not entirely sure if the state transitions are completely // defined but all related tests are passing now. && !fromColumn) { reselect(); } else { setSelected(e.getStateChange() == ItemEvent.SELECTED); } } }
@Override public void itemStateChanged(final ItemEvent e) { if (canControlColumn()) { if ((e.getStateChange() == ItemEvent.DESELECTED) //JW: guarding against 1 leads to #212-swingx: setting // column visibility programatically fails if // the current column is the second last visible // guarding against 0 leads to hiding all columns // by deselecting the menu item. && (table.getColumnCount() <= 1) // JW Fixed #212: basically implemented Rob's idea to distinguish // event sources instead of unconditionally reselect // not entirely sure if the state transitions are completely // defined but all related tests are passing now. && !fromColumn) { reselect(); } else { setSelected(e.getStateChange() == ItemEvent.SELECTED); } } }
@Override public void itemStateChanged(final ItemEvent e) { if (canControlColumn()) { if ((e.getStateChange() == ItemEvent.DESELECTED) //JW: guarding against 1 leads to #212-swingx: setting // column visibility programatically fails if // the current column is the second last visible // guarding against 0 leads to hiding all columns // by deselecting the menu item. && (table.getColumnCount() <= 1) // JW Fixed #212: basically implemented Rob's idea to distinguish // event sources instead of unconditionally reselect // not entirely sure if the state transitions are completely // defined but all related tests are passing now. && !fromColumn) { reselect(); } else { setSelected(e.getStateChange() == ItemEvent.SELECTED); } } }
/** * Returns the listener to column's property changes. The listener * is created lazily if necessary. * * @return the <code>PropertyChangeListener</code> listening to * <code>TableColumn</code>'s property changes, guaranteed to be * not <code>null</code>. */ protected PropertyChangeListener getColumnListener() { if (columnListener == null) { columnListener = createPropertyChangeListener(); } return columnListener; }
/** * Returns the listener to column's property changes. The listener * is created lazily if necessary. * * @return the <code>PropertyChangeListener</code> listening to * <code>TableColumn</code>'s property changes, guaranteed to be * not <code>null</code>. */ protected PropertyChangeListener getColumnListener() { if (columnListener == null) { columnListener = createPropertyChangeListener(); } return columnListener; }
/** * Returns the listener to column's property changes. The listener * is created lazily if necessary. * * @return the <code>PropertyChangeListener</code> listening to * <code>TableColumn</code>'s property changes, guaranteed to be * not <code>null</code>. */ protected PropertyChangeListener getColumnListener() { if (columnListener == null) { columnListener = createPropertyChangeListener(); } return columnListener; }
/** * Returns the listener to column's property changes. The listener * is created lazily if necessary. * * @return the <code>PropertyChangeListener</code> listening to * <code>TableColumn</code>'s property changes, guaranteed to be * not <code>null</code>. */ protected PropertyChangeListener getColumnListener() { if (columnListener == null) { columnListener = createPropertyChangeListener(); } return columnListener; }
/** * Returns the listener to column's property changes. The listener * is created lazily if necessary. * * @return the <code>PropertyChangeListener</code> listening to * <code>TableColumn</code>'s property changes, guaranteed to be * not <code>null</code>. */ protected PropertyChangeListener getColumnListener() { if (columnListener == null) { columnListener = createPropertyChangeListener(); } return columnListener; }
/** * Returns true if the action is enabled. Returns * true only if the action is enabled and the table * column can be controlled. * * @return true if the action is enabled, false otherwise * @see #canControlColumn() */ @Override public boolean isEnabled() { return super.isEnabled() && canControlColumn(); }
/** * Releases actions and clears list of actions. * */ protected void clearColumnVisibilityActions() { if (columnVisibilityActions == null) return; for (ColumnVisibilityAction action : columnVisibilityActions) { action.releaseColumn(); } columnVisibilityActions.clear(); }
/** * Enforces selected to <code>true</code>. Called if user interaction * tried to de-select the last single visible column. * */ private void reselect() { firePropertyChange("selected", null, Boolean.TRUE); }
/** * Creates a action synched to the table column. * * @param column the <code>TableColumn</code> to keep synched to. */ public ColumnVisibilityAction(TableColumn column) { super((String) null); setStateAction(); installColumn(column); }
/** * Synchs name property to value. This is called on change of * tableColumn's <code>headerValue</code> property. * * @param value */ private void updateFromColumnHeader(Object value) { setName(String.valueOf(value)); }
/** * Returns true if the action is enabled. Returns * true only if the action is enabled and the table * column can be controlled. * * @return true if the action is enabled, false otherwise * @see #canControlColumn() */ @Override public boolean isEnabled() { return super.isEnabled() && canControlColumn(); }
/** * Synchs name property to value. This is called on change of * tableColumn's <code>headerValue</code> property. * * @param value */ private void updateFromColumnHeader(Object value) { setName(String.valueOf(value)); }
/** * Creates a action synched to the table column. * * @param column the <code>TableColumn</code> to keep synched to. */ public ColumnVisibilityAction(TableColumn column) { super((String) null); setStateAction(); installColumn(column); }