/** * Sets the additonalActionsVisible property. It controls whether or * not additional table actions should be included into the popup. <p> * * The default value is <code>true</code>. * * @param additionalActionsVisible the additionalActionsVisible to set */ public void setAdditionalActionsVisible(boolean additionalActionsVisible) { if (additionalActionsVisible == getAdditionalActionsVisible()) return; boolean old = getAdditionalActionsVisible(); this.additionalActionsVisible = additionalActionsVisible; populatePopup(); firePropertyChange("additionalActionsVisible", old, getAdditionalActionsVisible()); }
/** * Creates the default column control used by this table. This * implementation returns a <code>ColumnControlButton</code> configured with * default <code>ColumnControlIcon</code>. * * @return the default component used as column control. * @see #setColumnControl(JComponent) * @see org.jdesktop.swingx.table.ColumnControlButton * @see org.jdesktop.swingx.icon.ColumnControlIcon */ protected JComponent createDefaultColumnControl() { return new ColumnControlButton(this); }
/** * Populates the popup from scratch. * * If applicable, creates and adds column visibility actions. Always adds * additional actions. */ protected void populatePopup() { clearAll(); if (canControl()) { createVisibilityActions(); addVisibilityActionItems(); } addAdditionalActionItems(); }
/** * Sets the grouper to use for grouping the additional actions. Maybe null to * have no additional grouping. Has no effect * if the ColumnControlPopup doesn't implement Groupable. The default * ColumnControlPopup supports Groupable, but is instantiated without a Grouper. * * @param grouper */ public void setActionGrouper(ActionGrouper grouper) { if (!(getColumnControlPopup() instanceof ActionGroupable)) return; ((ActionGroupable) getColumnControlPopup()).setActionGrouper(grouper); populatePopup(); }
/** * 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()); } }
/** * Adds additional actions to the popup, if additionalActionsVisible is true, * does nothing otherwise.<p> * * Here: delegates the list of actions as returned by #getAdditionalActions() * to the DefaultColumnControlPopup. * Does nothing if #getColumnActions() is empty. * */ protected void addAdditionalActionItems() { if (!getAdditionalActionsVisible()) return; getColumnControlPopup().addAdditionalActionItems( Collections.unmodifiableList(getAdditionalActions())); }
public void update() { super.populatePopup(); } }
/** * * removes all components from the popup, making sure to release all * columnVisibility actions. * */ protected void clearAll() { clearColumnVisibilityActions(); getColumnControlPopup().removeAll(); }
@Override public void actionPerformed(ActionEvent e) { togglePopup(); }
/** * Adds additional actions to the popup. * Here: delegates the list of actions as returned by #getAdditionalActions() * to the DefaultColumnControlPopup. * Does nothing if #getColumnActions() is empty. * */ protected void addAdditionalActionItems() { getColumnControlPopup().addAdditionalActionItems( Collections.unmodifiableList(getAdditionalActions())); }
/** * @inheritDoc * */ public void addAdditionalActionItems(List<? extends Action> actions) { if (actions.size() == 0) return; // JW: this is a reference to the enclosing class // prevents to make this implementation static // Hmmm...any way around? if (canControl()) { addSeparator(); } addItems(actions); }
protected void createVisibilityActions() { if(showVisibilityActions == true){ super.createVisibilityActions(); } }
@Override protected List<Action> getAdditionalActions() { final List<Action> additionalActions = super.getAdditionalActions(); final AbstractAction saveLayout = new AbstractAction("Save current to new column layout", Icons.DISK) { @Override
/** * 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()); } }
/** * Adds additional actions to the popup, if additionalActionsVisible is true, * does nothing otherwise.<p> * * Here: delegates the list of actions as returned by #getAdditionalActions() * to the DefaultColumnControlPopup. * Does nothing if #getColumnActions() is empty. * */ protected void addAdditionalActionItems() { if (!getAdditionalActionsVisible()) return; getColumnControlPopup().addAdditionalActionItems( Collections.unmodifiableList(getAdditionalActions())); }
/** Tells listeners that a column was removed from the model. */ @Override public void columnRemoved(TableColumnModelEvent e) { if (!isVisibilityChange(e, false)) { populatePopup(); } }
/** * Sets the grouper to use for grouping the additional actions. Maybe null to * have no additional grouping. Has no effect * if the ColumnControlPopup doesn't implement Groupable. The default * ColumnControlPopup supports Groupable, but is instantiated without a Grouper. * * @param grouper */ public void setActionGrouper(ActionGrouper grouper) { if (!(getColumnControlPopup() instanceof ActionGroupable)) return; ((ActionGroupable) getColumnControlPopup()).setActionGrouper(grouper); populatePopup(); }
/** * * removes all components from the popup, making sure to release all * columnVisibility actions. * */ protected void clearAll() { clearColumnVisibilityActions(); getColumnControlPopup().removeAll(); }
@Override public void actionPerformed(ActionEvent e) { togglePopup(); }
/** * @inheritDoc * */ @Override public void addAdditionalActionItems(List<? extends Action> actions) { if (actions.size() == 0) return; // JW: this is a reference to the enclosing class // prevents to make this implementation static // Hmmm...any way around? if (canControl()) { addSeparator(); } if (getGrouper() == null) { addItems(actions); return; } List<? extends List<? extends Action>> groups = grouper.group(actions); for (List<? extends Action> group : groups) { addItems(group); if (group != groups.get(groups.size()- 1)) addSeparator(); } }