Class Config


  extended by Object
      extended by Config

public class Config
extends Object

This class represents set of parameters for Widget. Containing information about parameter-prototypes defined in widget.xml <parameters> node.


Method Summary
 void commit()
          Saves the changes made to this config.
 Value export()
          Export the configuration as Value structure.
 Value getChoices(int index)
          Returns the list of choices available for option at specified index.
 String getDescription(int index)
          Returns the description of option at specified index.
 String getName(int index)
          Returns the name of option at specified index.
 String getType(int index)
          Returns the type of option at specified index.
 Value getValue(int index)
          Returns the value of option at specified index.
 Value getValue(String name)
          Returns the value of specified option.
 boolean isEditable(int index)
          Checks if option at specified index is editable.
 boolean isVisible()
          Checks if this config is visible.
 boolean isVisible(int index)
          Checks if option at specified index is visible.
 String parse(String value)
          Parses embedded expressions.
 void setValue(int index, Value value)
          Sets the value of option at specified index.
 int size()
          Returns the number of options.
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isVisible

public boolean isVisible()
Checks if this config is visible. Being visible means that it has at least one visible parameter.


size

public int size()
Returns the number of options.


isEditable

public boolean isEditable(int index)
Checks if option at specified index is editable.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
true if it is editable, false otherwise.

isVisible

public boolean isVisible(int index)
Checks if option at specified index is visible. Only visible options are shown in settings dialogs. Invisible options can still be accessed from script, and they can be changed if they are editable.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
true if it is visible, false otherwise.

getName

public String getName(int index)
Returns the name of option at specified index.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
Name of option.

getDescription

public String getDescription(int index)
Returns the description of option at specified index. Description is intended to be displayed on user interface instead of name.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
Description of option.

getType

public String getType(int index)
Returns the type of option at specified index. Possible types include:

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
Type of option.

getChoices

public Value getChoices(int index)
Returns the list of choices available for option at specified index.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
Value list containing optionValue=>optionDescription bindings.

getValue

public Value getValue(String name)
Returns the value of specified option. Returned valued has been parsed and it will not contain ${..} expressions.

Parameters:
name - Name of option
Returns:
Value of option, or null if it doesn't exist.

getValue

public Value getValue(int index)
Returns the value of option at specified index. Returned valued has been parsed and it will not contain ${..} expressions.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
Returns:
Value of option.

setValue

public void setValue(int index,
                     Value value)
Sets the value of option at specified index. Value must be on raw (unparsed) format.

Parameters:
index - Index of option, must be on range 0 .. size()-1.
value - New option value,

parse

public String parse(String value)
Parses embedded expressions.

Parameters:
value - Value to parse
Returns:
Parsed value

commit

public void commit()
Saves the changes made to this config. In case of widget config, the changed parameters are sent to server.


export

public Value export()
Export the configuration as Value structure.