com.sas.servlet.tbeans.form
Class BaseRadio

com.sas.servlet.tbeans.form.BaseRadio
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, FormElementModificationEventInterface, com.sas.servlet.tbeans.form.JavaScriptObjectCreationInterface, com.sas.servlet.tbeans.JavaScriptEventHandlerInterface, RenderableInterface, TransformationInterface, GenericValidatorInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable, javax.swing.SwingConstants
Direct Known Subclasses:
Radio

public abstract class BaseRadio
implements javax.swing.SwingConstants

The BaseRadio is an abstract TransformationBean™ for creating a Radio input field, which is used for attributes which can take a single value from a set of alternatives.

The Radio TransformationBean™ gathers the alternatives from a model via the setModel method. A model must implement the javax.swing.ListModel interface in order to be used.

Note that subclasses of this bean actually provide the markup rendering used in/with Servlet and JavaServer Pages technologies. If you need to add support for a markup language that is not explicitly provided with AppDev Studio, then you must extend this class.

For More Information:

JSP custom tags provide an alternative to using the TransformationBeans™. Visit the Custom Tag Library Reference for additional information on the sas:Radio custom tag.

Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .

See Also:
Serialized Form

Field Summary
protected  javax.swing.ListModel model
          The model for the Radio.
static java.lang.String RB_KEY
          Key used to lookup resources in the resource bundle.
 
Constructor Summary
BaseRadio()
          Construct a new Radio
 
Method Summary
 boolean getHorizontalAlignment()
          Returns the value of horizontal alignment.
 int getLabelOrientation()
          Returns the current setting for where to display the radio element's text.
 javax.swing.ListModel getModel()
          Return the model for the Radio.
 int getSelectedIndex()
          Gets the index value of a single item to be marked as selected
 java.lang.String getSelectedItem()
          Gets the value of a single item to be marked as selected
 boolean isBreak()
          Gets the flag indicating whether to force a break after each input field.
 boolean isLabelBolding()
          Returns whether the to bold the label when the checkbox is selected: TRUE bold label
 boolean isLabelVisible()
          Returns labelVisible value
protected  boolean isSelected(int index)
          Determines if the given index should be marked as selected
protected  boolean isSelected(java.lang.String value)
          Determines if the given value should be marked as selected
 boolean isValidateSelection()
          Returns whether or not exceptions are thrown for setSelectedIndex() and setSelectedItem().
 void setBreak(boolean value)
          Forces a break after each input field.
 void setHorizontalAlignment(boolean value)
          Sets the alignment of the radio buttons horizontally instead of vertically.
 void setLabelBolding(boolean value)
          Sets whether the to bold the label when the checkbox is selected: TRUE bold label Default value is FALSE.
 void setLabelOrientation(int orientation)
          Sets the position for where to display the radio element's text.
 void setLabelVisible(boolean value)
          Sets the labelVisible to true if text is to be displayed with the Radio buttons
 void setModel(javax.swing.ListModel listModel)
          Sets the model for the Radio.
 void setSelectedIndex(int value)
          Sets the index of a single item to be marked as selected.
 void setSelectedItem(java.lang.String value)
          Sets the value of a single item to be marked as selected.
 void setSelectedItem(java.lang.String value, int defaultIndex)
          Sets the value of a single item to be marked as selected.
 void setValidateSelection(boolean value)
          Determines whether or not exceptions are thrown for setSelectedIndex() and setSelectedItem().
 
Methods inherited from class com.sas.servlet.tbeans.form.BaseFormElement
getAccessKey, getErrorHandler, getModificationEventName, getName, getOnBlur, getOnChange, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getStyleInfo, getTabIndex, getTitle, getValidationFunctions, getValidator, isEnabled, isValid, isValidationEnabled, setAccessKey, setEnabled, setErrorHandler, setId, setModificationEventName, setName, setOnBlur, setOnChange, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setStyleInfo, setTabIndex, setTitle, setValidator, write, writeJavaScriptObject, writeJavaScriptObjectValidate, writeJavaScriptValidatorObject, writeValidationScript
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCleanUpResourcesOn, setCustomAttributes, setDescription, setInputTransform, setLocale, setLocaleDependentProperties, setObjectData, setObjectDataProperty, setOutputTransform, setRequest, setResponse, setTagEpilog, setTagProlog, setVisible, toString, write, write, write
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
Key used to lookup resources in the resource bundle.

See Also:
Constant Field Values

model

protected javax.swing.ListModel model
The model for the Radio.

Constructor Detail

BaseRadio

public BaseRadio()
Construct a new Radio

Method Detail

getModel

public javax.swing.ListModel getModel()
Return the model for the Radio.

Returns:
the model for the Radio
See Also:
setModel(javax.swing.ListModel)

setModel

public void setModel(javax.swing.ListModel listModel)
Sets the model for the Radio.

Parameters:
listModel - the model for the Radio
See Also:
getModel()

getLabelOrientation

