jbcl.view Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.JScrollPane +----com.borland.jbcl.view.TreeView +----com.borland.jbcl.control.TreeControl
Variables Constructors Properties Methods Event Listeners
Implements GraphView, ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants
TreeView
provides the behavior required for controls that display data in a tree structure such as a TreeControl
.
The style
property lets you select from a list of platform-specific display styles. The value of the expandByDefault
property determines whether the tree is expanded when it first appears. hIndent
determines the number of pixels a child node is indented beneath a parent node. Properties such as hIndent
, itemMargins
, itemOffset
, and vgap
, leftMargin
, and topMargin
determine the spacing used among elements of the tree hierarchy and the box in which it is displayed. snapOrigin
and hSnap
affect the scrolling behavior of the tree. readOnly
determines whether a node can be edited. editInPlace
determines whether the user can edit the node within the tree, and autoEdit
determines if typing on a selected node begins the editing of that node.
public static final int STYLE_ARROWS = 0x0002A constant that specifies the style of the icons the user uses to expand and collapse the tree as inverted triangles or down arrows.
public static final int STYLE_PLUSES = 0x0001A constant that specifies the style of the icons the user uses to expand and collapse the tree as minus and plus signs.
public TreeView()Constructs a
TreeView
with default property values.
public int getAlignment() public void setAlignment(int alignment)Determines the alignment of the tree control: left, center, or right.
alignment
is not available at design time.
public boolean isAutoEdit() public void setAutoEdit(boolean autoEdit)Determines whether editing begins automatically whenever the user selects a node and begins typing. If
autoEdit
is true, editing begins as soon as a key is typed.
public void setBackground(Color color)Sets the background color of the tree control.
public boolean isBatchMode() public void setBatchMode(boolean batchMode)The
batchMode
property enables/disables all painting in the tree. This is used for programmatic mass updates to the tree's model, selection, and so on but does not trigger repaint messages.
public Dimension getBoxSize() public void setBoxSize(Dimension boxSize)Determines the size of the box that indicates if the node is expanded or collapsed. (The box contains a plus sign if the tree is expanded; a minus sign if it is collapsed.)
public Component getCoreComponent()Returns the contained
TreeCore
(non-public) class instance as a Component
.
public boolean isDataToolTip() public void setDataToolTip(boolean dataToolTip)The
dataToolTip
property enables/disables the automatic tooltip mechanism to display the contents of the model (as text) in a tooltip window when the mouse is floating over the field. By default, this property is false. If dataToolTip
is set to true, the text stored in the toolTipText
property is discarded.
public boolean isDoubleBuffer() public void setDoubleBuffer(boolean buffer)This property has been deprecated. Use
isdoubleBuffered
.
public boolean isDragSubfocus() public void setDragSubfocus(boolean drag)The
dragSubfocus
property enables or disables dragging of the subfocus cell when dragging the mouse pointer over the tree (with the mouse button pressed). By default, this property is true.
public boolean isEditing()The
editing
property (read-only) returns true if an item is currently being edited in the tree.
public boolean isEditInPlace() public void setEditInPlace(boolean editInPlace)The
editInPlace
property enables or disables item editing in the tree. By default, this property is true, meaning that a user can edit the value. If set to false, the field data cannot by modified by the user; the data can only be changed through programmatic access to the tree's model.
public ItemEditor getEditor()Returns the item editor being used or null if the tree is not being edited.
public void setEnabled(boolean enabled)Determines whether the tree view is enabled so that it can be used. If
enabled
is true, the view is enabled. If it is false, the view cannot become active.
public boolean isExpandByDefault() public void setExpandByDefault(boolean expand)The
expandByDefault
property specifies whether the tree component built with this view displays with all nodes expanded when it is first initialized. The default value is false.
public void setFont(Font font)The
font
property specifies the font to use to show text items in the tree.
public void setForeground(Color color)The
foreground
property specifies the color of the text, or other item, in the tree.
public boolean isGrowEditor() public void setGrowEditor(boolean growEditor)The
growEditor
property enables/disables the automatic sizing of a cell's item editor. In some look and feel settings, the item editors must grow vertically to properly edit the data. By default, this property is set to true.
public int getHIndent() public void setHIndent(int hIndent)Determines the interval in pixels a child node is indented beneath a parent node.
public boolean isHSnap() public void setHSnap(boolean hSnap)Determines whether the tree control scrolls automatically when the subfocus moves to an item that is originally out of view. If
hSnap
is true, the tree control scrolls automatically.
public Insets getItemMargins() public void setItemMargins(Insets margins)The
itemMargins
property specifies the amount of space between the text and the edge of the field.
public int getItemOffset() public void setItemOffset(int itemOffset)Determines the amount of space in pixels between the node
public int getLeftMargin() public void setLeftMargin(int leftMargin)Determines the distance in pixels from the edge of the tree control hierarchy to the left edge of the box in which the tree control displays.
public Dimension getMinimumSize()Returns the minimize size of the tree view.
public GraphModel getModel() public void setModel(GraphModel model)Determines the data model for the component.
TreeView
requires a GraphModel
, such as LinkedTreeContainer
.
public boolean isOpaque() public void setOpaque(boolean opaque)The
opaque
property controls the whether objects the grid covers show through. If opaque
is true, the grid is opaque and all objects it covers are not visible. The default value is true.
If a texture
value is set, the opaque
property is automatically set to true.
public boolean isPostOnEndEdit() public void setPostOnEndEdit(boolean post)The
postOnEndEdit
property specifies whether a pending edit on the data provided by the model should be saved or discarded when the edit is ended. This can happen, for example, when calling setModel()
when an edit is in progress. When postOnEndEdit
is true, changes are saved. When false, changes are discarded. The value of postOnEndEdit
defaults to true.
public Dimension getPreferredSize()The
preferredSize
property specifies the size that you would prefer layout managers to use for this field.
public boolean isReadOnly() public void setReadOnly(boolean readOnly)Determines whether the nodes of the tree can be edited by the user.
public Point getScrollPosition() public void setScrollPosition(Point p)This property has been deprecated. Use
getViewport()
and
setViewPort()
.
public WritableGraphSelection getSelection() public void setSelection(WritableGraphSelection selection)Holds an array of the selected node or nodes.
public boolean isShowFocus() public void setShowFocus(boolean show)The
showFocus
property enables or disables the painting of the focus rectangle on the items in the tree. Specifically, the showFocus
property turns on or off the FOCUSED bit in the state information that is passed to the ItemPainter
when the tree is painted. If an ItemPainter
ignores the FOCUSED bit, this property will have no effect. By default, showFocus
is true.
public boolean isShowRollover() public void setShowRollover(boolean showRollover)This property enables or disables the repainting of the rollover item. The rollover item is the item that currently has the mouse floating over it. If an
ItemPainter
plugged into the tree ignores the ROLLOVER bit, this property will have no effect. By default, showRollover is false.
public boolean isSnapOrigin() public void setSnapOrigin(boolean snapOrigin)The
snapOrigin
property controls whether or not the tree will automatically snap the scroll position to align the top item with the top edge of the tree. If set to false, the tree will not snap the scroll position, and it will scroll smoothly with changes to the subfocus item. By default, this property is true.
public int getStyle() public void setStyle(int style)Whether to show collapsed parent nodes as pluses or arrows (triangles).
public GraphLocation getSubfocus() public void setSubfocus(GraphLocation subfocus)The
subfocus
property defines the current node (defined by a GraphLocation
) in the tree. This is the node that is receiving keyboard input.
public Image getTexture() public void setTexture(Image texture)When an
Image
is specified as a texture
value, the Image
is tiled repeatedly as the background of the tree hierarchy so that the it appears the tree background has a texture.
public String getToolTipText() public void setToolTipText(String text)Determines the text that appears in the tool tip window. Specify the text as the value of the
text
parameter.
public int getTopMargin() public void setTopMargin(int topMargin)Determines the distance in pixels the top of the tree hierarchy is from the top of the box in which the tree hierarchy appears.
public int getVgap() public void setVgap(int vgap)Determines the vertical distance in pixels between one item in the tree hierarchy and the next item.
public GraphViewManager getViewManager() public void setViewManager(GraphViewManager viewManager)Determines the view manager for a component built with this view.
public Dimension getViewportSize()This property has been deprecated. Use
getViewport()
.
public WritableGraphModel getWriteModel()A read-only property that returns the writable model object attached to this tree component, if the model object exists. If no writable model exists, this method returns null.
public void addNotify()
addNotify()
initializes the tree if it is not already initialized.
Overrides: java.awt.Container.addNotify()
public void checkParentWindow()
public void collapse(GraphLocation location)Collapses from view the children of the node specified by
location
.
public void collapseAll(GraphLocation location)Collapse a particular node and all of its children.
Parameters:
location
protected GraphModel createDefaultModel()Creates a
BasicTreeContainer
.
protected WritableGraphSelection createDefaultSelection()Creates a
SingleGraphSelection
.
protected GraphViewManager createDefaultViewManager()Creates a
BasicViewManager
.
public void endEdit()Ends the current edit session if one exists. If the value has been modified, it is posted if
postOnEndEdit
is set to true (the default). If postOnEndEdit
is false, the edit session terminates without saving the changes to the cell value.
public void endEdit(boolean post)Ends the current edit session if one exists. If the value has been modified, it is posted if the
post
parameter is set to true. If post
is false, the edit session terminates without saving the changes to the cell value.
public void expand(GraphLocation location)Expands into view the children of the node specified by
location
.
public void expandAll(GraphLocation location)Expand a particular node and all of its children.
Parameters:
location
public Rectangle getNodeRect(GraphLocation node)Returns the rectangle where the node is to be drawn.
public boolean hasFocus()
Overrides: javax.swing.JComponent.hasFocus() Determines whether the tree has the focus. If it returns true, the grid has the focus.
public GraphLocation hitTest(int xPos, int yPos)Returns the address (
GraphLocation
) of the node at the coordinates specified. Coordinates are relative to the entire
scrollable region inside of the TreeView
.
public boolean isExpanded(GraphLocation location)Check if a particular node is expanded. This method returns true if the location is expanded, false if not.
Parameters:
location
public void refresh()Repaints the tree hierarchy.
public void repaintNode(GraphLocation location)Repaints the specified node.
public void repaintNodes()Repaints the tree hierarchy only if the
batchMode
property is false.
public void requestFocus()Requests the input focus. If the request succeeds, a FocusGained event is delivered.
Overrides: java.awt.Component.requestFocus()
public void safeEndEdit()Ends the current edit session if one exists, catching any exceptions. If the value has been modified, it is posted if
postOnEndEdit
is set to true (the default). If postOnEndEdit
is false, the edit session terminates without saving the changes to the cell value.
public void safeEndEdit(boolean post)Ends the current edit session if one exists, catching any exceptions. If the value has been modified, it is posted if the
post
parameter is set to true. If post
is false, the edit session terminates without saving the changes to the cell value.
public void setScrollPosition(int x, int y)This method has been deprecated. Use
setViewport()
.
public void startEdit(GraphLocation node)Starts an edit session at 'node'. If
editInPlace
is false or if readOnly
is true, this method is a no-op.
Parameters:
node
public void toggleExpanded(GraphLocation location)Toggle the state of a particular node.
Parameters:
location
public void updateUI()Updates the user interface of the view in preparation for painting.
Overrides: javax.swing.JScrollPane.updateUI()
public void addActionListener(ActionListener l) public void removeActionListener(ActionListener l)
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public void addCustomItemListener(CustomItemListener l) public void removeCustomItemListener(CustomItemListener l)
public void addFocusListener(FocusListener l) public void removeFocusListener(FocusListener l)
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public void addKeyListener(KeyListener l) public void removeKeyListener(KeyListener l)
public void addModelListener(GraphModelListener listener) public void removeModelListener(GraphModelListener listener)
public void addMouseListener(MouseListener l) public void removeMouseListener(MouseListener l)
public void addMouseMotionListener(MouseMotionListener l) public void removeMouseMotionListener(MouseMotionListener l)
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public void addSelectionListener(GraphSelectionListener listener) public void removeSelectionListener(GraphSelectionListener listener)
public void addSubfocusListener(GraphSubfocusListener l) public void removeSubfocusListener(GraphSubfocusListener l)
public void addTreeListener(TreeListener l) public void removeTreeListener(TreeListener l)
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )