|
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.tview.TView | +--com.sssw.rt.form.AgcView | +--com.sssw.rt.form.AgcTreeControl
The AgcTreeControl (Tree) 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 tree. 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 items do not affect the underlying data; therefore, calling updateRows() is not allowed. If you call it for the control, updateRows() throws AgoUnsupportedOperationException.
AgoTreeControlNode
, Serialized FormInner classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
static int |
CHILD
Adds the node after the specified node. |
static int |
LAST
Adds the node as the last node at the level of the specified node. |
static int |
NEXT
Adds the node underneath the specified node. |
static int |
PREVIOUS
Adds the node above the specified node. |
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 | |
AgcTreeControl()
|
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 |
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. |
AgoFontIdentifier |
getFontIdentifier()
Get the font identifier. |
Color |
getForeground()
Get the text color. |
AgoNodeEnumerator |
getNodeSelection()
Get an enumeration object which encapsulates all the currently selected nodes in the view. |
AgoTreeControlNode |
getRootNode()
Returns the control's root node. |
AgoTreeControlNode |
getSelectedNode()
Returns the control's currently selected node. |
Object |
getValue()
Returns the control's value. |
void |
remove(AgoTreeControlNode node)
Removes a specified node from the control. |
void |
removeAll()
Remove all nodes from this control. |
void |
setBackground(Color color)
Set the background color of the tree control. |
void |
setCollapseExpandOnDoubleClick(boolean collapseexpand)
Set the collapse/expand on doubleclick property |
void |
setFontIdentifier(AgoFontIdentifier fontidentifier)
Assigns the SilverStream font object (AgoFontIdentifier) to the control's text. |
void |
setForeground(Color color)
Set the color of the tree control's text. |
void |
setNodeSelection(Vector nodes,
boolean generateEvents)
Selects one or more nodes in the tree control. |
void |
setSelectedNode(AgoTreeControlNode node)
Sets the selection to the specified node. |
void |
setValue(Object value)
Selects the row whose value is equal to the specified value. |
Methods inherited from class com.sssw.rt.form.AgcView |
clearSelection,
collapseNode,
expandNode,
getColumnValue,
getCursorBandName,
getMultiSelectType,
getRootRowCursor,
getRowSelection,
getSelectedColumnIndex,
getSelectedRowCursor,
getTopRowCursor,
initView,
setMultiSelectType,
setSelection,
sort,
sort |
Methods inherited from class com.sssw.rt.tview.TView |
getAgoViewFormat,
getSearchable,
reload,
scrollHome,
setAgoViewFormat,
setSearchable |
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 |
Field Detail |
public static final int CHILD
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
public static final int NEXT
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
public static final int PREVIOUS
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
public static final int LAST
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
Constructor Detail |
public AgcTreeControl()
Method Detail |
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.
For a list of possible values, see Field Summary.text
- specifies text to display at this node.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, AgcTreeControl.CHILD, "one"); ControlName1.add(node, AgcTreeControl.CHILD, "two"); // Add two more top-level nodes. ControlName1.add(null, 0, "B"); ControlName1.add(null, 0, "C");
AgcTreeControl.remove(AgoTreeControlNode)
,
AgcTreeControl.removeAll()
,
AgoTreeControlNode
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
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.
For a list of possible values, see Field Summary.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.AgcTreeControl.remove(AgoTreeControlNode)
,
AgcTreeControl.removeAll()
,
AgoTreeControlNode
,
AgcTreeControl.add(AgoTreeControlNode, int, String)
public void remove(AgoTreeControlNode node)
node
- the node to removeThe following code fragment illustrates how to remove a node.
AgoTreeControlNode nodeToRemove; nodeToRemove = ControlName1.findNode("customer1",null,true); ControlName1.removeNode(nodeToRemove);
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
,
AgcTreeControl.removeAll()
,
AgoTreeControlNode
public void removeAll()
The following code fragment illustrates how to remove all of the rows from the AgcChoice control.
ControlName1.removeAll();
AgcTreeControl.add(AgoTreeControlNode, int, String)
,
AgcTreeControl.add(AgoTreeControlNode, int, String, Object, Image)
,
AgcTreeControl.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.
The following code fragment illustrates how to obtain the root node.
AgoTreeControlNode root; root = ControlName1.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 = ControlName1.getSelectedNode();
AgcTreeControl.setSelectedNode(AgoTreeControlNode)
,
AgoTreeControlNode
public void setSelectedNode(AgoTreeControlNode node)
node
- specifies the node to selectThe following code fragment illustrates how to find a node and then select it.
AgoTreeControlNode node; node = ControlName1.findNode("customer1",null,true); ControlName1.setSelectedNode(node);
AgcTreeControl.getSelectedNode()
public AgoNodeEnumerator getNodeSelection()
The following code fragment illustrates how to get the list of selected nodes and loop through them.
AgoNodeEnumerator e = ControlName1.getNodeSelection(); AgoTreeControlNode node; while(e.hasMoreNodes()) { node = e.getNextNode(); System.out.println("Node " + node.getText() + " is selected."); }
public void setNodeSelection(Vector nodes, boolean generateEvents) throws AgoException
nodes
- a Vector containing the nodes you want to select.
The Vector elements are AgoTreeControlNode objects.generateEvents
- specifies whether each node selection should generate
valueChanged events or no events.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 = ControlName1.findNode("customer1",null,true); ControlName1expandNode(node);
AgcTreeControl.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 = ControlName1.findNode("customer1",null,true); ControlName1.collapseNode(node);
AgcTreeControl.expandNode(AgoTreeControlNode)
,
AgoTreeControlNode
public AgoTreeControlNode findNode(String text, Object userData, boolean recurse)
text
- specifies text to search foruserData
- specifies an Object to search for
The userData values are compared by the equals() method.recurse
- specifies whether to search for the text or userData recursivelyIf 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 nodes. 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 = ControlName1.findNode("Smith",null,true);
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.
AgoFontIdentifier.PLAIN AgoFontIdentifier.BOLD AgoFontIdentifier.ITALIC AgoFontIdentifier.BOLD + AgoFontIdentifier.ITALIC
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);
AgcTreeControl.getFontIdentifier()
,
Font Name property,
Font Size property,
Font Style propertypublic AgoFontIdentifier getFontIdentifier()
AgcTreeControl.setFontIdentifier(AgoFontIdentifier)
public void setForeground(Color color)
color
- the colorpublic void setBackground(Color color)
color
- the colorpublic Color getForeground()
color
- the colorpublic Object getValue()
Object value; value = ControlName1.getValue();
AgcTreeControl.setValue(Object)
public void setValue(Object value)
value
- specifies an internal value that specifies which row to selectAt design time the contents of the internal value can be set 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 set 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 value can be set using the Storage value property.
A control is loaded statically:
The displayed text values are: Apple, Banana, Orange
The internal values are: 1, 2, 3
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.
AgcTreeControl.getValue()
public void setCollapseExpandOnDoubleClick(boolean collapseexpand)
collapseexpand
- true sets the property, false unsets it
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |