|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.awt.ListBox
public class ListBox
ListBox is a component that maintains a scrollable list
of items for selection. Setting the multipleMode property to
true will allow more than one item to be selected. The multipleMode
property is initially set to false.
Creation:
ListBox listBox1 = new ListBox();
listBox1.initialize();
ListBox listBox1 = new ListBox(rows);
listBox1.initialize();
ListBox listBox1 = new ListBox(rows, multipleMode);
listBox1.initialize();
| Field Summary | |
|---|---|
static int |
EXTENDED_SELECT
|
static java.lang.String |
RB_KEY
|
static int |
STANDARD_AWT
|
| Constructor Summary | |
|---|---|
ListBox()
Default Constructor |
|
ListBox(int rows)
Create a new ListBox with the specified number of rows |
|
ListBox(int rows,
boolean multipleMode)
Create a new ListBox with the specified number of rows and a boolean stating whether multiple selections are allowed |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Object item)
Adds an item to the end of the list if the attached model supports addition of items. |
void |
add(java.lang.Object[] items)
Adds items to the end of the list if the attached model supports addition of items. |
void |
add(java.lang.Object item,
int index)
Adds an item at the specified location if the attached model supports addition of items. |
void |
add(java.lang.String item)
Adds an item to the end of the list if the attached model supports addition of items. |
void |
add(java.lang.String item,
int index)
Adds an item at the specified location if the attached model supports addition of items. |
void |
addItem(java.lang.String item)
Deprecated. |
void |
addItem(java.lang.String item,
int index)
Deprecated. |
void |
addItems(java.util.Enumeration items)
Adds items to the end of the list if the attached model supports addition of items. |
void |
attachModel(com.sas.ModelInterface model)
Attaches a model to the component. |
java.lang.Object |
clone()
Clones the component |
void |
contentsChanged(com.sas.collection.ContentsChangedEvent evt)
Called when the contents of the model have changed. |
void |
deselect(int index)
Deselects the item at the specified index |
void |
deselectAll()
Deselects all items currently selected in the ListBox |
void |
detachModel(com.sas.ModelInterface model)
Detaches the current model and attaches the default model if the model is set to null |
int |
findItemByPrefix(java.lang.String prefix,
int index)
Finds an item in the listbox starting with the specified prefix and location |
static int |
getDefaultHeight()
Returns the default height for instances of this class |
static int |
getDefaultWidth()
Returns the default width for instances of this class |
com.sas.util.transforms.TransformInterface |
getDisplayTransform()
Returns the display transform. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns the ExtendedBeanInfo for this class. |
java.lang.String[] |
getInitialItems()
Returns the initial items (an empty string array is returned if there are no initial items) |
com.sas.util.transforms.TransformInterface |
getInputTransform()
Returns the input transform. |
int |
getMultipleSelectionStyle()
Returns the multipleSelectionStyle. |
com.sas.util.transforms.TransformInterface |
getOutputTransform()
Returns the output transform. |
java.util.Vector |
getRequiredInterfaces()
Returns the required interfaces Vector for this component. |
int[] |
getSelectedIndexes()
Returns the selected indexes. |
java.lang.String[] |
getSelectedItems()
Returns the selected items. |
java.lang.Object[] |
getSelectedObjects()
Returns the selected objects. |
java.lang.String |
getSelectionPrefix()
Returns the selectionPrefix value. |
java.lang.String |
getText()
Returns the selected item. |
int |
getVisibleRows()
Returns the number of visible rows |
void |
initialize()
Preserve the value of the selectedIndex |
void |
initializeComponent()
Adds default items to the default model if in a design-time environment. |
boolean |
isDefaultModelAttached()
Returns whether the default model is attached. |
boolean |
isKeyboardSelectable()
Returns the value of the keyboardSelectable property. |
boolean |
isSelectionsOrdered()
Returns the value of the selectionsOrdered property. |
void |
paint(java.awt.Graphics g)
Paints the component. |
protected void |
processItemEvent(java.awt.event.ItemEvent e)
Processes item events occurring on this component.Subclasses should always call super so that events are delivered to any ItemListeners. |
protected void |
processKeyEvent(java.awt.event.KeyEvent e)
Processes key events occurring on this component. |
void |
refresh()
Clears current items and adds items obtained from the attached model |
void |
refresh(com.sas.ModelInterface model)
Clears current items and add items obtained from the attached model |
void |
remove(int position)
Removes an item at the specified position if the attached model supports removal of items. |
void |
remove(java.lang.Object item)
Removes the first occurrence of item if the attached model supports removal of items. |
void |
remove(java.lang.String item)
Removes the first occurrence of item if the attached model supports removal of items. |
void |
removeAll()
Removes all items from the ListBox |
void |
replaceItem(java.lang.Object newvalue,
int index)
Replaces an item if the attached model supports replacement of items. |
void |
replaceItem(java.lang.String newvalue,
int index)
Replaces an item if the attached model supports replacement of items. |
void |
select(int index)
Selects the item corresponding to the specified index |
void |
selectAll()
Selects all items |
static void |
setDefaultHeight(int newDefaultHeight)
Sets the default height of the component. |
void |
setDefaultValues()
Sets the initial values to the default values. |
static void |
setDefaultWidth(int newDefaultWidth)
Sets the default width of the component. |
void |
setDisplayTransform(com.sas.util.transforms.TransformInterface transform)
Sets the display transform. |
void |
setFont(java.awt.Font font)
Sets the font to be used by the component for displaying text. |
void |
setInitialItems(java.lang.String[] items)
Sets the initialItems on the ListBox. |
void |
setInputTransform(com.sas.util.transforms.TransformInterface transform)
Sets the input Transform. |
void |
setItems(java.lang.Object[] items)
Sets the items in the ListBox. |
void |
setItems(java.lang.String[] items)
Sets the items in the ListBox. |
void |
setKeyboardSelectable(boolean state)
Sets the value of the keyboardSelectable property. |
void |
setMultipleMode(boolean state)
Sets whether the ListBox allows multiple selections. |
void |
setMultipleSelectionStyle(int style)
Sets the multipleSelectionStyle(STANDARD_AWT or EXTENDED_SELECT). |
void |
setOutputTransform(com.sas.util.transforms.TransformInterface transform)
Sets the output Transform. |
void |
setSelectedIndex(int index)
Selects the item corresponding to the specified index |
void |
setSelectedIndexes(int[] indexes)
Selects the items corresponding to the specified indexes |
void |
setSelectedItem(java.lang.Object text)
Sets the selected item to the specified object. |
void |
setSelectedItem(java.lang.String text)
Sets the selected item to the specified string. |
void |
setSelectedItems(java.lang.Object[] items)
Sets the selected items to the specified objects. |
void |
setSelectedItems(java.lang.String[] items)
Sets the selected items to the specified strings. |
void |
setSelectionPrefix(java.lang.String prefix)
Sets the selection prefix. |
void |
setSelectionsOrdered(boolean value)
Sets the value of the selectionsOrdered property. |
void |
setText(java.lang.String text)
Sets the selected item. |
void |
setVisibleRows(int rows)
Sets the number of visible rows Setting the number of visible rows to a value less than 0 will be ignored. |
| Field Detail |
|---|
public static final java.lang.String RB_KEY
public static final int STANDARD_AWT
public static final int EXTENDED_SELECT
| Constructor Detail |
|---|
public ListBox()
public ListBox(int rows)
rows - number of rows
public ListBox(int rows,
boolean multipleMode)
rows - number of rowsmultipleMode - boolean indicating whether multiple selections are allowed| Method Detail |
|---|
public static int getDefaultWidth()
setDefaultWidth(int)public static void setDefaultWidth(int newDefaultWidth)
newDefaultWidth - the new default width in pixelsgetDefaultWidth()public static int getDefaultHeight()
setDefaultHeight(int)public static void setDefaultHeight(int newDefaultHeight)
newDefaultHeight - the new default height in pixelsgetDefaultHeight()public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public void addItems(java.util.Enumeration items)
items - items to be addedpublic void add(java.lang.Object item)
item - item to be addedpublic void add(java.lang.Object item, int index)
item - item to be addedindex - location for adding the itempublic void add(java.lang.Object[] items)
items - items to be addedpublic void add(java.lang.String item)
add in class java.awt.Listitem - item to be addedpublic void add(java.lang.String item, int index)
add in class java.awt.Listitem - item to be addedindex - location for adding the itempublic void addItem(java.lang.String item)
addItem in class java.awt.Listpublic void addItem(java.lang.String item, int index)
addItem in class java.awt.Listpublic void attachModel(com.sas.ModelInterface model)
attachModel in interface com.sas.ViewInterfaceattachModel in class ListBoxVisualComponentmodel - model to attachViewInterface.attachModel(com.sas.ModelInterface)public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone in interface com.sas.PublicClonableclone in class ListBoxVisualComponentjava.lang.CloneNotSupportedException - if the model attached to the component being cloned
will not allow the clone to attach.public void contentsChanged(com.sas.collection.ContentsChangedEvent evt)
contentsChanged in interface com.sas.collection.ContentsChangedListenerevt - ContentsChangedEvent from the modelpublic void deselect(int index)
deselect in class java.awt.Listindex - postion of the item to deselectpublic void deselectAll()
public void detachModel(com.sas.ModelInterface model)
detachModel in interface com.sas.ViewInterfacedetachModel in class ListBoxVisualComponentmodel - Model to detachViewInterface.detachModel(com.sas.ModelInterface)public int findItemByPrefix(java.lang.String prefix, int index)
prefix - prefixindex - starting location
public com.sas.util.transforms.TransformInterface getDisplayTransform()
setDisplayTransform(com.sas.util.transforms.TransformInterface)public java.lang.String[] getInitialItems()
setInitialItems(java.lang.String[])public com.sas.util.transforms.TransformInterface getInputTransform()
setInputTransform(com.sas.util.transforms.TransformInterface)public int getMultipleSelectionStyle()
setMultipleSelectionStyle(int)public com.sas.util.transforms.TransformInterface getOutputTransform()
setOutputTransform(com.sas.util.transforms.TransformInterface)public java.util.Vector getRequiredInterfaces()
getRequiredInterfaces in interface com.sas.ViewInterfacegetRequiredInterfaces in class ListBoxVisualComponentViewInterface.getRequiredInterfaces()public int[] getSelectedIndexes()
getSelectedIndexes in class java.awt.ListsetSelectedIndexes(int[])public java.lang.String[] getSelectedItems()
getSelectedItems in class java.awt.ListsetSelectedItems(java.lang.Object[])public java.lang.Object[] getSelectedObjects()
getSelectedObjects in interface java.awt.ItemSelectablegetSelectedObjects in class java.awt.Listpublic java.lang.String getSelectionPrefix()
findItemByPrefix(java.lang.String, int),
setSelectionPrefix(java.lang.String)public java.lang.String getText()
getText in interface com.sas.lang.StringDataInterfacesetText(java.lang.String)public int getVisibleRows()
getVisibleRows()public boolean isDefaultModelAttached()
isDefaultModelAttached in interface com.sas.ViewDefaultModelInterfacepublic boolean isKeyboardSelectable()
setKeyboardSelectable(boolean)public void initialize()
initialize in interface com.sas.ComponentInterfaceinitialize in class ListBoxVisualComponentComponentInterface.initialize()public void initializeComponent()
initializeComponent in interface com.sas.ComponentInterfaceinitializeComponent in class ListBoxVisualComponentComponentInterface.initializeComponent()public boolean isSelectionsOrdered()
setSelectionsOrdered(boolean)public void paint(java.awt.Graphics g)
paint in class ListBoxVisualComponentg - the specified Graphics windowVisualInterfaceSupport.paint(com.sas.ComponentInterface, com.sas.awt.VisualInterface, java.awt.Component, java.awt.Graphics)protected void processItemEvent(java.awt.event.ItemEvent e)
processItemEvent in class java.awt.Liste - event to be handledprotected void processKeyEvent(java.awt.event.KeyEvent e)
processKeyEvent in class java.awt.Componente - the key event.KeyListener,
InputEvent.consume()public void refresh()
public void refresh(com.sas.ModelInterface model)
refresh in interface com.sas.ViewInterfacerefresh in class ListBoxVisualComponentmodel - attached modelViewInterface.refresh(com.sas.ModelInterface)public void remove(int position)
remove in class java.awt.Listposition - index of the item to be removedpublic void remove(java.lang.Object item)
item - item to be removed
java.lang.IllegalArgumentException(); - if item is not foundpublic void remove(java.lang.String item)
remove in class java.awt.Listitem - item to be removedpublic void removeAll()
removeAll in class java.awt.Listpublic void replaceItem(java.lang.Object newvalue, int index)
newvalue - replacement textindex - index of the item to be replacedpublic void replaceItem(java.lang.String newvalue, int index)
replaceItem in class java.awt.Listnewvalue - replacement textindex - index of the item to be replacedpublic void select(int index)
select in class java.awt.Listindex - the selected item positionpublic void selectAll()
public void setDefaultValues()
setDefaultValues in interface VisualInterfacesetDefaultValues in interface com.sas.ComponentInterfacesetDefaultValues in class ListBoxVisualComponentComponentInterface.setDefaultValues()public void setDisplayTransform(com.sas.util.transforms.TransformInterface transform)
transform - the new value for the displayTransform propertygetDisplayTransform()public void setFont(java.awt.Font font)
setFont in interface VisualInterfacesetFont in class ListBoxVisualComponentfont - fontComponent.setFont(java.awt.Font),
ListBoxVisualComponent.getFont()public void setInputTransform(com.sas.util.transforms.TransformInterface transform)
the - new value for the inputTransform propertygetInputTransform()public void setInitialItems(java.lang.String[] items)
items - items to add to the defaultModelgetInitialItems()public void setItems(java.lang.Object[] items)
items - an array of elements to set the ListBox withpublic void setItems(java.lang.String[] items)
items - an array of elements to set the ListBox withpublic void setKeyboardSelectable(boolean state)
state - boolean valuepublic void setMultipleMode(boolean state)
setMultipleMode in class java.awt.Liststate - if true then multiple selections are allowed;
otherwise, only one item can be selected at a time.List.isMultipleMode()public void setMultipleSelectionStyle(int style)
style - multipleSelectionStyle (STANDARD_AWT (0) or EXTENDED_SELECT (1)).
java.lang.IllegalArgumentException();public void setOutputTransform(com.sas.util.transforms.TransformInterface transform)
transform - the new value for the outputTransform propertygetOutputTransform()public void setSelectedIndex(int index)
index - position of the selected itempublic void setSelectedIndexes(int[] indexes)
indexes - positions of the selected itemspublic void setSelectedItem(java.lang.Object text)
text - the string to selectpublic void setSelectedItem(java.lang.String text)
text - the string to selectpublic void setSelectedItems(java.lang.Object[] items)
items - an array of Objects to selectpublic void setSelectedItems(java.lang.String[] items)
items - an array of Strings to selectpublic void setSelectionPrefix(java.lang.String prefix)
prefix - selection prefixfindItemByPrefix(java.lang.String, int),
getSelectionPrefix()public void setSelectionsOrdered(boolean value)
value - of the selectionsOrdered propertyisSelectionsOrdered()public void setText(java.lang.String text)
setText in interface com.sas.lang.StringDataInterfaceselected - itempublic void setVisibleRows(int rows)
rows - number of visible rowsgetVisibleRows()
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||