borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.view 

TreeView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.ScrollPane
                           +----borland.jbcl.view.TreeView
                                   +----borland.jbcl.control.TreeControl

About the TreeView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements GraphView, MenuContainer, ImageObserver, Serializable

Implements GraphView, which defines the behavior required of components that use a graph model, for accessing data items that are stored in a tree structure.


TreeView variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in java.awt.ScrollPane

TreeView constructors

TreeView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.awt.ScrollPane

Properties implemented in java.lang.Object

TreeView methods

Methods implemented in this class

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.ScrollPane

Methods implemented in java.lang.Object

TreeView event listeners


TreeView variables

STYLE_ARROWS

  public static final int STYLE_ARROWS = 0x0002

STYLE_PLUSES

  public static final int STYLE_PLUSES = 0x0001

TreeView constructors

TreeView()

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


TreeView properties

HIndent

 public int getHIndent()
 public void setHIndent(int hIndent)

HSnap

 public boolean isHSnap()
 public void setHSnap(boolean hSnap)

alignment

 public int getAlignment()
 public void setAlignment(int alignment)

autoEdit

 public boolean isAutoEdit()
 public void setAutoEdit(boolean autoEdit)

background

 public void setBackground(java.awt.Color color)

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, or whatever - without triggering repaint messages.

boxSize

 public Dimension getBoxSize()
 public void setBoxSize(java.awt.Dimension boxSize)

coreComponent

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

directDraw

 public boolean isDirectDraw()
 public void setDirectDraw(boolean directDraw)

doubleBuffer

 public boolean isDoubleBuffer()
 public void setDoubleBuffer(boolean doubleBuffer)
The doubleBuffer property enables or disables the double-buffered screen painting built into the tree. The default is true, meaning that the tree paints all of the visible cells onto an off-screen image before blitting the image onto the screen (to prevent flicker). Setting doubleBuffer to false will disable this functionality, so that all ItemPainters will paint directly to the screen. This property is set to false when a user is placing a tree onto a Panel (or another container) that has its own double-buffering, or if the user really likes things that flicker.

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.

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.

editing

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

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.

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)

leftMargin

 public int getLeftMargin()
 public void setLeftMargin(int leftMargin)

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.

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.

showRoot

 public boolean isShowRoot()
 public void setShowRoot(boolean show)
The showRoot property specifies whether to show the top-level node of the tree.

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.

topMargin

 public int getTopMargin()
 public void setTopMargin(int topMargin)

vgap

 public int getVgap()
 public void setVgap(int vgap)

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()
Hook to open the DataSet supplying this tree control when the tree is displayed, if the DataSet's autoOpen property is set. Calls java.awt.Choice.html#addNotify() to create the ChoiceControl's peer, which allows changing the look of the tree without changing its functionality. Initializes the tree if not already initialized.
Overrides:
java.awt.Container.addNotify()

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.

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)

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.

Parameters:
location - The GraphLocation to check.
Returns:
True if the location is expanded, false if not.

refresh()

  public void refresh()

repaintNode(borland.jbcl.model.GraphLocation)

  public void repaintNode(borland.jbcl.model.GraphLocation location)

repaintNodes()

  public void repaintNodes()

requestFocus()

  public void requestFocus()
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.

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)

component

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

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener 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)

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)