|
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.JPanel | +--com.sssw.rt.atlas.AtPanel | +--com.sssw.rt.form.PvBasePanel | +--com.sssw.rt.form.AgcComboBox
The AgcComboBox control is a data-bound list control that displays a list of values to users who 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.
Inner classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Fields inherited from class com.sssw.rt.atlas.AtPanel |
BGIMAGE_DRAW_CENTERED,
BGIMAGE_DRAW_NORMAL,
BGIMAGE_DRAW_STRETCH,
BGIMAGE_DRAW_TILED |
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 | |
AgcComboBox()
|
Method Summary | |
AgoTreeControlNode |
add(AgoTreeControlNode relative,
int relationship,
String text)
Adds a new node to the control. |
AgoTreeControlNode |
add(AgoTreeControlNode relative,
int relationship,
String text,
Object userData,
Image image)
Adds a new node with an associated object or image. |
void |
addAgiValueChangingListener(AgiValueChangingListener listener)
|
void |
collapseNode(AgoTreeControlNode node)
Collapses (hides) the children of a specified node. |
void |
expandNode(AgoTreeControlNode node)
Expands (shows) the children of a specified node. |
AgoTreeControlNode |
findNode(String text,
Object userData,
boolean recurse)
Finds a node with the specified text and/or user data. |
boolean |
getEditable()
Returns a boolean that indicates whether or not the user can edit the control's text. |
AgoFontIdentifier |
getFontIdentifier()
Returns the SilverStream font object (AgoFontIdentifier) for the control's text. |
AgoTreeControlNode |
getRootNode()
Returns the control's root node. |
AgoTreeControlNode |
getSelectedNode()
Returns the control's currently selected node. |
String |
getSelectedText()
Returns a String that contains the currently selected text. |
int |
getSelectionEnd()
Returns the ending character index of the current selection. |
int |
getSelectionStart()
Returns the starting character index of the current selection. |
String |
getText()
Returns a String that contains the control's text. |
Object |
getValue()
Returns the control's value. |
void |
remove(AgoTreeControlNode node)
Removes a specified node from the control. |
void |
removeAgiValueChangingListener(AgiValueChangingListener listener)
|
void |
removeAll()
Removes all nodes from the control. |
void |
select(int start,
int end)
Select a range of characters. |
void |
selectAll()
Selects the control's contents. |
void |
setBackground(Color color)
Sets the background color of the combo box. |
void |
setEditable(boolean editable)
Assigns a boolean value that determines whether the user can edit the control. |
void |
setFontIdentifier(AgoFontIdentifier fontidentifier)
Assigns the SilverStream font object (AgoFontIdentifier) to the control's text. |
void |
setForeground(Color color)
Sets the text color of the combo box. |
void |
setSelectedNode(AgoTreeControlNode node)
Sets the selection to the specified node. |
void |
setText(String text)
Assigns 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.form.PvBasePanel |
getBackgroundColor,
setBackgroundColor |
Methods inherited from class com.sssw.rt.atlas.AtPanel |
addImpl,
addNotify,
clientPaint,
clientPaint,
deliverMouseEvent,
deliverMouseMoveEvent,
doAtCommand,
drawTiledImage,
enableAtCommands,
getBackgroundImage,
getBackgroundImageMode,
getHelper,
getTransparent,
hide,
hideToolTip,
imageUpdate,
isFocusTraversable,
isOptimizedDrawingEnabled,
ownedImage,
paintBorder,
paintComponent,
paintImmediately,
paintImmediately,
paintNow,
preprocessKeyEvent,
processEvent,
reshape,
setBackgroundImage,
setBackgroundImageMode,
setTransparent,
show,
showToolTip |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext,
getUIClassID,
paramString,
updateUI |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
remove,
remove,
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.AgiControl |
getComponent,
getHelpInfo,
setHelpInfo |
Methods implemented from interface com.sssw.rt.util.AgiRowSetManager |
clearRows,
haveRowsChanged,
query,
query,
refreshRows,
updateRows |
Methods implemented from interface com.sssw.rt.util.AgiTabstopHandler |
getTabOrder |
Methods implemented from interface java.awt.event.FocusListener |
focusGained,
focusLost |
Methods implemented from interface java.awt.event.KeyListener |
keyPressed,
keyReleased,
keyTyped |
Methods implemented from interface java.awt.event.MouseListener |
mouseClicked,
mouseEntered,
mouseExited,
mousePressed,
mouseReleased |
Methods implemented from interface java.awt.event.MouseMotionListener |
mouseDragged,
mouseMoved |
Methods implemented from interface java.beans.PropertyChangeListener |
propertyChange |
Methods implemented from interface java.awt.event.TextListener |
textValueChanged |
Constructor Detail |
public AgcComboBox()
Method Detail |
public boolean getEditable()
When getEditable returns true, the user can edit the text. If the control is enabled but not editable, the user cannot change the value of the text, but can select, copy, and scroll the text.
For the ComboBox control, if the control is enabled, the user can always pick from the drop-down list, even if the control is not editable.
The following code fragment illustrates how to use the getEditable() method.
boolean editable; editable = Combobox1.getEditable();
AgcComboBox.setEditable(boolean)
public void setEditable(boolean editable)
editable
- specifies whether the control is editable.When the value is true, the user can edit the control.
The following code fragment illustrates how to make a control editable.
Combobox1.setEditable(true);
AgcComboBox.getEditable()
public String getText()
The following code fragment illustrates how to call getText().
String s; s = Combobox1.getText();
AgcComboBox.setText(String)
public void setText(String text)
text
- specifies the text for the currently selected item.For the AgcComboBox control, this method permits the selected row to be assigned programmatically. It does not update or modify the text.
If the text is changed (by the user or programmatically), then the combo box is searched for an item with the same text. If one is found, it is selected. Therefore, this method may change the selection.
The following code fragment illustrates how to use the setText() method.
Combobox1.setText("Add");
AgcComboBox.getText()
public void setForeground(Color color)
color
- a Color object.Component.getForeground()
public void setBackground(Color color)
color
- a Color object.Component.getBackground()
public void addAgiValueChangingListener(AgiValueChangingListener listener)
listener
- public void removeAgiValueChangingListener(AgiValueChangingListener listener)
listener
- 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 = Combobox1.getFontIdentifier();
AgcComboBox.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); Combobox1.setFontIdentifier(newFont);
AgcComboBox.getFontIdentifier()
public AgoTreeControlNode add(AgoTreeControlNode relative, int relationship, String text)
relative
- specifies an existing node. The new node is created relative to this object.
When this object is null, the new node is added after the last top-level node, and relationship is ignored.relationship
- specifies the relationship the new node has to the node specified by relative.text
- specifies text to display at this node.The value of relationship can be one of the following:
Value | Description |
---|---|
AgcComboBox.CHILD | Adds the node after the current node. The new node is indented to reflect the parent-child relationship. |
AgcComboBox.NEXT | Adds the node underneath the current node. It is a sibling so it is not indented. |
AgcComboBox.PREVIOUS | Adds the node above the current node. It is a sibling so it is not indented. |
AgcComboBox.LAST | Adds the node as the last node in the current node's row. It is a sibling of the current node so it is not indented. |
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.
The following code fragment adds three top-level nodes, labeled A B and C. It also adds two child nodes to A, which are labeled one and two.
AgoTreeControlNode node; // Add the first top-level node A. // If the first parameter is null, then the second parameter is // ignored, so we can just pass zero. node = ControlName1.add(null, 0, "A"); // Add two child nodes under node A. ControlName1.add(node, AgcComboBox.CHILD, "one"); ControlName1.add(node, AgcComboBox.CHILD, "two"); // Add two more top-level nodes. ControlName1.add(null, 0, "B"); ControlName1.add(null, 0, "C");
AgcComboBox.remove(AgoTreeControlNode)
,
AgcComboBox.removeAll()
,
AgoTreeControlNode
,
AgcTreeControl
public AgoTreeControlNode add(AgoTreeControlNode relative, int relationship, String text, Object userData, Image image)
relative
- specifies an existing node.
The new node is created relative to this object. When this object is null, the new node is
added after the last top-level node, and relationship is ignored.relationship
- specifies the relationship the new node has to the node specified by relative.text
- specifies text to display at this node.userData
- specifies an Object. It can be any user-specified object. This can be null.image
- specifies the image to display at this node. This can be null.The value of relationship can be one of the following:
Value | Description |
---|---|
AgcComboBox.CHILD | Adds the node after the current node. The new node is indented to reflect the parent-child relationship. |
AgcComboBox.NEXT | Adds the node underneath the current node. It is a sibling so it is not indented. |
AgcComboBox.PREVIOUS | Adds the node above the current node. It is a sibling so it is not indented. |
AgcComboBox.LAST | Adds the node as the last node in the tree. It is a sibling of the current node so it is not indented. |
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.
AgcComboBox.remove(AgoTreeControlNode)
,
AgcComboBox.removeAll()
,
AgoTreeControlNode
,
AgcTreeControl
public void remove(AgoTreeControlNode node)
node
- the node to remove.The following code fragment illustrates how to remove a node.
AgoTreeControlNode nodeToRemove; nodeToRemove = Combobox1.findNode("customer1",null,true); Combobox1.removeNode(nodeToRemove);
AgcComboBox.add(AgoTreeControlNode,int,String)
,
AgcComboBox.removeAll()
,
AgoTreeControlNode
public void removeAll()
The following code fragment illustrates how to remove all of the rows from the AgcChoice control.
Combobox1.removeAll();
AgcComboBox.add(AgoTreeControlNode,int,String)
,
AgcComboBox.remove(AgoTreeControlNode)
public AgoTreeControlNode getRootNode()
The control's root node is the first node on the top level. For example, a tree control is populated with a list of customers. The customers are ordered by CustomerID. Assuming that the query contained customers 1-50, the root node in this case would be the node where the CustomerID = 1.
Returns null if the tree is empty.
The following code fragment illustrates how to obtain the root node.
AgoTreeControlNode root; root = Combobox1.getRootNode();
AgoTreeControlNode
public AgoTreeControlNode getSelectedNode()
The node can be selected by the user, or programmatically using the setSelectedNode() method.
The following code fragment illustrates how to obtain the currently selected node.
AgoTreeControlNode selectedNode; selectedNode = Combobox1.getSelectedNode();
AgcComboBox.setSelectedNode(AgoTreeControlNode)
,
AgoTreeControlNode
public void setSelectedNode(AgoTreeControlNode node)
node
- specifies the node to select.The following code fragment illustrates how to find a node and then select it.
AgoTreeControlNode node; node = Combobox1.findNode("customer1",null,true); Combobox1.setSelectedNode(node);
AgcComboBox.getSelectedNode()
public void expandNode(AgoTreeControlNode node)
node
- specifies the node to expand.The following code fragment illustrates how to find a node and then expand it.
AgoTreeControlNode node; node = Combobox1.findNode("customer1",null,true); Combobox1.expandNode(node);
AgcComboBox.collapseNode(AgoTreeControlNode)
,
AgoTreeControlNode
public void collapseNode(AgoTreeControlNode node)
node
- specifies the node to collapse.The following code fragment illustrates how to find a node then collapse it.
AgoTreeControlNode node; node = Combobox1.findNode("customer1",null,true); Combobox1.collapseNode(node);
AgcComboBox.expandNode(AgoTreeControlNode)
,
AgoTreeControlNode
public AgoTreeControlNode findNode(String text, Object userData, boolean recurse)
text
- specifies text to search for.userData
- specifies an Object to search for.
The userData values are compared by the equals() method.recursive
- specifies whether to search for the text or userData recursively.If text is null, then the control returns the first node that matches the userData (and vise versa). If recursive is false, the control only searches the top-level node. If recursive is true, the control searches all levels beginning with the root node.
The following code fragment illustrates how to find a node recursively.
AgoTreeControlNode node; node = Combobox1.findNode("Smith",null,true);
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();
AgcComboBox.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 set using the Property Inspector. The contents 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 set 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.
AgcComboBox.getValue()
public int getSelectionStart()
The following code fragment illustrates how to obtain the start of the currently selected text.
int start; start = Combobox1.getSelectionStart();
AgcComboBox.getSelectionEnd()
,
AgcComboBox.select(int,int)
public int getSelectionEnd()
The following code fragment illustrates how to obtain the end of the currently selected text.
int end; end = Combobox1.getSelectionEnd();
AgcComboBox.getSelectionStart()
,
AgcComboBox.select(int,int)
public String getSelectedText()
The getSelectedText() method affects the textbox portion of the control only. For drop-down or combobox style controls, it does not affect the listbox portion.
The following code fragment illustrates how to obtain the currently selected text.
String s; s = Combobox1.getSelectedText();
AgcComboBox.getSelectionStart()
,
AgcComboBox.getSelectionEnd()
public void select(int start, int end)
start
- specifies the start of the text selection.end
- specifies the end of the text selection.The select() method can be useful to require a user to replace some invalid text.
AgcComboBox.selectAll()
,
Component.requestFocus()
,
AgcComboBox.getSelectionStart()
,
AgcComboBox.getSelectionEnd()
public void selectAll()
The following code fragment illustrates how to use the selectAll() method.
Combobox1.selectAll();
AgcComboBox.select(int,int)
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |