com.arsdigita.bebop.form
Class OptionGroup

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.form.Widget
                      extended bycom.arsdigita.bebop.form.OptionGroup
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Lockable
Direct Known Subclasses:
CheckboxGroup, RadioGroup, Select

public abstract class OptionGroup
extends Widget
implements BebopConstants

A class representing any widget that contains a list options.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/form/OptionGroup.java#8 $
Author:
Karl Goldstein, Uday Mathur, Rory Solomon, Michael Pih

Nested Class Summary
 
Nested classes inherited from class com.arsdigita.bebop.form.Widget
Widget.ValidationGuard
 
Field Summary
protected  String m_xmlElement
          The XML element to be used by individual options belonging to this group.
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
protected OptionGroup(ParameterModel model)
          The ParameterModel for mutliple OptionGroups is always an array parameter
 
Method Summary
 void addOption(Option opt)
          Adds a new option.
 void addOption(Option opt, PageState ps)
          Adds a new option for the scope of the current request, or to the page as a whole if there is no current request.
 void clearOptions()
           
 Object clone()
          Clones a component.
 Iterator getOptions()
          Returns an Iterator of all the default Options in this group.
 Iterator getOptions(PageState ps)
          Returns an Iterator of all the default Options in this group, plus any request-specific options.
 boolean isCompound()
          Returns true if the widget consists of multiple HTML elements.
 boolean isMultiple()
          Is this a multiple (and not single) selection option group? Note that this should really be declared abstract, but we can't because it used to be in the direct subclass Select and making it abstract could break other subclasses that don't declare isMultiple.
 void removeOption(Option opt)
           
 void removeOption(Option opt, PageState ps)
           
 void removeOption(String key)
           
 void removeOption(String key, PageState ps)
          Removes the first option whose key is equal to the key that is passed in.
 void setOptionSelected(Option option)
          make an option selected by default
 void setOptionSelected(String value)
          Make an option selected by default.
 
Methods inherited from class com.arsdigita.bebop.form.Widget
addError, addError, addPrintListener, addValidationListener, createParameterListener, firePrintEvent, fireValidation, generateErrors, generateWidget, generateXML, getDefaultValue, getElementTag, getErrors, getForm, getName, getParameterData, getParameterModel, getType, getValue, isPassIn, register, removePrintListener, removeValidationListener, respond, setDefaultValue, setDisabled, setForm, setHint, setOnBlur, setOnChange, setOnFocus, setOnKeyUp, setOnSelect, setParameterModel, setPassIn, setPrintListener, setReadOnly, setValidateInvisible, setValidationGuard, setValue, toString, validateInvisible
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
children, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

m_xmlElement

protected String m_xmlElement
The XML element to be used by individual options belonging to this group. This variable has to be initialized by every subclass of OptionGroup. LEGACY: An abstract method would be the better design, but changing it would break the API.

Constructor Detail

OptionGroup

protected OptionGroup(ParameterModel model)
The ParameterModel for mutliple OptionGroups is always an array parameter

Method Detail

isCompound

public final boolean isCompound()
Description copied from class: Widget
Returns true if the widget consists of multiple HTML elements.

Specified by:
isCompound in class Widget

getOptions

public Iterator getOptions()
Returns an Iterator of all the default Options in this group.


getOptions

public Iterator getOptions(PageState ps)
Returns an Iterator of all the default Options in this group, plus any request-specific options.


clearOptions

public void clearOptions()

addOption

public void addOption(Option opt)
Adds a new option.

Parameters:
opt - The Option to be added. Note: the argument is modified and associated with this OptionGroup, regardless of what its group was.

removeOption

public void removeOption(Option opt)

addOption

public void addOption(Option opt,
                      PageState ps)
Adds a new option for the scope of the current request, or to the page as a whole if there is no current request.

Parameters:
opt - The Option to be added. Note: the argument is modified and associated with this OptionGroup, regardless of what its group was.
ps - the current page state. if ps is null, adds option to the default option list.

removeOption

public void removeOption(Option opt,
                         PageState ps)

removeOption

public void removeOption(String key)

removeOption

public void removeOption(String key,
                         PageState ps)
Removes the first option whose key is equal to the key that is passed in.


setOptionSelected

public void setOptionSelected(String value)
Make an option selected by default. Updates the parameter model for the option group accordingly.

Parameters:
value - the value of the option to be added to the by-default-selected set.

setOptionSelected

public void setOptionSelected(Option option)
make an option selected by default

Parameters:
option - the option to be added to the by-default-selected set.

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: SimpleComponent
Clones a component. The clone is not locked and has its own set of attributes.

Overrides:
clone in class Widget
Throws:
CloneNotSupportedException

isMultiple

public boolean isMultiple()
Is this a multiple (and not single) selection option group? Note that this should really be declared abstract, but we can't because it used to be in the direct subclass Select and making it abstract could break other subclasses that don't declare isMultiple. So we have a trivial implementation instead.

Returns:
true if this OptionGroup can have more than one selected option; false otherwise.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC