Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.ide.menu
Class IDEAction  view IDEAction download IDEAction.java

java.lang.Object
  extended byjavax.ide.view.DefaultViewable
      extended byjavax.ide.menu.IDEAction
All Implemented Interfaces:
javax.ide.Identifiable, javax.ide.view.Viewable

public class IDEAction
extends javax.ide.view.DefaultViewable
implements javax.ide.Identifiable, javax.ide.view.Viewable

IDEAction encapsulates the meta-data describing an executable action.


Field Summary
private  boolean _checked
           
private  boolean _enabled
           
private  javax.ide.util.IconDescription _icon
           
private  java.lang.String _id
           
private  boolean _isToggle
           
private  java.lang.String _label
           
private  int _mnemonic
           
private  javax.swing.event.SwingPropertyChangeSupport _propertyChangeSupport
           
private  java.lang.String _toolTip
           
static java.lang.String PROP_CHECKED
          Identifies the bound property 'checked'.
static java.lang.String PROP_ENABLED
          Identifies the bound property 'enabled'.
static java.lang.String PROP_MNEMONIC
          Identifies the bound property 'mnemonic'.
 
Fields inherited from class javax.ide.view.DefaultViewable
 
Fields inherited from interface javax.ide.view.Viewable
PROP_ICON_PATH, PROP_LABEL, PROP_VISIBLE
 
Constructor Summary
IDEAction(java.lang.String id)
          Constructor.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a java.beans.PropertyChangeListener to the listener list.
 java.util.List getControllers()
          Get the controllers for this action.
 javax.ide.util.IconDescription getIcon()
          Gets a relative path to the icon.
 java.lang.String getID()
          Gets this object's unique identifier.
 java.lang.String getLabel()
          Returns a short label that can be displayed to the user.
 int getMnemonic()
           
 java.lang.String getToolTip()
          Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Viewable.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 boolean isChecked()
          Find out whether the state of this IDEAction is checked or unchecked.
 boolean isEnabled()
           
 boolean isToggleItem()
          Get whether this action is a toggle action.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a java.beans.PropertyChangeListener from the listener list.
 void setChecked(boolean checked)
          Set the state of the IDEAction.
 void setEnabled(boolean enabled)
          Set the enabled state of the IDEAction.
 void setIcon(javax.ide.util.IconDescription icon)
          Set the action icon path.
 void setLabel(java.lang.String label)
          Set the action label.
 void setMnemonic(int mnemonic)
          Set the action label mnemonic character.
 void setToggleItem(boolean isToggleItem)
           
 void setToolTip(java.lang.String toolTip)
          Set the action tooltip.
 java.lang.String toString()
          Returns the label.
 
Methods inherited from class javax.ide.view.DefaultViewable
firePropertyChange, isVisible, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.ide.view.Viewable
isVisible
 

Field Detail

PROP_MNEMONIC

public static final java.lang.String PROP_MNEMONIC
Identifies the bound property 'mnemonic'.

See Also:
Constant Field Values

PROP_CHECKED

public static final java.lang.String PROP_CHECKED
Identifies the bound property 'checked'.

See Also:
Constant Field Values

PROP_ENABLED

public static final java.lang.String PROP_ENABLED
Identifies the bound property 'enabled'.

See Also:
Constant Field Values

_id

private java.lang.String _id

_isToggle

private boolean _isToggle

_checked

private boolean _checked

_enabled

private boolean _enabled

_label

private java.lang.String _label

_mnemonic

private int _mnemonic

_toolTip

private java.lang.String _toolTip

_icon

private javax.ide.util.IconDescription _icon

_propertyChangeSupport

private javax.swing.event.SwingPropertyChangeSupport _propertyChangeSupport
Constructor Detail

IDEAction

public IDEAction(java.lang.String id)
Constructor. The id must be a unique string identifier. This ID can be used to find the action using the ActionRegistry.

Method Detail

isChecked

public boolean isChecked()
Find out whether the state of this IDEAction is checked or unchecked.


setChecked

public void setChecked(boolean checked)
Set the state of the IDEAction. Bound property.


isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Set the enabled state of the IDEAction. Bound property.


isToggleItem

public boolean isToggleItem()
Get whether this action is a toggle action.


getLabel

public java.lang.String getLabel()
Description copied from interface: javax.ide.view.Viewable
Returns a short label that can be displayed to the user. Generally, the value of the returned java.lang.String is considered translatable and should therefore be placed in an appropriate resource file. When possible, the returned label should be reasonably short enough to show in the navigator or explorer windows but long enough to clearly identify and distinguish the Viewable.

Specified by:
getLabel in interface javax.ide.view.Viewable

setLabel

public void setLabel(java.lang.String label)
Set the action label.


getMnemonic

public int getMnemonic()

setMnemonic

public void setMnemonic(int mnemonic)
Set the action label mnemonic character.


getToolTip

public java.lang.String getToolTip()
Description copied from interface: javax.ide.view.Viewable
Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Viewable.

Specified by:
getToolTip in interface javax.ide.view.Viewable

setToolTip

public void setToolTip(java.lang.String toolTip)
Set the action tooltip.


getIcon

public javax.ide.util.IconDescription getIcon()
Description copied from interface: javax.ide.view.Viewable
Gets a relative path to the icon. Generally, the is considered translatable, therefore, the path value be placed in an appropriate resource file. The path must be relative the Viewable implementation class file location or the resource file location if one is provided.

Specified by:
getIcon in interface javax.ide.view.Viewable

setIcon

public void setIcon(javax.ide.util.IconDescription icon)
Set the action icon path.


getControllers

public java.util.List getControllers()
Get the controllers for this action.


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: javax.ide.view.Viewable
Add a java.beans.PropertyChangeListener to the listener list. A PropertyChangeEvent will be fired in response to setting a bound property.

Specified by:
addPropertyChangeListener in interface javax.ide.view.Viewable

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: javax.ide.view.Viewable
Removes a java.beans.PropertyChangeListener from the listener list.

Specified by:
removePropertyChangeListener in interface javax.ide.view.Viewable

toString

public java.lang.String toString()
Description copied from interface: javax.ide.view.Viewable
Returns the label. This overrides the toString method in java.lang.Object.

Implementors of the Viewable interface should override this as appropriate. The default implementation is the same as getLabel()

Specified by:
toString in interface javax.ide.view.Viewable

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


getID

public java.lang.String getID()
Description copied from interface: javax.ide.Identifiable
Gets this object's unique identifier.

Specified by:
getID in interface javax.ide.Identifiable

setToggleItem

public void setToggleItem(boolean isToggleItem)