com.sas.swing.visuals
Class NodeActionEvent

com.sas.swing.visuals.NodeActionEvent
All Implemented Interfaces:
java.io.Serializable

public class NodeActionEvent

NodeActionEvent is fired from a viewer that performs an action on a NodeView object. The action command value of the event indicates which type of action has occurred.

Action Commands

The different action commands that a NodeActionEvent may contain are as follows:

Adding a Listener

NodeActionEvent is a subclass of java.awt.event.ActionEvent. Therefore classes which want to listen for NodeActionEvent events should implement java.awt.event.ActionListener and check the incoming event object to see if it is an instance of NodeActionEvent.

Here's a sample NodeActionEvent handler:

 public void actionPerformed(java.awt.event.ActionEvent event)
 {
    if (event instanceof NodeActionEvent)
    {
       NodeActionEvent naEvent = (NodeActionEvent)event;
       NodeView node = naEvent.getNode();
       if (naEvent.getActionCommand() == NodeActionEvent.EXPANDED)
       {
          System.out.println("node expanded: "+node.getNodeText());
       }
       else if (naEvent.getActionCommand() == NodeActionEvent.COLLAPSED)
       {
          System.out.println("node collapsed: "+node.getNodeText());
       }
    }
 }
 

See Also:
ActionListener, NodeView, TreeView, Serialized Form

Field Summary
static java.lang.String COLLAPSE_ALL_ENDING
          Collapse all ending action command.
static java.lang.String COLLAPSE_ALL_STARTING
          Collapse all starting action command.
static java.lang.String COLLAPSED
          Collapsed action command.
static java.lang.String COLLAPSING
          Collapsing action command.
static java.lang.String DEFAULT_ACTION
          Default action action command.
static java.lang.String EXPAND_ALL_ENDING
          Expand all ending action command.
static java.lang.String EXPAND_ALL_STARTING
          Expand all starting action command.
static java.lang.String EXPANDED
          Expanded action command.
static java.lang.String EXPANDING
          Expanding action command.
 
Constructor Summary
NodeActionEvent(java.lang.Object source, int id, java.lang.String command, int modifiers, NodeView node)
          Constructs a NodeActionEvent object.
NodeActionEvent(java.lang.Object source, int id, java.lang.String command, NodeView node)
          Constructs an NodeActionEvent object.
 
Method Summary
 void consume()
          Called to consume the event.
 NodeView getNode()
          Returns the NodeView object on which the action occurred.
 boolean isConsumed()
          Indicates whether or not the event has been consumed.
 

Field Detail

DEFAULT_ACTION

public static final java.lang.String DEFAULT_ACTION
Default action action command. This action command is assigned whenever a default action occurs. For example, TreeView assigns this action command for the event fired for the node that is either double-clicked or that has the enter key pressed on it.

See Also:
TreeView, Constant Field Values

EXPANDING

public static final java.lang.String EXPANDING
Expanding action command. This action command is assigned whenever a node is about to be expanded.

See Also:
Constant Field Values

EXPANDED

public static final java.lang.String EXPANDED
Expanded action command. This action command is assigned whenever a node is expanded.

See Also:
Constant Field Values

EXPAND_ALL_STARTING

public static final java.lang.String EXPAND_ALL_STARTING
Expand all starting action command. This action command is assigned whenever a recursive expand is starting on a node. The event with this action command should be received before any expands have occurred.

See Also:
Constant Field Values

EXPAND_ALL_ENDING

public static final java.lang.String EXPAND_ALL_ENDING
Expand all ending action command. This action command is assigned whenever a recursive expand is ending on a node. The event with this action command should be received after all expands have occurred.

See Also:
Constant Field Values

COLLAPSING

public static final java.lang.String COLLAPSING
Collapsing action command. This action command is assigned whenever a node is about to be collapsed.

See Also:
Constant Field Values

COLLAPSED

public static final java.lang.String COLLAPSED
Collapsed action command. This action command is assigned whenever a node is collapsed.

See Also:
Constant Field Values

COLLAPSE_ALL_STARTING

public static final java.lang.String COLLAPSE_ALL_STARTING
Collapse all starting action command. This action command is assigned whenever a recursive collapse is starting on a node. The event with this action command should be received before any collapses have occurred.

See Also:
Constant Field Values

COLLAPSE_ALL_ENDING

public static final java.lang.String COLLAPSE_ALL_ENDING
Collapse all ending action command. This action command is assigned whenever a recursive collapse is ending on a node. The event with this action command should be received after all collapses have occurred.

See Also:
Constant Field Values
Constructor Detail

NodeActionEvent

public NodeActionEvent(java.lang.Object source,
                       int id,
                       java.lang.String command,
                       NodeView node)
Constructs an NodeActionEvent object.

Parameters:
source - the object where the event originated
id - the type of event
command - the command string for this action event
node - the node on which the action occurred

NodeActionEvent

public NodeActionEvent(java.lang.Object source,
                       int id,
                       java.lang.String command,
                       int modifiers,
                       NodeView node)
Constructs a NodeActionEvent object.

Parameters:
source - the object where the event originated
id - the type of event
command - the command string for this action event
modifiers - the modifiers held down during this action
node - the node on which the action occurred
Method Detail

getNode

public NodeView getNode()
Returns the NodeView object on which the action occurred.

Returns:
the node receiving the action

isConsumed

public boolean isConsumed()
Indicates whether or not the event has been consumed.

Overrides:
isConsumed in class java.awt.AWTEvent
Returns:
true if the event has been consumed, otherwise false

consume

public void consume()
Called to consume the event.

Overrides:
consume in class java.awt.AWTEvent



Copyright © 2009 SAS Institute Inc. All Rights Reserved.