public int getLabelOrientation()
Returns the current setting for where to display the radio element's text. Valid values are TOP, BOTTOM, LEFT, and RIGHT. If not set, the default is TOP when the radio orientation is HORIZONTAL, RIGHT otherwise.

Returns:
the orientation of the radio text

setLabelOrientation

public void setLabelOrientation(int orientation)
Sets the position for where to display the radio element's text. Valid values TOP, BOTTOM, LEFT, and RIGHT. If not set, the default is TOP when the radio orientation is HORIZONTAL, RIGHT otherwise.

Parameters:
orientation - the orientation of the radio text
Throws:
java.lang.IllegalArgumentException - if orientation is invalid

setSelectedIndex

public void setSelectedIndex(int value)
                      throws java.io.IOException
Sets the index of a single item to be marked as selected. Setting the index will also update the corresponding selectedItem. By default the exception will not be thrown. To surface the exception, the setValidateSelection() method must be called passing the value of True.

Parameters:
index - The 0-based index of the item to be selected, or -1 for none
Throws:
java.lang.IllegalArgumentException - Thrown if index is out of bounds and setValidateSelection(true)
java.io.IOException
See Also:
setValidateSelection(boolean)

setSelectedItem

public void setSelectedItem(java.lang.String value)
                     throws java.io.IOException
Sets the value of a single item to be marked as selected. Setting the selectedItem will also update the corresponding selectedIndex. Valid selectedItems correspond to the items in the model attribute. By default the exception will not be thrown. To surface the exception, the setValidateSelection() method must be called passing the value of True.

Parameters:
value - The value of the item to be selected
Throws:
java.lang.IllegalArgumentException - Thrown if item is not found and setValidateSelection(true)
java.io.IOException
See Also:
setValidateSelection(boolean)

setSelectedItem

public void setSelectedItem(java.lang.String value,
                            int defaultIndex)
Sets the value of a single item to be marked as selected. Setting the value will set the corresponding selectedIndex. Valid selectedItems correspond to the items in the model attribute. If the selectedItem does not exist, the defaultIndex will be used to set the selectedItem. If the defaultIndex does not exist, the selection will remain the same.

Parameters:
value - The value of the item to be selected
index - The 0-based index of the item to be selected, or -1 to remain the same, if selectedItem does not exist

getSelectedIndex

public int getSelectedIndex()
Gets the index value of a single item to be marked as selected

Returns:
The of 0-based index of the item to be selected, or -1 for none

getSelectedItem

public java.lang.String getSelectedItem()
Gets the value of a single item to be marked as selected

Returns:
The value of the item to be selected, or null for none

isSelected

protected boolean isSelected(int index)
Determines if the given index should be marked as selected

Parameters:
index - The index to check
Returns:
true if the index should be marked as selected

isSelected

protected boolean isSelected(java.lang.String value)
Determines if the given value should be marked as selected

Parameters:
index - The value to check
Returns:
true if the value should be marked as selected

setBreak

public void setBreak(boolean value)
Forces a break after each input field. Default is true

Parameters:
break - Set to true to force a line break after each input field

isBreak

public boolean isBreak()
Gets the flag indicating whether to force a break after each input field.

Returns:
True to force a line break after each input field

setLabelVisible

public void setLabelVisible(boolean value)
Sets the labelVisible to true if text is to be displayed with the Radio buttons

Parameters:
value - Determines whether button text is displayed

isLabelVisible

public boolean isLabelVisible()
Returns labelVisible value

Returns:
Whether or not text is displayed

setHorizontalAlignment

public void setHorizontalAlignment(boolean value)
Sets the alignment of the radio buttons horizontally instead of vertically.

Parameters:
value - The horizontal alignment value

getHorizontalAlignment

public boolean getHorizontalAlignment()
Returns the value of horizontal alignment. This determines if text should be displayed horizontally with text above.

Returns:
The horizontal alignment

setValidateSelection

public void setValidateSelection(boolean value)
Determines whether or not exceptions are thrown for setSelectedIndex() and setSelectedItem(). An exception is thrown if item is not in the model. The default is false.

Parameters:
value - true if exceptions should be thrown for setSelectedIndex() and setSelectedItem()
See Also:
setSelectedIndex(int), setSelectedItem(java.lang.String)

isValidateSelection

public boolean isValidateSelection()
Returns whether or not exceptions are thrown for setSelectedIndex() and setSelectedItem().

Returns:
true if exceptions should be thrown for setSelectedIndex() and setSelectedItem()

setLabelBolding

public void setLabelBolding(boolean value)
Sets whether the to bold the label when the checkbox is selected: TRUE bold label Default value is FALSE.

Parameters:
value - true to bold the label when the checkbox is selected

isLabelBolding

public boolean isLabelBolding()
Returns whether the to bold the label when the checkbox is selected: TRUE bold label

Returns:
true if label is bolded when the checkbox is selected



Copyright © 2009 SAS Institute Inc. All Rights Reserved.