/** * Sets the selected state of a toggle action. If the id doesn't * correspond to a toggle action then it will fail silently. * * @param id the value of the action id * @param selected true if the action is to be selected; otherwise false. */ public void setSelected(Object id, boolean selected) { AbstractActionExt action = getStateChangeAction(id); if (action != null) { action.setSelected(selected); } }
/** * 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(); }
/** * Copy constructor copies the state. */ public AbstractActionExt(AbstractActionExt action) { Object[] keys = action.getKeys(); for (int i = 0; i < keys.length; i++) { putValue((String)keys[i], action.getValue((String)keys[i])); } this.enabled = action.enabled; // Copy change listeners. PropertyChangeListener[] listeners = action.getPropertyChangeListeners(); for (int i = 0; i < listeners.length; i++) { addPropertyChangeListener(listeners[i]); } }
private static Action configureAction(AbstractActionExt action, String mnemonic, boolean toggle, String group) { action.setMnemonic(mnemonic); String description = action.getName() + " action with comand " + action.getActionCommand(); action.setShortDescription(description); action.setLongDescription(description); if (toggle) { action.setStateAction(); } if (group != null) { action.setGroup(group); } return action; }
/** * Sets the short description of the action. This will also * set the long description value is it is null. * <p> * This is a convenience method for <code>putValue</code> with the * <code>Action.SHORT_DESCRIPTION</code> key. * * @param desc the short description; can be <code>null</code>w * @see Action#SHORT_DESCRIPTION * @see Action#putValue */ public void setShortDescription(String desc) { putValue(Action.SHORT_DESCRIPTION, desc); if (desc != null && getLongDescription() == null) { setLongDescription(desc); } }
AbstractActionExt ta = (AbstractActionExt)action; if (ta.isStateAction()) { String groupid = (String)ta.getGroup(); if (groupid != null) {
/** * Callback method as <code>ItemListener</code>. Updates internal state based * on the given ItemEvent. <p> * * Here: synchs selected property if isStateAction(), does nothing otherwise. * * @param e the ItemEvent fired by a ItemSelectable on changing the selected * state. */ public void itemStateChanged(ItemEvent e) { if (isStateAction()) { setSelected(ItemEvent.SELECTED == e.getStateChange()); } }
protected void configureReportAction(AbstractActionExt reportAction) { reportAction.setName(UIManagerExt.getString(CLASS_NAME + ".report_button_text", pane.getLocale())); // reportButton.setText("Send Report To Apple"); // reportButton.setPreferredSize(new Dimension(100, 30)); // reportButton.setMinimumSize(new Dimension(100, 30)); }
@Override public String toString() { StringBuffer buffer = new StringBuffer("["); // RG: Fix for J2SE 5.0; Can't cascade append() calls because // return type in StringBuffer and AbstractStringBuilder are different buffer.append(this.getClass().toString()); buffer.append(":"); try { Object[] keys = getKeys(); for (int i = 0; i < keys.length; i++) { buffer.append(keys[i]); buffer.append('='); buffer.append(getValue( (String) keys[i]).toString()); if (i < keys.length - 1) { buffer.append(','); } } buffer.append(']'); } catch (Exception ex) { // RG: append(char) throws IOException in J2SE 5.0 /** @todo Log it */ } return buffer.toString(); }
/** * called from listening to empty property of PatternModel. * * this implementation calls super and additionally synchs the * enabled state of FIND_NEXT_ACTION_COMMAND, FIND_PREVIOUS_ACTION_COMMAND * to !empty. */ @Override protected void refreshEmptyFromModel() { super.refreshEmptyFromModel(); boolean enabled = !getPatternModel().isEmpty(); getAction(FIND_NEXT_ACTION_COMMAND).setEnabled(enabled); getAction(FIND_PREVIOUS_ACTION_COMMAND).setEnabled(enabled); }
private static Action configureAction(AbstractActionExt action, String mnemonic, boolean toggle, String group) { action.setMnemonic(mnemonic); String description = action.getName() + " action with comand " + action.getActionCommand(); action.setShortDescription(description); action.setLongDescription(description); if (toggle) { action.setStateAction(); } if (group != null) { action.setGroup(group); } return action; }
/** * Sets the short description of the action. This will also * set the long description value is it is null. * <p> * This is a convenience method for <code>putValue</code> with the * <code>Action.SHORT_DESCRIPTION</code> key. * * @param desc the short description; can be <code>null</code>w * @see Action#SHORT_DESCRIPTION * @see Action#putValue */ public void setShortDescription(String desc) { putValue(Action.SHORT_DESCRIPTION, desc); if (desc != null && getLongDescription() == null) { setLongDescription(desc); } }
AbstractActionExt ta = (AbstractActionExt)action; if (ta.isStateAction()) { String groupid = (String)ta.getGroup(); if (groupid != null) {
/** * Callback method as <code>ItemListener</code>. Updates internal state based * on the given ItemEvent. <p> * * Here: synchs selected property if isStateAction(), does nothing otherwise. * * @param e the ItemEvent fired by a ItemSelectable on changing the selected * state. */ @Override public void itemStateChanged(ItemEvent e) { if (isStateAction()) { setSelected(ItemEvent.SELECTED == e.getStateChange()); } } }
@Override protected void configureReportAction(AbstractActionExt reportAction) { reportAction.setName(UIManagerExt.getString(CLASS_NAME + ".report_button_text", pane.getLocale())); // reportButton.setText("Send Report To Apple"); // reportButton.setPreferredSize(new Dimension(100, 30)); // reportButton.setMinimumSize(new Dimension(100, 30)); }
@Override public String toString() { StringBuffer buffer = new StringBuffer("["); // RG: Fix for J2SE 5.0; Can't cascade append() calls because // return type in StringBuffer and AbstractStringBuilder are different buffer.append(this.getClass().toString()); buffer.append(":"); try { Object[] keys = getKeys(); for (int i = 0; i < keys.length; i++) { buffer.append(keys[i]); buffer.append('='); buffer.append(getValue( (String) keys[i]).toString()); if (i < keys.length - 1) { buffer.append(','); } } buffer.append(']'); } catch (Exception ex) { // RG: append(char) throws IOException in J2SE 5.0 /** @todo Log it */ } return buffer.toString(); }
/** * called from listening to empty property of PatternModel. * * this implementation calls super and additionally synchs the * enabled state of FIND_NEXT_ACTION_COMMAND, FIND_PREVIOUS_ACTION_COMMAND * to !empty. */ @Override protected void refreshEmptyFromModel() { super.refreshEmptyFromModel(); boolean enabled = !getPatternModel().isEmpty(); getAction(FIND_NEXT_ACTION_COMMAND).setEnabled(enabled); getAction(FIND_PREVIOUS_ACTION_COMMAND).setEnabled(enabled); }
private static Action configureAction(AbstractActionExt action, String mnemonic, boolean toggle, String group) { action.setMnemonic(mnemonic); String description = action.getName() + " action with comand " + action.getActionCommand(); action.setShortDescription(description); action.setLongDescription(description); if (toggle) { action.setStateAction(); } if (group != null) { action.setGroup(group); } return action; }
/** * Copy constructor copies the state. */ public AbstractActionExt(AbstractActionExt action) { Object[] keys = action.getKeys(); for (int i = 0; i < keys.length; i++) { putValue((String)keys[i], action.getValue((String)keys[i])); } this.enabled = action.enabled; // Copy change listeners. PropertyChangeListener[] listeners = action.getPropertyChangeListeners(); for (int i = 0; i < listeners.length; i++) { addPropertyChangeListener(listeners[i]); } }
/** * Sets the selected state of a toggle action. If the id doesn't * correspond to a toggle action then it will fail silently. * * @param id the value of the action id * @param selected true if the action is to be selected; otherwise false. */ public void setSelected(Object id, boolean selected) { AbstractActionExt action = getStateChangeAction(id); if (action != null) { action.setSelected(selected); } }