ptolemy.actor.gt.ingredients.criteria
Class ChoiceCriterionElement

java.lang.Object
  extended by ptolemy.actor.gt.GTIngredientElement
      extended by ptolemy.actor.gt.ingredients.criteria.CriterionElement
          extended by ptolemy.actor.gt.ingredients.criteria.StringCriterionElement
              extended by ptolemy.actor.gt.ingredients.criteria.ChoiceCriterionElement

public class ChoiceCriterionElement
extends StringCriterionElement

A choice element for a criterion.

Since:
Ptolemy II 8.0
Version:
$Id: ChoiceCriterionElement.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Thomas Huining Feng
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Field Summary
private  java.util.List<java.lang.Object> _choices
          The list of choices.
private  boolean _editable
          Whether a new value can be input in the edit box.
 
Constructor Summary
ChoiceCriterionElement(java.lang.String name, boolean canDisable)
          Construct a choice element for a criterion.
ChoiceCriterionElement(java.lang.String name, boolean canDisable, boolean acceptRegularExpression, boolean acceptPtolemyExpression, boolean editable)
          Construct a choice element for a criterion.
 
Method Summary
 void addChoice(java.lang.Object choice)
          Add a choice to the end of choices.
 void addChoices(java.util.Collection<?> choices)
          Add choices to the end of choices.
 java.util.List<java.lang.Object> getChoices()
          Get an unmodifiable list of all the choices.
 boolean isEditable()
          Return whether a new value can be input in the edit box.
 void removeChoice(java.lang.Object choice)
          Remove a choice from the list of choices.
 void removeChoices(java.util.Collection<?> choices)
          Remove choices from the list of choices.
 
Methods inherited from class ptolemy.actor.gt.ingredients.criteria.StringCriterionElement
acceptPtolemyExpression, acceptRegularExpression
 
Methods inherited from class ptolemy.actor.gt.GTIngredientElement
canDisable, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_choices

private java.util.List<java.lang.Object> _choices
The list of choices.


_editable

private boolean _editable
Whether a new value can be input in the edit box.

Constructor Detail

ChoiceCriterionElement

public ChoiceCriterionElement(java.lang.String name,
                              boolean canDisable)
Construct a choice element for a criterion.

Parameters:
name - The name of the element.
canDisable - Whether the element can be disabled.

ChoiceCriterionElement

public ChoiceCriterionElement(java.lang.String name,
                              boolean canDisable,
                              boolean acceptRegularExpression,
                              boolean acceptPtolemyExpression,
                              boolean editable)
Construct a choice element for a criterion.

Parameters:
name - The name of the element.
canDisable - Whether the element can be disabled.
acceptRegularExpression - Whether regular expression is accepted.
acceptPtolemyExpression - Whether Ptolemy expression is accepted.
editable - Whether a new value can be input in the edit box.
Method Detail

addChoice

public void addChoice(java.lang.Object choice)
Add a choice to the end of choices.

Parameters:
choice - The new choice.

addChoices

public void addChoices(java.util.Collection<?> choices)
Add choices to the end of choices.

Parameters:
choices - The new choices.

getChoices

public java.util.List<java.lang.Object> getChoices()
Get an unmodifiable list of all the choices.

Returns:
The list.

isEditable

public boolean isEditable()
Return whether a new value can be input in the edit box.

Returns:
true if a new value can be input in the edit box.

removeChoice

public void removeChoice(java.lang.Object choice)
Remove a choice from the list of choices.

Parameters:
choice - The choice to be removed.

removeChoices

public void removeChoices(java.util.Collection<?> choices)
Remove choices from the list of choices.

Parameters:
choices - The choices to be removed.