org.fopps.model
Class Option

java.lang.Object
  |
  +--org.fopps.model.AbstractItem
        |
        +--org.fopps.model.TreeItem
              |
              +--org.fopps.model.ConfigurationItem
                    |
                    +--org.fopps.model.Option

public class Option
extends ConfigurationItem

Represents an option. An option may be - as the name suggests - set or not set. If an option changes to 'not set', all child options will be disabled.

If no explicit default value is given, the option is set to false.


Field Summary
 
Fields inherited from class org.fopps.model.TreeItem
mChildren, mParent
 
Fields inherited from class org.fopps.model.AbstractItem
ADDED_EVENT, CHANGE_EVENT, name, REMOVED_EVENT
 
Constructor Summary
Option(java.lang.String pName, ConfigurationItem pParent, Feature pFeature)
          Constructor for Option with given parent and false as default value
Option(java.lang.String pName, ConfigurationItem pParent, java.lang.Object pDefaultValue, Feature pFeature)
          Constructor for Option.
Option(java.lang.String pName, Feature pFeature)
          Constructor for Option with no parent and false as default value
 
Method Summary
 java.lang.Object getValue()
          Returns the current value
 boolean isSelected()
          Returns the value.
 boolean isSet()
          Returns true, if configuration item is set.
 java.lang.Object[] possibleValues()
          Returns all possible values of this item
 void restoreDefault()
          Restores default value.
 void setupInitialConfiguration()
          Setup initial configuration settings.
 boolean setValue(int pIndex)
          Set a value by given index
 boolean setValue(java.lang.Object pValue)
          Set a value by an object value.
 boolean switchToNextValue()
          Switches to next possible value
 boolean switchToPrevValue()
          Switches to next possible value
 java.lang.String toString()
           
 
Methods inherited from class org.fopps.model.ConfigurationItem
addAttachmentsFromFeature, fireItemChanged, getAttachments, getBinding, getChildrenForConfiguration, getDefaultValue, getDescription, getFeature, getOrigin, getSymbolicVar, isLocked, setDefaultValue, setIsLocked
 
Methods inherited from class org.fopps.model.TreeItem
addChildren, allChildrenCount, childrenAllowed, childrenCount, delete, first, getChildAt, getChildren, getDepth, getIndexOfChild, getParent, getPath, getRoot, isLeaf, last, notifyListeners, removeAllChildren, removeAllChildrenRecursive, removeChildren, setChildren, setParent
 
Methods inherited from class org.fopps.model.AbstractItem
addIncoming, addListener, addOutgoing, commitGhostRelations, containsType, copyAttributes, filterElements, fireItemAdded, fireItemRemoved, getConstraints, getIncoming, getIncomingConstraints, getListeners, getName, getOutgoing, getOutgoingConstraints, getRelationTo, hasConstraints, isBlockEvents, isConnectedWith, removeAllConstraints, removeAllIncoming, removeAllListener, removeAllOutgoing, removeAllRelations, removeGhostRelations, removeIncoming, removeListener, removeOutgoing, removeRelationTo, setBlockEvents, setDescription, setIncoming, setName, setOutgoing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Option

public Option(java.lang.String pName,
              Feature pFeature)
Constructor for Option with no parent and false as default value


Option

public Option(java.lang.String pName,
              ConfigurationItem pParent,
              Feature pFeature)
Constructor for Option with given parent and false as default value


Option

public Option(java.lang.String pName,
              ConfigurationItem pParent,
              java.lang.Object pDefaultValue,
              Feature pFeature)
Constructor for Option.

Method Detail

switchToNextValue

public boolean switchToNextValue()
Description copied from class: ConfigurationItem
Switches to next possible value

Specified by:
switchToNextValue in class ConfigurationItem
Returns:
true, if value was changed
See Also:
ConfigurationItem.switchToNextValue()

switchToPrevValue

public boolean switchToPrevValue()
Description copied from class: ConfigurationItem
Switches to next possible value

Specified by:
switchToPrevValue in class ConfigurationItem
Returns:
true, if value was changed
See Also:
ConfigurationItem.switchToPrevValue()

isSet

public boolean isSet()
Returns true, if configuration item is set. An option is set, if the option itself and it's parent options (if present) are true.

Overrides:
isSet in class ConfigurationItem

setValue

public boolean setValue(int pIndex)
Description copied from class: ConfigurationItem
Set a value by given index

Specified by:
setValue in class ConfigurationItem
Parameters:
pIndex - If 0, the value is set to 'false', otherwise to true
Returns:
true, if value was changed
See Also:
ConfigurationItem.setValue(int)

restoreDefault

public void restoreDefault()
Restores default value. If no value is given, the option is set to false

Specified by:
restoreDefault in class ConfigurationItem

setValue

public boolean setValue(java.lang.Object pValue)
Set a value by an object value. Option accepts 'True' (case insensitive) or '1' as valid strings to activate this option. Instances of Boolean are also accepted.

Specified by:
setValue in class ConfigurationItem
Parameters:
pValue - New value
Returns:
true, if value was changed

toString

public java.lang.String toString()
Overrides:
toString in class ConfigurationItem
See Also:
Object.toString()

isSelected

public boolean isSelected()
Returns the value.

Returns:
true, if item is selected

possibleValues

public java.lang.Object[] possibleValues()
Description copied from class: ConfigurationItem
Returns all possible values of this item

Specified by:
possibleValues in class ConfigurationItem
See Also:
ConfigurationItem.possibleValues()

getValue

public java.lang.Object getValue()
Returns the current value

Specified by:
getValue in class ConfigurationItem

setupInitialConfiguration

public void setupInitialConfiguration()
Setup initial configuration settings. Should be called after the configuration tree is complete

Overrides:
setupInitialConfiguration in class ConfigurationItem


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.