com.rapidminer.gui
Class ConditionalAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.rapidminer.gui.ConditionalAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
RenameOperatorAction, ResourceAction

public abstract class ConditionalAction
extends javax.swing.AbstractAction

An action that must be enabled/disabled depending on certain conditions. These conditions can be mandatory, disallowed, or irrelevant. All ConditionalActions created are added to a collection and there status is automatically checked if the condition premises might have changed.

Author:
Ingo Mierswa, Simon Fischer
See Also:
Serialized Form

Field Summary
static int DISALLOWED
           
static int DONT_CARE
           
static int EDIT_IN_PROGRESS
           
static int EXECUTION_UNIT_SELECTED
          TODO: Unused
static int MANDATORY
           
static int NUMBER_OF_CONDITIONS
           
static int OPERATOR_CHAIN_SELECTED
           
static int OPERATOR_SELECTED
           
static int PARENT_ENABLED
           
static int PROCESS_PAUSED
           
static int PROCESS_RUNNING
           
static int PROCESS_STOPPED
           
static int ROOT_SELECTED
           
static int SIBLINGS_EXIST
           
 
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
ConditionalAction(java.lang.String name)
           
ConditionalAction(java.lang.String name, javax.swing.Icon icon)
           
 
Method Summary
 void setCondition(int index, int condition)
           
protected  void update(boolean[] state)
          Updates an action given the set of states that can be true or false.
static void updateAll(boolean[] states)
          Updates all actions.
 
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 java.awt.event.ActionListener
actionPerformed
 

Field Detail

DISALLOWED

public static final int DISALLOWED
See Also:
Constant Field Values

DONT_CARE

public static final int DONT_CARE
See Also:
Constant Field Values

MANDATORY

public static final int MANDATORY
See Also:
Constant Field Values

OPERATOR_SELECTED

public static final int OPERATOR_SELECTED
See Also:
Constant Field Values

OPERATOR_CHAIN_SELECTED

public static final int OPERATOR_CHAIN_SELECTED
See Also:
Constant Field Values

ROOT_SELECTED

public static final int ROOT_SELECTED
See Also:
Constant Field Values

SIBLINGS_EXIST

public static final int SIBLINGS_EXIST
See Also:
Constant Field Values

PROCESS_STOPPED

public static final int PROCESS_STOPPED
See Also:
Constant Field Values

PROCESS_PAUSED

public static final int PROCESS_PAUSED
See Also:
Constant Field Values

PROCESS_RUNNING

public static final int PROCESS_RUNNING
See Also:
Constant Field Values

PARENT_ENABLED

public static final int PARENT_ENABLED
See Also:
Constant Field Values

EXECUTION_UNIT_SELECTED

public static final int EXECUTION_UNIT_SELECTED
TODO: Unused

See Also:
Constant Field Values

EDIT_IN_PROGRESS

public static final int EDIT_IN_PROGRESS
See Also:
Constant Field Values

NUMBER_OF_CONDITIONS

public static final int NUMBER_OF_CONDITIONS
See Also:
Constant Field Values
Constructor Detail

ConditionalAction

public ConditionalAction(java.lang.String name)

ConditionalAction

public ConditionalAction(java.lang.String name,
                         javax.swing.Icon icon)
Method Detail

setCondition

public void setCondition(int index,
                         int condition)
Parameters:
index - one out of OPERATOR_SELECTED, OPERATOR_CHAIN_SELECTED, ROOT_SELECTED, CLIPBOARD_FILLED, and PROCESS_RUNNING
condition - one out of DISALLOWED, DONT_CARE, and MANDATORY

updateAll

public static void updateAll(boolean[] states)
Updates all actions.


update

protected void update(boolean[] state)
Updates an action given the set of states that can be true or false. States refer to OPERATOR_SELECTED... An action is enabled iff for all states the condition is MANDATORY and state is true or DISALLOWED and state is false. If for all states the condition is DONT_CARE, the enabling status of the action is not touched.



Copyright © 2001-2009 by Rapid-I