|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JList | +--com.sssw.rt.jform.AgcJList
A lightweight component that displays a scrollable list of values and allows the user to select one or more objects from the list. The component can be data-bound, which associates the selected item in the list with a database column.
When the control is bound to a database column via the Data Column property,
the value in the current row sets the initially selected item in the list.
If the user makes a different selection,
that item becomes the value associated with the current row.
Each list item can have a display value and storage
value. The display value is a String, but the storage value can be any Object.
If there is no separate display value,
the Object is converted to a String for display.
The storage value is the value sent to the database
when you call updateRows()
for the form.
In addition to being data-bound, the control is a data-loaded control; which means
a database table or other data source
can provide the list items.
You can use methods of AgiRowSetManager to navigate the list.
However, changes to the list items do not affect the underlying data; therefore,
calling updateRows()
is not allowed. If you call it for the control,
updateRows()
throws AgoUnsupportedOperationException.
AgcJList uses a model to represent the contents of the list. SilverStream builds the model from information you specify in the Form Designer. On the property sheet for the list control, you can specify either a static list of values or a database table from which the list retrieves the values. If you create the list programmatically, you can specify either your own model or a list of values in the constructor.
Inner classes inherited from class javax.swing.JList |
JList.AccessibleJList |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
AgcJList()
Initializes an AgcJList control with an empty list. |
|
AgcJList(ListModel m)
Initializes the control with list items from a DefaultListModel. |
|
AgcJList(Object[] items)
Initializes the control with a DefaultListModel whose values are specified in the items array. |
|
AgcJList(Vector items)
Initializes the control with a DefaultListModel whose values are specified in the items Vector. |
Method Summary | |
void |
addItem(Object obj)
Appends an item to the list. |
void |
addItem(String title,
Object value)
Appends an item to the list, with values for the display text and storage value. |
String |
getItemAt(int index)
Gets the displayed text for the item at the specified index. |
int |
getItemCount()
Gets the number of items in the list. |
Object |
getItemValue(int index)
Gets the storage value of the item at the specified index. |
Object |
getValue()
Gets the storage value of the selected item. |
void |
insertItemAt(Object obj,
int index)
Adds an item to the list at the specified index. |
void |
insertItemAt(String title,
Object value,
int index)
Adds an item at the specified index in the List, specifying separate values for the display text and storage value. |
void |
loadFromRowCursor(AgiRowCursor rc,
int displaycol,
int valuecol)
Creates list items from an AgiRowCursor source. |
void |
removeAllItems()
Removes all items from the list. |
void |
removeItemAt(int index)
Removes the item at the specified position from the list. |
void |
setValue(Object value)
Selects the item whose storage value matches the specified value. |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Methods implemented from interface com.sssw.rt.form.AgiHelpInfo |
getHelpInfo,
setHelpInfo |
Methods implemented from interface com.sssw.rt.util.AgiRowSetManager |
clearRows,
haveRowsChanged,
query,
query,
refreshRows,
updateRows |
Methods implemented from interface javax.swing.event.ListSelectionListener |
valueChanged |
Constructor Detail |
public AgcJList()
public AgcJList(ListModel m)
m
- a DefaultListModel that has been initialized with list itemspublic AgcJList(Object[] items)
items
- an array of Objects where each element becomes an item in
the listpublic AgcJList(Vector items)
items
- a Vector object whose elements become the displayed listMethod Detail |
public void addItem(Object obj)
obj
- an Object to be added to the end of the listAgcJList.addItem(String, Object)
,
AgcJList.insertItemAt(Object, int)
,
AgcJList.insertItemAt(String, Object, int)
public void insertItemAt(Object obj, int index)
obj
- an Object you want to add to the list. The Object is the
storage value. It is converted to a String for the display value.index
- an int specifying the position for the Object in the list.
Index must be between 0 and one less than the size of the list (0 <=
index < size). If the index is out of range, this method throws an
ArrayOutOfBoundsException.AgcJList.addItem(Object)
or AgcJList.addItem(String, Object)
.
This method works only if the AgcJList object uses the default data model. AgcJList uses the default data model when created with the empty constructor and no other model has been set.
AgcJList.addItem(Object)
,
AgcJList.addItem(String, Object)
,
AgcJList.insertItemAt(String, Object, int)
public void addItem(String title, Object value)
title
- a String specifying the item's display valuevalue
- an Object specifying the item's storage value.
The storage value may be null.AgcJList.addItem(Object)
,
AgcJList.insertItemAt(Object, int)
,
AgcJList.insertItemAt(String, Object, int)
public void insertItemAt(String title, Object value, int index)
title
- a String specifying the item's display valuevalue
- an Object specifying the item's storage value.
The storage value may be null.index
- an int specifying the position for the Object in the list.
Index must be between 0 and one less than the size of the list (0 <=
index < size). If the index is out of range, this method throws an
ArrayOutOfBoundsException.AgcJList.addItem(Object)
,
AgcJList.addItem(String, Object)
,
AgcJList.insertItemAt(Object, int)
public void removeItemAt(int index)
index
- an int specifying the position of the item to be removed.
Index must be between 0 and one less than the size of the list (0 <=
index < size). If the index is out of range, this method throws an
ArrayOutOfBoundsException.AgcJList.removeAllItems()
,
AgcJList.insertItemAt(Object, int)
,
AgcJList.insertItemAt(String, Object, int)
public void removeAllItems()
AgcJList.removeItemAt(int)
public String getItemAt(int index)
index
- an int specifying the item's position in the list. Index
must be between 0 and one less than the size of the list (0 <=
index < size). If the index is out of range, this method throws an
ArrayOutOfBoundsException.AgcJList.getItemValue(int)
,
AgcJList.getValue()
public Object getItemValue(int index)
index
- an int specifying the item's position in the list. Index must be between 0 and one less than the size of the list (0 <=
index < size). If the index is out of range, this method throws an
ArrayOutOfBoundsException.AgcJList.getItemAt(int)
,
AgcJList.getValue()
public int getItemCount()
public Object getValue()
AgcJList.setValue(Object)
,
AgcJList.getItemAt(int)
,
AgcJList.getItemValue(int)
public void setValue(Object value)
value
- an Object whose value matches the storage value of the
item you want to select.AgcJList.getValue()
public void loadFromRowCursor(AgiRowCursor rc, int displaycol, int valuecol) throws AgoSecurityException, AgoTransientSystemException, AgoUnrecoverableSystemException
rc
- the AgiRowCursor object whose data you want to be the listdisplaycol
- an int specifying the number of a column in the
AgiRowCursor object whose values will be the display values for the list
itemsvaluecol
- an int specifying the number of a column in the
AgiRowCursor object whose values will be the storage values for the list
items
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |