Class RecordableTextAction

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean isRecordable
      Whether this text action should be recorded in a macro.
      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      RecordableTextAction​(java.lang.String text)
      Constructor.
      RecordableTextAction​(java.lang.String text, javax.swing.Icon icon, java.lang.String desc, java.lang.Integer mnemonic, javax.swing.KeyStroke accelerator)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      This method is final so that you cannot override it and mess up the macro-recording part of it.
      abstract void actionPerformedImpl​(java.awt.event.ActionEvent e, RTextArea textArea)
      The actual meat of the action.
      javax.swing.KeyStroke getAccelerator()
      Returns the accelerator for this action.
      java.lang.String getDescription()
      Returns the description for this action.
      javax.swing.Icon getIcon()
      Returns the icon for this action.
      abstract java.lang.String getMacroID()
      Returns the identifier for this macro.
      int getMnemonic()
      Returns the mnemonic for this action.
      java.lang.String getName()
      Returns the name of this action.
      java.lang.String getShortDescription()
      Returns the short description for this action.
      boolean isRecordable()
      Returns whether this action will be recorded and replayed in a macro.
      void setAccelerator​(javax.swing.KeyStroke accelerator)
      Sets the accelerator for this action.
      void setMnemonic​(char mnemonic)
      Sets the mnemonic for this action.
      void setMnemonic​(java.lang.Integer mnemonic)
      Sets the mnemonic for this action.
      void setName​(java.lang.String name)
      Sets the name of this action.
      void setProperties​(java.util.ResourceBundle msg, java.lang.String keyRoot)
      Sets the name, mnemonic, and description of this action.
      void setRecordable​(boolean recordable)
      Sets whether this action will be recorded and replayed in a macro.
      void setShortDescription​(java.lang.String shortDesc)
      Sets the short description for this action.
      • Methods inherited from class javax.swing.text.TextAction

        augmentList, getFocusedComponent, getTextComponent
      • Methods inherited from class javax.swing.AbstractAction

        addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Field Detail

      • isRecordable

        private boolean isRecordable
        Whether this text action should be recorded in a macro.
    • Constructor Detail

      • RecordableTextAction

        public RecordableTextAction​(java.lang.String text)
        Constructor.
        Parameters:
        text - The text (name) associated with the action.
      • RecordableTextAction

        public RecordableTextAction​(java.lang.String text,
                                    javax.swing.Icon icon,
                                    java.lang.String desc,
                                    java.lang.Integer mnemonic,
                                    javax.swing.KeyStroke accelerator)
        Constructor.
        Parameters:
        text - The text (name) associated with the action.
        icon - The icon associated with the action.
        desc - The description of the action.
        mnemonic - The mnemonic for the action.
        accelerator - The accelerator key for the action.
    • Method Detail

      • actionPerformedImpl

        public abstract void actionPerformedImpl​(java.awt.event.ActionEvent e,
                                                 RTextArea textArea)
        The actual meat of the action. If you wish to subclass this action and modify its behavior, this is the method to override.
        Parameters:
        e - The action being performed.
        textArea - The text area "receiving" the action.
        See Also:
        actionPerformed(java.awt.event.ActionEvent)
      • getAccelerator

        public javax.swing.KeyStroke getAccelerator()
        Returns the accelerator for this action.
        Returns:
        The accelerator.
        See Also:
        setAccelerator(KeyStroke)
      • getDescription

        public java.lang.String getDescription()
        Returns the description for this action.
        Returns:
        The description.
      • getIcon

        public javax.swing.Icon getIcon()
        Returns the icon for this action.
        Returns:
        The icon.
      • getMacroID

        public abstract java.lang.String getMacroID()
        Returns the identifier for this macro. This method makes it so that you can create an instance of the RTextAreaEditorKit.CutAction action, for example, rename it to "Remove", and it will still be recorded as a "cut" action. Subclasses should return a unique string from this method; preferably the name of the action.

        If you subclass a RecordableTextAction, you should NOT override this method; if you do, the action may not be properly recorded in a macro.

        Returns:
        The internally-used macro ID.
      • getName

        public java.lang.String getName()
        Returns the name of this action.
        Returns:
        The name of this action.
        See Also:
        setName(String)
      • getShortDescription

        public java.lang.String getShortDescription()
        Returns the short description for this action.
        Returns:
        The short description for this action.
        See Also:
        setShortDescription(String)
      • isRecordable

        public boolean isRecordable()
        Returns whether this action will be recorded and replayed in a macro.
        Returns:
        Whether this action will be recorded and replayed.
        See Also:
        setRecordable(boolean)
      • setAccelerator

        public void setAccelerator​(javax.swing.KeyStroke accelerator)
        Sets the accelerator for this action.
        Parameters:
        accelerator - The new accelerator.
        See Also:
        getAccelerator()
      • setMnemonic

        public void setMnemonic​(char mnemonic)
        Sets the mnemonic for this action.
        Parameters:
        mnemonic - The new mnemonic.
        See Also:
        setMnemonic(Integer), getMnemonic()
      • setMnemonic

        public void setMnemonic​(java.lang.Integer mnemonic)
        Sets the mnemonic for this action.
        Parameters:
        mnemonic - The new mnemonic.
        See Also:
        setMnemonic(char), getMnemonic()
      • setName

        public void setName​(java.lang.String name)
        Sets the name of this action.
        Parameters:
        name - The new name.
        See Also:
        getName()
      • setProperties

        public void setProperties​(java.util.ResourceBundle msg,
                                  java.lang.String keyRoot)
        Sets the name, mnemonic, and description of this action.
        Parameters:
        msg - The resource bundle.
        keyRoot - The root of the keys for the properties. ".Name", ".Mnemonic", and ".Desc" will be appended to create the key for each property.
      • setRecordable

        public void setRecordable​(boolean recordable)
        Sets whether this action will be recorded and replayed in a macro.
        Parameters:
        recordable - Whether this action should be recorded and replayed.
        See Also:
        isRecordable()
      • setShortDescription

        public void setShortDescription​(java.lang.String shortDesc)
        Sets the short description for this action.
        Parameters:
        shortDesc - The short description for this action.