|
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.JComboBox | +--com.sssw.rt.jform.AgcJComboBox
A lightweight component that displays a list of values in a dropdown list. The currently selected value is displayed in an input field where it can be edited, if editing is allowed. The AgcJComboBox control is a data-bound list control.
When the control is bound to a database column via the Data Column property,
the value in the database 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 an associated 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; meaning
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.
In the Form Designer's Property Inspector, you can specify that the list values be loaded from a table, or you can provide static lists of display and storage values.
For the data model, AgcJComboBox uses the DefaultComboBoxModel. However,
you seldom need to work directly with the model. AgcJComboBox and its
ancestor JComboBox
provide methods that add and remove list
items from the model.
Inner classes inherited from class javax.swing.JComboBox |
JComboBox.AccessibleJComboBox,
JComboBox.KeySelectionManager |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Fields inherited from class javax.swing.JComboBox |
actionCommand,
dataModel,
editor,
isEditable,
keySelectionManager,
lightWeightPopupEnabled,
maximumRowCount,
renderer,
selectedItemReminder |
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 | |
AgcJComboBox()
Initializes a AgcJComboBox control with an empty list. |
|
AgcJComboBox(ComboBoxModel m)
Initializes the control with list items from a DefaultComboBoxModel. |
|
AgcJComboBox(Object[] items)
Initializes the control with a DefaultComboBoxModel whose values are specified in the items array. |
|
AgcJComboBox(Vector items)
Initializes the control with a DefaultComboBoxModel whose values are specified in the items Vector. |
Method Summary | |
void |
addItem(String title,
Object value)
Appends an item to the list, specifying both the display text and the list item's value. |
Object |
getItemValue(int index)
Gets the text of the item at the specified index. |
Object |
getValue()
Gets the storage value of the selected item, which is the value that is sent to the database. |
void |
insertItemAt(String title,
Object value,
int index)
Adds an item at the specified index in the list, specifying both the display text and the list item's value. |
void |
loadFromRowCursor(AgiRowCursor rc,
int displaycol,
int valuecol)
Creates list items from an AgiRowCursor data source. |
void |
setValue(Object value)
Selects the item whose 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 |
Constructor Detail |
public AgcJComboBox()
public AgcJComboBox(ComboBoxModel m)
m
- a DefaultComboBoxModel that has been initialized with list
itemspublic AgcJComboBox(Object[] items)
items
- an array of Objects where each element becomes an item in
the listpublic AgcJComboBox(Vector items)
items
- a Vector object whose elements become the displayed listMethod Detail |
public void addItem(String title, Object value)
title
- a String specifying the item's display valuevalue
- an Object, which is the item's value, which may be nullAgcJComboBox.insertItemAt(String, Object, int)
,
AgcJComboBox.loadFromRowCursor(AgiRowCursor, int, int)
public void insertItemAt(String title, Object value, int index)
title
- a String specifying the item's display valuevalue
- an Object, which is the item's value, which may be nullindex
- an int specifying the position for the Object in the list.
Index must be between 0 and the size of the list.AgcJComboBox.addItem(String, Object)
,
AgcJComboBox.loadFromRowCursor(AgiRowCursor, int, int)
public Object getItemValue(int index)
index
- an int specifying the item's position in the list. Index
must be between 0 and the size of the list.AgcJComboBox.getValue()
public Object getValue()
AgcJComboBox.setValue(Object)
public void setValue(Object value)
value
- an Object representing the item you want to selectAgcJComboBox.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
itemsAgcJComboBox.addItem(String, Object)
,
AgcJComboBox.insertItemAt(String, Object, int)
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |