Cytoscape 2.6.0 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.layout
Class Tunable

java.lang.Object
  extended by cytoscape.layout.Tunable

public class Tunable
extends Object

The Tunable class provides a convenient way to encapsulate CyLayoutAlgorithm property and settings values. Each Tunable has a name, which corresponds to the property name, a description, which is used as the label in the settings dialog, a type, a value, and information about the value, such as a list of options or the lower and upper bounds for the value. These are meant to be used as part of the LayoutSettingsDialog (see getPanel).


Field Summary
static int BOOLEAN
           
static int DOUBLE
           
static int EDGEATTRIBUTE
           
static int GROUP
           
static int INTEGER
          Types
static int LIST
           
static int MULTISELECT
          For LIST, NODEATTRIBUTE, or EDGEATTRIBUTE types, use a list widget that supports multiselect rather than a combo box.
static int NODEATTRIBUTE
           
static int NOINPUT
          Flags
static int NUMERICATTRIBUTE
          For attributes, indicate that the list should be restricted to integer or float attributes.
static int STRING
           
 
Constructor Summary
Tunable(String name, String desc, int type, Object value)
          Constructor to create a Tunable with no bounds information, and no flag.
Tunable(String name, String desc, int type, Object value, int flag)
          Constructor to create a Tunable with no bounds information, but with a flag.
Tunable(String name, String desc, int type, Object value, Object lowerBound, Object upperBound, int flag)
          Constructor to create a Tunable with bounds information as well as a flag.
Tunable(String name, String desc, int type, Object value, Object lowerBound, Object upperBound, int flag, boolean immutable)
           
 
Method Summary
 void clearFlag(int flag)
          This method can be used to clear a flag for this Tunable
 String getDescription()
          Method to return the description for this Tunable.
 Object getLowerBound()
          Method to get the lowerBound for this Tunable.
 String getName()
          Method to return a string representation of this Tunable, which is essentially its name.
 JPanel getPanel()
          This method returns a JPanel suitable for inclusion in the LayoutSettingsDialog to represent this Tunable.
 int getType()
          Method to return the type of this Tunable.
 Object getUpperBound()
          Method to get the upperBound for this Tunable.
 Object getValue()
          This method returns the current value.
 void setFlag(int flag)
          This method can be used to set a flag for this Tunable
 void setLowerBound(Object lowerBound)
          Method to set the lowerBound for this Tunable.
 void setUpperBound(Object upperBound)
          Method to set the upperBound for this Tunable.
 void setValue(Object value)
          This method is used to set the value for this Tunable.
 String toString()
          Method to return a string representation of this Tunable, which is essentially its name.
 void updateValue()
          This method is called to extract the user-entered data from the JPanel and store it as our value.
 boolean valueChanged()
          Returns the changed state of the value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INTEGER

public static final int INTEGER
Types

See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

BOOLEAN

public static final int BOOLEAN
See Also:
Constant Field Values

STRING

public static final int STRING
See Also:
Constant Field Values

NODEATTRIBUTE

public static final int NODEATTRIBUTE
See Also:
Constant Field Values

EDGEATTRIBUTE

public static final int EDGEATTRIBUTE
See Also:
Constant Field Values

LIST

public static final int LIST
See Also:
Constant Field Values

GROUP

public static final int GROUP
See Also:
Constant Field Values

NOINPUT

public static final int NOINPUT
Flags

See Also:
Constant Field Values

NUMERICATTRIBUTE

public static final int NUMERICATTRIBUTE
For attributes, indicate that the list should be restricted to integer or float attributes.

See Also:
Constant Field Values

MULTISELECT

public static final int MULTISELECT
For LIST, NODEATTRIBUTE, or EDGEATTRIBUTE types, use a list widget that supports multiselect rather than a combo box.

See Also:
Constant Field Values
Constructor Detail

Tunable

public Tunable(String name,
               String desc,
               int type,
               Object value)
Constructor to create a Tunable with no bounds information, and no flag.

Parameters:
name - The name of the Tunable
desc - The description of the Tunable
type - Integer value that represents the type of the Tunable. The type not only impact the way that the value is interpreted, but also the component used for the LayoutSettingsDialog
value - The initial (default) value of the Tunable

Tunable

public Tunable(String name,
               String desc,
               int type,
               Object value,
               int flag)
Constructor to create a Tunable with no bounds information, but with a flag.

Parameters:
name - The name of the Tunable
desc - The description of the Tunable
type - Integer value that represents the type of the Tunable. The type not only impact the way that the value is interpreted, but also the component used for the LayoutSettingsDialog
value - The initial (default) value of the Tunable
flag - The initial value of the flag. This can be used to indicate that this tunable is not user changeable (e.g. debug), or to indicate if there is a specific type for the attributes.

Tunable

public Tunable(String name,
               String desc,
               int type,
               Object value,
               Object lowerBound,
               Object upperBound,
               int flag)
Constructor to create a Tunable with bounds information as well as a flag.

Parameters:
name - The name of the Tunable
desc - The description of the Tunable
type - Integer value that represents the type of the Tunable. The type not only impact the way that the value is interpreted, but also the component used for the LayoutSettingsDialog
value - The initial (default) value of the Tunable. This is a String in the case of an EDGEATTRIBUTE or NODEATTRIBUTE tunable, it is an Integer index a LIST tunable.
lowerBound - An Object that either represents the lower bounds of a numeric Tunable or an array of values for an attribute (or other type of) list.
upperBound - An Object that represents the upper bounds of a numeric Tunable.
flag - The initial value of the flag. This can be used to indicate that this tunable is not user changeable (e.g. debug), or to indicate if there is a specific type for the attributes.

Tunable

public Tunable(String name,
               String desc,
               int type,
               Object value,
               Object lowerBound,
               Object upperBound,
               int flag,
               boolean immutable)
Method Detail

setFlag

public void setFlag(int flag)
This method can be used to set a flag for this Tunable

Parameters:
flag - integer value the contains the flag to set.

clearFlag

public void clearFlag(int flag)
This method can be used to clear a flag for this Tunable

Parameters:
flag - integer value the contains the flag to be cleared.

setValue

public void setValue(Object value)
This method is used to set the value for this Tunable. If this is an INTEGER, DOUBLE, or BOOLEAN Tunable, then value is assumed to be a String. This also sets the "changed" state of the value to "true".

Parameters:
value - Object (usually String) containing the value to be set

getValue

public Object getValue()
This method returns the current value. This method also resets the state of the value to indicate that it has not been changed since the last "get".

Returns:
Object that contains the value for this Tunable

valueChanged

public boolean valueChanged()
Returns the changed state of the value. If true, the value has been changed since it was last retrieved.

Returns:
boolean value of the changed state.

setLowerBound

public void setLowerBound(Object lowerBound)
Method to set the lowerBound for this Tunable. This might be used to change a Tunable based on changes in the plugin environment.

Parameters:
lowerBound - the new lowerBound for the tunable

getLowerBound

public Object getLowerBound()
Method to get the lowerBound for this Tunable.

Returns:
the lowerBound the tunable

setUpperBound

public void setUpperBound(Object upperBound)
Method to set the upperBound for this Tunable. This might be used to change a Tunable based on changes in the plugin environment.

Parameters:
upperBound - the new upperBound for the tunable

getUpperBound

public Object getUpperBound()
Method to get the upperBound for this Tunable.

Returns:
the upperBound the tunable

toString

public String toString()
Method to return a string representation of this Tunable, which is essentially its name.

Overrides:
toString in class Object
Returns:
String value of the name of the Tunable.

getName

public String getName()
Method to return a string representation of this Tunable, which is essentially its name.

Returns:
String value of the name of the Tunable.

getType

public int getType()
Method to return the type of this Tunable.

Returns:
Tunable type

getDescription

public String getDescription()
Method to return the description for this Tunable.

Returns:
Tunable description

getPanel

public JPanel getPanel()
This method returns a JPanel suitable for inclusion in the LayoutSettingsDialog to represent this Tunable. Note that while the type of the widgets used to represent the Tunable are customized to represent the type, no ActionListeners are included. The dialog must call updateSettings to set the value of the Tunable from the user input data.

Returns:
JPanel that can be used to enter values for this Tunable

updateValue

public void updateValue()
This method is called to extract the user-entered data from the JPanel and store it as our value.


www.cytoscape.org