com.sas.servlet.beans
Class BaseListbox

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.servlet.beans.BaseTransformation
              |
              +--com.sas.servlet.beans.BaseListbox
Direct Known Subclasses:
Listbox, Listbox

public abstract class BaseListbox
extends BaseTransformation
implements ListboxInterface

Transformation bean definition for creating a Listbox input field. A Listbox is a menu that allows either a single selection or multiple selections.

The Listbox Transformation Bean gathers the selections from a model via the setModelInterface method. A model must implement the com.sas.collection.StaticOrderedCollection interface in order to be used.

See Also:
Serialized Form

Constructor Summary
BaseListbox()
           
 
Method Summary
 StaticOrderedCollectionInterface getDescriptionModel()
          Gets the model to be used for the decriptions of the listbox entry.
 boolean getMultipleSelections()
          Gets the multiple selection attribute
 Vector getRequiredInterfaces()
          Gets the required interface that a model must implement in order to attach to this bean Models must implement com.sas.collection.StaticOrderedCollectionInterface in order to be used by this transformation bean
 int getSelectedIndex()
          Gets the index of single item to be marked as selected.
 int[] getSelectedIndexes()
          Gets the array of index values of items to be marked as selected.
 String getSelectedItem()
          Gets the value of a single item to be marked as selected.
 StaticOrderedCollectionInterface getSelectedItems()
          Gets the collection of values of items to be marked as selected.
 int getSize()
          Gets the size attribute
protected  boolean isSelected(int index)
          Determines if the given index should be marked as selected
protected  boolean isSelected(String value)
          Determines if the given value should be marked as selected
 void setDescriptionModel(StaticOrderedCollectionInterface model)
          Sets the model to be used for the descriptions of the listbox entry.
 void setMultipleSelections(boolean value)
          Sets the multiple selection attribute allowing multiple selections of values in the list.
 void setSelectedIndex(int value)
          Sets the index of single item to be marked as selected.
 void setSelectedIndexes(int[] value)
          Sets an array of index values for items to be marked as selected.
 void setSelectedItem(String value)
          Sets the value of a single item to be marked as selected.
 void setSelectedItems(StaticOrderedCollectionInterface values)
          Sets a collection of values of items to be marked as selected.
 void setSize(int value)
          Sets the size attribute.
 
Methods inherited from class com.sas.servlet.beans.BaseTransformation
getCustomAttributes, getDescription, getName, getParent, getRequest, getResponse, setCustomAttributes, setDescription, setName, setParent, setRequest, setResponse, toString, write, write, write, write
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getExtendedBeanInfo, getLinkInfo, getModelInterface, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseListbox

public BaseListbox()
Method Detail

getRequiredInterfaces

public Vector getRequiredInterfaces()
Gets the required interface that a model must implement in order to attach to this bean Models must implement com.sas.collection.StaticOrderedCollectionInterface in order to be used by this transformation bean
Returns:
An array of interface names
Overrides:
getRequiredInterfaces in class Component

setSize

public void setSize(int value)
Sets the size attribute. The default value is 4.
Specified by:
setSize in interface ListboxInterface
Parameters:
size - The maximum number of values visible to the user

getSize

public int getSize()
Gets the size attribute
Specified by:
getSize in interface ListboxInterface
Returns:
The maximum number of values visible to the user

setMultipleSelections

public void setMultipleSelections(boolean value)
Sets the multiple selection attribute allowing multiple selections of values in the list. The default is false.
Specified by:
setMultipleSelections in interface ListboxInterface
Parameters:
multiple - true if multiple selections are allowed

getMultipleSelections

public boolean getMultipleSelections()
Gets the multiple selection attribute
Specified by:
getMultipleSelections in interface ListboxInterface
Returns:
true if multiple selections are allowed

setSelectedIndex

public void setSelectedIndex(int value)
                      throws IOException
Sets the index of single item to be marked as selected. Setting the index will also update the corresponding selectedItem.
Specified by:
setSelectedIndex in interface ListboxInterface
Parameters:
index - The 0-based index of the item to be selected, or -1 for none

setSelectedIndexes

public void setSelectedIndexes(int[] value)
                        throws IOException
Sets an array of index values for items to be marked as selected. Setting the index will also update the corresponding selectedItems.
Specified by:
setSelectedIndexes in interface ListboxInterface
Parameters:
indexArray - An array of 0-based index values for items to be selected

getSelectedIndex

public int getSelectedIndex()
Gets the index of single item to be marked as selected. If more than one index has been set this will return a -1.
Specified by:
getSelectedIndex in interface ListboxInterface
Returns:
The array of 0-based values, or null for none

getSelectedIndexes

public int[] getSelectedIndexes()
Gets the array of index values of items to be marked as selected. If only a single index has been set this will return a single element array with the value.
Specified by:
getSelectedIndexes in interface ListboxInterface
Returns:
The array of 0-based values, or null for none

setSelectedItem

public void setSelectedItem(String value)
                     throws IOException
Sets the value of a single item to be marked as selected. Setting the value will also set the corresponding selectedIndex.
Specified by:
setSelectedItem in interface ListboxInterface
Parameters:
value - The value of the item to be selected

setSelectedItems

public void setSelectedItems(StaticOrderedCollectionInterface values)
                      throws IOException
Sets a collection of values of items to be marked as selected. Setting the value will also set the corresponding selectedIndexes.
Specified by:
setSelectedItems in interface ListboxInterface
Parameters:
values - The collection of values to be marked as selected

getSelectedItem

public String getSelectedItem()
Gets the value of a single item to be marked as selected. If more than one value has been set this will return a blank string
Specified by:
getSelectedItem in interface ListboxInterface
Returns:
The collection of selected values, or null for none

getSelectedItems

public StaticOrderedCollectionInterface getSelectedItems()
Gets the collection of values of items to be marked as selected. If only a single value has been set this will return a StringCollection with only one element
Specified by:
getSelectedItems in interface ListboxInterface
Returns:
The collection of selected values, 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(String value)
Determines if the given value should be marked as selected
Parameters:
value - The value to check
Returns:
true if the value should be marked as selected

setDescriptionModel

public void setDescriptionModel(StaticOrderedCollectionInterface model)
Sets the model to be used for the descriptions of the listbox entry. The default is to use the model specified in setModelInterface, which will cause the value of the listbox to be the same as the text.
Specified by:
setDescriptionModel in interface ListboxInterface
Parameters:
model - The collection to use for the descriptions

getDescriptionModel

public StaticOrderedCollectionInterface getDescriptionModel()
Gets the model to be used for the decriptions of the listbox entry. The default is to use the model specified in setModelInterface.
Specified by:
getDescriptionModel in interface ListboxInterface
Returns:
The collection to use for the descriptions


Version: 1.2.20000317.001 Formatted: 2000/07/06 15:57:33PM