Class AbstractActionExt

    • Constructor Detail

      • AbstractActionExt

        public AbstractActionExt()
        Default constructor, does nothing.
      • AbstractActionExt

        public AbstractActionExt​(AbstractActionExt action)
        Copy constructor copies the state.
      • AbstractActionExt

        public AbstractActionExt​(String name)
      • AbstractActionExt

        public AbstractActionExt​(String name,
                                 Icon icon)
      • AbstractActionExt

        public AbstractActionExt​(String name,
                                 String command)
        Constructs an Action with the label and command
        Parameters:
        name - name of the action usually used as a label
        command - command key of the action
      • AbstractActionExt

        public AbstractActionExt​(String name,
                                 String command,
                                 Icon icon)
        Parameters:
        name - display name of the action
        command - the value of the action command key
        icon - icon to display
    • Method Detail

      • getShortDescription

        public String getShortDescription()
        Returns a short description of the action.
        Returns:
        the short description or null
      • getLongDescription

        public String getLongDescription()
        Returns a long description of the action.
        Returns:
        the long description or null
      • setLongDescription

        public void setLongDescription​(String desc)
        Sets the long description of the action. This will also set the value of the short description if that value is null.

        This is a convenience method for putValue with the Action.LONG_DESCRIPTION key.

        Parameters:
        desc - the long description; can be null
        See Also:
        Action.LONG_DESCRIPTION, Action.putValue(java.lang.String, java.lang.Object)
      • getSmallIcon

        public Icon getSmallIcon()
        Returns a small icon which represents the action.
        Returns:
        the small icon or null
      • getLargeIcon

        public Icon getLargeIcon()
        Returns a large icon which represents the action.
        Returns:
        the large icon or null
      • getName

        public String getName()
        Returns the name of the action.
        Returns:
        the name of the action or null
      • setMnemonic

        public void setMnemonic​(String mnemonic)
      • getMnemonic

        public int getMnemonic()
        Return the mnemonic key code for the action.
        Returns:
        the mnemonic or 0
      • getActionCommand

        public Object getActionCommand()
        Returns the action command.
        Returns:
        the action command or null
      • getAccelerator

        public KeyStroke getAccelerator()
        Returns the key stroke which represents an accelerator for the action.
        Returns:
        the key stroke or null
      • setGroup

        public void setGroup​(Object group)
        Sets the group identity of the state action. This is used to identify the action as part of a button group.
      • getGroup

        public Object getGroup()
      • dispose

        public void dispose()
        Will perform cleanup on the object. Should be called when finished with the Action. This should be used if a new action is constructed from the properties of an old action. The old action properties should be disposed.
      • isStateAction

        public boolean isStateAction()
        Indicates if this action has states. If this method returns true then the this will send ItemEvents to ItemListeners when the control constructed with this action in invoked.
        Returns:
        true if this can handle states
      • setStateAction

        public void setStateAction()
        Set the state property to true.
      • setStateAction

        public void setStateAction​(boolean state)
        Set the state property.
        Parameters:
        state - if true then this action will fire ItemEvents
      • isSelected

        public boolean isSelected()
        Returns:
        true if the action is in the selected state
      • setSelected

        public void setSelected​(boolean newValue)
        Changes the state of the action
        Parameters:
        newValue - true to set the action as selected of the action.
      • itemStateChanged

        public void itemStateChanged​(ItemEvent e)
        Callback method as ItemListener. Updates internal state based on the given ItemEvent.

        Here: synchs selected property if isStateAction(), does nothing otherwise.

        Specified by:
        itemStateChanged in interface ItemListener
        Parameters:
        e - the ItemEvent fired by a ItemSelectable on changing the selected state.