|
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.Choice | +--com.sssw.rt.atlas.AtChoice | +--com.sssw.rt.form.AgcChoice
The AgcChoice control extends the standard drop-down list control supplied by the Java AWT (java.awt.Choice) by adding the ability to bind the control to a data source. It displays a list of values to users. The users can browse the list of values and select a value from the list.
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 value becomes the value associated with the current row. The selected value is saved to the database when you call updateRows() for the form.
In addition to being data-bound, the control is a data-loaded control in which a database table or other data source can provide the list of values. 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.
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Fields inherited from interface com.sssw.rt.form.AgiControl |
IMAGE_MODE_CENTERED,
IMAGE_MODE_NORMAL,
IMAGE_MODE_STRETCH,
IMAGE_MODE_TILED |
Constructor Summary | |
AgcChoice()
|
Method Summary | |
void |
add(String title,
Object value)
Inserts an item at the end of the Choice, specifying both the display text and the list item's value (may be null). |
void |
addRow(String title)
Deprecated. replaced by AgcChoice.add(String,Object) . |
int |
countRows()
Deprecated. replaced by Choice.getItemCount() . |
Color |
getBackgroundColor()
Deprecated. replaced by Component.getBackground() . |
AgoFontIdentifier |
getFontIdentifier()
Returns the SilverStream font object (AgoFontIdentifier) for the control's text. |
Object |
getItemValue(int index)
Get the value for the item with the specified index. |
String |
getRowText(int index)
Deprecated. replaced by Choice.getItem(int) . |
Object |
getRowValue(int index)
Deprecated. replaced by AgcChoice.getItemValue(int) . |
Object |
getValue()
Returns the control's value. |
void |
insert(String title,
Object value,
int index)
Inserts an item at the specified index in the Choice, specifying both the display text and the list item's value (may be null). |
void |
removeAllRows()
Deprecated. replaced by Choice.removeAll() . |
void |
removeRow(int index)
Deprecated. replaced by Choice.remove(int) . |
void |
setBackgroundColor(Color backgroundcolor)
Deprecated. replaced by Component.setBackground(Color) . |
void |
setFontIdentifier(AgoFontIdentifier fontidentifier)
Assigns the SilverStream font object (AgoFontIdentifier) to the control's text. |
void |
setValue(Object value)
Selects the row whose value is equal to the specified value. |
Methods inherited from class com.sssw.rt.atlas.AtChoice |
addNotify,
deliverMouseEvent,
deliverMouseMoveEvent,
doAtCommand,
enableAtCommands,
getChoiceHeight,
getHelper,
getToolTipText,
getToolTipText,
grabFocus,
isFocusTraversable,
isRequestFocusEnabled,
preprocessKeyEvent,
processEvent,
requestFocus,
setRequestFocusEnabled,
setToolTipText |
Methods inherited from class java.awt.Choice |
add,
addItem,
addItemListener,
countItems,
getItem,
getItemCount,
getSelectedIndex,
getSelectedItem,
getSelectedObjects,
insert,
paramString,
processItemEvent,
remove,
remove,
removeAll,
removeItemListener,
select,
select |
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.AgiControl |
getBackgroundImage,
getBackgroundImageMode,
getComponent,
getHelpInfo,
setBackgroundImage,
setBackgroundImageMode,
setHelpInfo |
Methods implemented from interface com.sssw.rt.util.AgiRowSetManager |
clearRows,
haveRowsChanged,
query,
query,
refreshRows,
updateRows |
Constructor Detail |
public AgcChoice()
Method Detail |
public AgoFontIdentifier getFontIdentifier()
The AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size. The Font Name can be one of these values: Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput, Zapfdingbats. At runtime, Java translates this value to the appropriate font installed on the system.
The Font Style can be one of these values:
The Font Size can be any integer.
The following code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the getFontIdentifier() method:
AgoFontIdentifier font; font = ControlName1.getFontIdentifier();
AgcChoice.setFontIdentifier(AgoFontIdentifier)
public void setFontIdentifier(AgoFontIdentifier fontidentifier)
fontidentifier
- specifies the AgoFontIdentifier object that assigns the font for the control.The AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size. The Font Name can be one of these values: Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput, Zapfdingbats. At runtime, Java translates this value to the appropriate font installed on the system.
The Font Style can be one of these values:
The Font Size can be any integer.
This code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the setFontIdentifier() method:
AgoFontIdentifier newFont; String newName; int newSize; int newStyle; newName="TimesRoman"; newSize=20; newStyle=AgoFontIdentifier.ITALIC; newFont=new AgoFontIdentifier(newName, newStyle, newSize); ControlName1.setFontIdentifier(newFont);
AgcChoice.getFontIdentifier()
public Color getBackgroundColor()
Component.getBackground()
.
public void setBackgroundColor(Color backgroundcolor)
Component.setBackground(Color)
.
backgroundcolor
- public void addRow(String title)
AgcChoice.add(String,Object)
.
text
- specifies the text of the row to add.The addRow() method adds a row dynamically at runtime. Rows added dynamically are not saved across sessions or instances of the control in the way that rows added as properties of the control are.
AgcChoice.removeRow(int)
,
AgcChoice.removeAllRows()
public void add(String title, Object value)
title
- the text to be displayed to represent the value in the Choice list.value
- the value of the new item.You may need to call the awt method validate() after calling add() in order to make the controls redraw correctly. Specifically, if you programmatically add a subform containing a tab control on which there are other controls, say, buttons. The tab control shows up but the buttons don't until you call validate() - or resize the designer, which has the same effect.
ControlName1.add("One", new Integer(1)); ControlName1.add("Two", new Integer(2));
AgcChoice.removeRow(int)
,
AgcChoice.removeAllRows()
public void insert(String title, Object value, int index)
title
- value
- index
- If index is -1, the item is added as the last item.
public void removeRow(int index)
Choice.remove(int)
.
index
- specifies the index of the row to remove.The rows are zero-based.
The following code fragment illustrates how to remove the row whose index is three.
ControlName1.removeRow(3);
AgcChoice.addRow(String)
public void removeAllRows()
Choice.removeAll()
.
The following code fragment illustrates how to use the removeAllRows() method.
ControlName1.removeAllRows();
AgcChoice.addRow(String)
,
AgcChoice.removeRow(int)
public int countRows()
Choice.getItemCount()
.
The rows are zero-based.
public String getRowText(int index)
Choice.getItem(int)
.
index
- specifies the index of the row containing the text to be obtained.The rows are zero-based.
public Object getRowValue(int index)
AgcChoice.getItemValue(int)
.
index
- specifies the index of the row whose value is to be obtained.The value of a row is specified in the value parameter when adding a new row. If this value is null, then this method returns the text of the row as a String.
The rows are zero-based.
public Object getItemValue(int index)
index
- the item's index.The value of a row is specified in the value parameter when adding a new row. If this value is null, then this method returns the text of the row as a String.
The rows are zero-based.
Object value; value = ControlName1.getItemValue(3);
public Object getValue()
If the internal value is null, then the selected node's text is returned as a String. If no node is selected, then null is returned.
Object value; value = ControlName1.getValue();
AgcChoice.setValue(Object)
public void setValue(Object value)
value
- specifies an internal value that specifies which row to select.At design time the contents of the internal value can be specified using the Property Inspector. It can be static or retrieved from the database. Each row can have its own internal value.
If the control is populated from a static list of data (that is the Load Choices property is set to Statically), the internal values can be specified using the Values property.
If the control is populated from the database (that is the Load Choices property is set to From Table), the internal values can be specified using the Storage value property.
Suppose a control is loaded statically:
The following code fragment illustrates how to make Orange the selected item using setValue().
int x=3; ControlName1.setValue(new Integer(x));
Note that this example uses the Integer class instead of the int primitive data type because an Object can not be cast to an int.
AgcChoice.getValue()
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |