org.fopps.model
Class Alternative

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

public class Alternative
extends ConfigurationItem

Represents an alternative "choose one out of many" configuration entry.


Field Summary
static java.lang.String INVALID
           
 
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
Alternative(java.lang.String name, ConfigurationItem pParent, Feature pFeature)
          Constructor for Alternative.
Alternative(java.lang.String name, ConfigurationItem pParent, java.lang.Object pDefaultValue, Feature pFeature)
          Constructor for Alternative.
Alternative(java.lang.String pName, Feature pFeature)
           
 
Method Summary
 boolean decValue()
          Decreases current value (Convenience method)
 java.util.Collection getChildren()
          Getter Association Children.
 java.util.Collection getChildrenForConfiguration()
          Returns the needed children for configuration purposes
 java.util.Collection getConstraints()
          Returns a list containing all (outgoing) constraints.
 java.util.Collection getIncomingConstraints()
           
 java.util.Collection getOutgoingConstraints()
           
 java.lang.Object getValue()
          Returns the current value
 int getValueIndex()
          Returns the index of the current value
 boolean incValue()
          Increases current value (Convenience method)
 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()
          Builds the alternative values and the possible childs
 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, getDefaultValue, getDescription, getFeature, getOrigin, getSymbolicVar, isLocked, setDefaultValue, setIsLocked
 
Methods inherited from class org.fopps.model.TreeItem
addChildren, allChildrenCount, childrenAllowed, childrenCount, delete, first, getChildAt, 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, getIncoming, getListeners, getName, getOutgoing, 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
 

Field Detail

INVALID

public static final java.lang.String INVALID
See Also:
Constant Field Values
Constructor Detail

Alternative

public Alternative(java.lang.String pName,
                   Feature pFeature)

Alternative

public Alternative(java.lang.String name,
                   ConfigurationItem pParent,
                   Feature pFeature)
Constructor for Alternative.

Parameters:
name -

Alternative

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

Parameters:
name -
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()

setValue

public boolean setValue(java.lang.Object pValue)
Set a value by an object value. Alternative accepts only strings. A string must match one of the alternatives (case insensitive)

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

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 - Index to select
Returns:
true, if value was changed
See Also:
ConfigurationItem.setValue(int)

restoreDefault

public void restoreDefault()
Restores default value. If no value is given, the alternative is set to the first entry of the possible alternatives.

Specified by:
restoreDefault in class ConfigurationItem

decValue

public boolean decValue()
Decreases current value (Convenience method)


incValue

public boolean incValue()
Increases current value (Convenience method)


getValueIndex

public int getValueIndex()
Returns the index of the current value


isSet

public boolean isSet()
Returns true, if configuration item is set. Alternatives are set, if all parent options set.

Overrides:
isSet in class ConfigurationItem

toString

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

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

getChildrenForConfiguration

public java.util.Collection getChildrenForConfiguration()
Returns the needed children for configuration purposes

Overrides:
getChildrenForConfiguration in class ConfigurationItem

getChildren

public java.util.Collection getChildren()
Getter Association Children.

Overrides:
getChildren in class TreeItem
Returns:
Children of this feature. If no children present, an empty list is returned

getIncomingConstraints

public java.util.Collection getIncomingConstraints()
Overrides:
getIncomingConstraints in class AbstractItem

getOutgoingConstraints

public java.util.Collection getOutgoingConstraints()
Overrides:
getOutgoingConstraints in class AbstractItem

getConstraints

public java.util.Collection getConstraints()
Description copied from class: AbstractItem
Returns a list containing all (outgoing) constraints.

Overrides:
getConstraints in class AbstractItem

setupInitialConfiguration

public void setupInitialConfiguration()
Builds the alternative values and the possible childs

Overrides:
setupInitialConfiguration in class ConfigurationItem


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