borland Packages  Class Hierarchy  jbcl.view Package  Index 

TreeView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----com.sun.java.swing.JScrollPane
                                   +----borland.jbcl.view.TreeView
                                           +----borland.jbcl.control.TreeControl

About the TreeView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements GraphView, Accessible, ScrollPaneConstants, ImageObserver, MenuContainer, Serializable

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.


TreeView variables

Variables implemented in this class

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in com.sun.java.swing.JScrollPane

Variables implemented in java.awt.Component

TreeView constructors

TreeView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in com.sun.java.swing.JScrollPane

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

TreeView methods

Methods implemented in this class

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in com.sun.java.swing.JScrollPane

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

TreeView event listeners


TreeView variables

STYLE_ARROWS

  public static final int STYLE_ARROWS = 0x0002
A constant that specifies the style of the icons the user uses to expand and collapse the tree as inverted triangles or down arrows.

STYLE_PLUSES

  public static final int STYLE_PLUSES = 0x0001
A constant that specifies the style of the icons the user uses to expand and collapse the tree as minus and plus signs.

TreeView constructors

TreeView()

  public TreeView()
Constructs a TreeView with default property values.


TreeView properties

alignment

 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.

autoEdit

 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.

background

 public void setBackground(java.awt.Color color)
Sets the background color of the tree control.

batchMode

 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.

boxSize

 public Dimension getBoxSize()
 public void setBoxSize(java.awt.Dimension boxSize)
Determines the size of the box in which the tree is drawn.

coreComponent

 public Component getCoreComponent()
Returns the contained TreeCore (non-public) class instance as a Component.

dataToolTip

 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.

dragSubfocus

 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.

editing

 public boolean isEditing()
The editing property (read-only) returns true if an item is currently being edited in the tree.

editInPlace

 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.

editor

 public ItemEditor getEditor()
Returns the item editor being used or null if the tree is not being edited.

enabled

 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.

expandByDefault

 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.

font

 public void setFont(java.awt.Font font)
The font property specifies the font to use to show text items in the tree.

foreground

 public void setForeground(java.awt.Color color)
The foreground property specifies the color of the text, or other item, in the tree.

growEditor

 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.

HIndent

 public int getHIndent()
 public void setHIndent(int hIndent)
Determines the interval in pixels a child node is indented beneath a parent node.

HSnap

 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.

itemMargins

 public Insets getItemMargins()
 public void setItemMargins(java.awt.Insets margins)
The itemMargins property specifies the amount of space between the text and the edge of the field.

itemOffset

 public int getItemOffset()
 public void setItemOffset(int itemOffset)
Determines the amount of space in pixels between the node

leftMargin

 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.

model

 public GraphModel getModel()
 public void setModel(borland.jbcl.model.GraphModel model)
Determines the data model for the component. TreeView requires a GraphModel, such as LinkedTreeContainer.

opaque

 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.

postOnEndEdit

 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.

preferredSize

 public Dimension getPreferredSize()
The preferredSize property specifies the size that you would prefer layout managers to use for this field.

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean readOnly)
Determines whether the nodes of the tree can be edited by the user.

selection

 public WritableGraphSelection getSelection()
 public void setSelection(borland.jbcl.model.WritableGraphSelection selection)
Holds an array of the selected node or nodes.

showFocus

 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.

showRollover

 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.

snapOrigin

 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.

style

 public int getStyle()
 public void setStyle(int style)
Whether to show collapsed parent nodes as pluses or arrows (triangles).

