com.mindtree.techworks.insight.preferences.model
Class ListPreferenceAttribute

java.lang.Object
  extended by com.mindtree.techworks.insight.preferences.model.PreferenceAttribute
      extended by com.mindtree.techworks.insight.preferences.model.ListPreferenceAttribute
All Implemented Interfaces:
java.io.Serializable

public class ListPreferenceAttribute
extends PreferenceAttribute

This is a specialization of PreferenceAttribute, where all the possible values are added as a list.

Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik
See Also:
PreferenceAttribute, Serialized Form

Constructor Summary
ListPreferenceAttribute(java.lang.String id, java.lang.String value, boolean isEncrypted, boolean isPersistant, boolean isUserModifiable, Preference parent)
           
ListPreferenceAttribute(java.lang.String id, java.lang.String value, boolean isEncrypted, boolean isPersistant, boolean isUserModifiable, Preference parent, java.util.List inOptions)
           
 
Method Summary
 void addOption(java.lang.String option)
          Adds an option to the list.
 java.lang.String getOption(int location)
          Returns the option from the list at the required position.
 int getOptionsCount()
          Returns the number of options.
 java.util.Iterator iterateOptions()
          Returns an iterator for the options.
 void setValue(java.lang.String value)
          Checks to see if the value is permitted before setting it.
 
Methods inherited from class com.mindtree.techworks.insight.preferences.model.PreferenceAttribute
getDefaultValue, getId, getName, getParent, getType, getValue, isEncrypted, isPersistant, isUserModifiable, setDefaultValue, setEncrypted, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListPreferenceAttribute

public ListPreferenceAttribute(java.lang.String id,
                               java.lang.String value,
                               boolean isEncrypted,
                               boolean isPersistant,
                               boolean isUserModifiable,
                               Preference parent)
Parameters:
id - The id of the preference attribute
value - The value associated with the preference attribute
isPersistant - Whether the value will be saved to the store
isUserModifiable - Is the preference modifiable
parent - The parent Preference of this attribute
See Also:
PreferenceAttribtue

ListPreferenceAttribute

public ListPreferenceAttribute(java.lang.String id,
                               java.lang.String value,
                               boolean isEncrypted,
                               boolean isPersistant,
                               boolean isUserModifiable,
                               Preference parent,
                               java.util.List inOptions)
Parameters:
id - The id of the preference attribute
value - The value associated with the preference attribute
isPersistant - Whether the value will be saved to the store
isUserModifiable - Is the preference modifiable
parent - The parent Preference of this attribute
inOptions - The list of options
Method Detail

addOption

public void addOption(java.lang.String option)
Adds an option to the list.

Parameters:
option - Option to add to the list.

getOptionsCount

public int getOptionsCount()
Returns the number of options.

Returns:
Number of options present

getOption

public java.lang.String getOption(int location)
Returns the option from the list at the required position.

Parameters:
location - Location
Returns:
The option at the location
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the location is not present in the list

iterateOptions

public java.util.Iterator iterateOptions()
Returns an iterator for the options.

Returns:
Iterator for the options.

setValue

public void setValue(java.lang.String value)
Checks to see if the value is permitted before setting it.

Overrides:
setValue in class PreferenceAttribute
Parameters:
value - The value to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the value is not in the options
See Also:
PreferenceAttribute.setValue(java.lang.String)


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.