站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

StateModel (Visual Library API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.api.visual 2.2

org.netbeans.api.visual.model
Class StateModel

java.lang.Object
  extended by org.netbeans.api.visual.model.StateModel

public final class StateModel
extends Object

This class represents a model with a single state which can be boolean or non-negative integer value. It supports stateChanged event listening.


Nested Class Summary
static interface StateModel.Listener
          The listener for listening on state changed event on a state model.
 
Constructor Summary
StateModel()
          Creates a boolean (2-states) model.
StateModel(int maxStates)
          Creates a model with a specified maximal states.
 
Method Summary
 void addListener(StateModel.Listener listener)
          Adds a listener of a state value changed.
 void decrease()
          Decreases the state value.
 boolean getBooleanState()
          Returns a boolean representation of a state.
 int getMaxStates()
          Returns a maximal states.
 int getState()
          Returns a integer representation of the state.
 void increase()
          Increases the state value.
 void removeListener(StateModel.Listener listener)
          Removes a listener of a state value changed.
 void setBooleanState(boolean state)
          Sets a boolean state.
 void setState(int state)
          Sets a new state value.
 void toggleBooleanState()
          Toggles boolean state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateModel

public StateModel()
Creates a boolean (2-states) model.


StateModel

public StateModel(int maxStates)
Creates a model with a specified maximal states.

Parameters:
maxStates - the maximal states
Method Detail

getBooleanState

public boolean getBooleanState()
Returns a boolean representation of a state.

Returns:
the boolean value (true for non-zero value, false for zero value)

setBooleanState

public void setBooleanState(boolean state)
Sets a boolean state.

Parameters:
state - the boolean state; if true, then 1 value is used; if false, then 0 value is used

toggleBooleanState

public void toggleBooleanState()
Toggles boolean state.


getState

public int getState()
Returns a integer representation of the state.

Returns:
the integer value of the state.

decrease

public void decrease()
Decreases the state value. If new value would have to be negative, then the maxStates-1 value is used instead.


increase

public void increase()
Increases the state value. If new value would have to be maxStates or higher, then the 0 value is used instead.


setState

public void setState(int state)
Sets a new state value.

Parameters:
state - the new state value

getMaxStates

public int getMaxStates()
Returns a maximal states.

Returns:
the maximal states; 2 for boolean model

addListener

public void addListener(StateModel.Listener listener)
Adds a listener of a state value changed.

Parameters:
listener - the listener

removeListener

public void removeListener(StateModel.Listener listener)
Removes a listener of a state value changed.

Parameters:
listener - the listener

org.netbeans.api.visual 2.2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.