subfocus

 public GraphLocation getSubfocus()
 public void setSubfocus(borland.jbcl.model.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.

texture

 public Image getTexture()
 public void setTexture(java.awt.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.

toolTipText

 public String getToolTipText()
 public void setToolTipText(java.lang.String text)
Determines the text that appears in the tool tip window. Specify the text as the value of the text parameter.

topMargin

 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.

vgap

 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.

viewManager

 public GraphViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.GraphViewManager viewManager)
Determines the view manager for a component built with this view.

writeModel

 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.


TreeView methods

addNotify()

  public void addNotify()
addNotify() opens the DataSet that populates the tree view when the tree is displayed if the DataSet's autoOpen property is set. It initializes the tree if it is not already initialized.

Overrides: java.awt.Container.addNotify()

checkParentWindow()

  public void checkParentWindow()

collapse(borland.jbcl.model.GraphLocation)

  public void collapse(borland.jbcl.model.GraphLocation location)
Collapses from view the children of the node specified by location.

collapseAll(borland.jbcl.model.GraphLocation)

  public void collapseAll(borland.jbcl.model.GraphLocation location)
Collapse a particular node and all of its children.

Parameters:

location
The GraphLocation to collapse.

createDefaultModel()

  protected GraphModel createDefaultModel()
Creates a BasicTreeContainer.

createDefaultSelection()

  protected WritableGraphSelection createDefaultSelection()
Creates a SingleGraphSelection.

createDefaultViewManager()

  protected GraphViewManager createDefaultViewManager()
Creates a BasicViewManager.

expand(borland.jbcl.model.GraphLocation)

  public void expand(borland.jbcl.model.GraphLocation location)
Expands into view the children of the node specified by location.

expandAll(borland.jbcl.model.GraphLocation)

  public void expandAll(borland.jbcl.model.GraphLocation location)
Expand a particular node and all of its children.

Parameters:

location
The GraphLocation to expand.

getNodeRect(borland.jbcl.model.GraphLocation)

  public Rectangle getNodeRect(borland.jbcl.model.GraphLocation node)
Returns the rectangle where the node is to be drawn.

hasFocus()

  public boolean hasFocus()

Overrides: com.sun.java.swing.JComponent.hasFocus() Determines whether the tree has the focus. If it returns true, the grid has the focus.

hitTest(int, int)

  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.

isExpanded(borland.jbcl.model.GraphLocation)

  public boolean isExpanded(borland.jbcl.model.GraphLocation location)
Check if a particular node is expanded. This method returns true if the location is expanded, false if not.

Parameters:

location
The GraphLocation to check.

refresh()

  public void refresh()
Repaints the tree hierarchy.

repaintNode(borland.jbcl.model.GraphLocation)

  public void repaintNode(borland.jbcl.model.GraphLocation location)
Repaints the specified node.

repaintNodes()

  public void repaintNodes()
Repaints the tree hierarchy only if the batchMode property is false.

requestFocus()

  public void requestFocus()
Requests the input focus. If the request succeeds, a FocusGained event is delivered.

Overrides: java.awt.Component.requestFocus()

startEdit(borland.jbcl.model.GraphLocation)

  public void startEdit(borland.jbcl.model.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
The GraphLocation to start the edit session at.

toggleExpanded(borland.jbcl.model.GraphLocation)

  public void toggleExpanded(borland.jbcl.model.GraphLocation location)
Toggle the state of a particular node.

Parameters:

location
The GraphLocation to toggle.

updateUI()

  public void updateUI()

Overrides: com.sun.java.swing.JScrollPane.updateUI() Updates the user interface of the view in preparation for painting.


TreeView event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public void removeContainerListener(java.awt.event.ContainerListener )

customItem

 public void addCustomItemListener(borland.jbcl.view.CustomItemListener l)
 public void removeCustomItemListener(borland.jbcl.view.CustomItemListener l)

focus

 public void addFocusListener(java.awt.event.FocusListener l)
 public void removeFocusListener(java.awt.event.FocusListener l)

key

 public void addKeyListener(java.awt.event.KeyListener l)
 public void removeKeyListener(java.awt.event.KeyListener l)

model

 public void addModelListener(borland.jbcl.model.GraphModelListener listener)
 public void removeModelListener(borland.jbcl.model.GraphModelListener listener)

mouse

 public void addMouseListener(java.awt.event.MouseListener l)
 public void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

selection

 public void addSelectionListener(borland.jbcl.model.GraphSelectionListener listener)
 public void removeSelectionListener(borland.jbcl.model.GraphSelectionListener listener)

subfocus

 public void addSubfocusListener(borland.jbcl.model.GraphSubfocusListener l)
 public void removeSubfocusListener(borland.jbcl.model.GraphSubfocusListener l)

tree

 public void addTreeListener(borland.jbcl.view.TreeListener l)
 public void removeTreeListener(borland.jbcl.view.TreeListener l)

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )