com.vaadin.client.ui
Class VTree

java.lang.Object
  extended by SimplePanel
      extended by com.vaadin.client.ui.SimpleFocusablePanel
          extended by com.vaadin.client.ui.FocusElementPanel
              extended by com.vaadin.client.ui.VTree
All Implemented Interfaces:
Focusable, ActionOwner, HandlesAriaCaption, VHasDropHandler, SubPartAware

public class VTree
extends FocusElementPanel
implements VHasDropHandler, SubPartAware, ActionOwner, HandlesAriaCaption


Nested Class Summary
 class VTree.TreeNode
           
 
Field Summary
 FlowPanel body
          For internal use only.
 java.lang.String[] bodyActionKeys
          For internal use only.
static java.lang.String CLASSNAME
           
 ApplicationConnection client
          For internal use only.
 TreeConnector connector
          For internal use only.
 boolean disabled
          For internal use only.
 int dragMode
          For internal use only.
 VTree.TreeNode focusedNode
          For internal use only.
 VLazyExecutor iconLoaded
           
 boolean immediate
          For internal use only.
 boolean isMultiselect
          For internal use only.
 boolean isNullSelectionAllowed
          For internal use only.
 VTree.TreeNode lastSelection
          For internal use only.
static com.vaadin.shared.ui.MultiSelectMode MULTISELECT_MODE_DEFAULT
          Deprecated. As of 7.0, use MultiSelectMode.DEFAULT instead.
static com.vaadin.shared.ui.MultiSelectMode MULTISELECT_MODE_SIMPLE
          Deprecated. As of 7.0, use MultiSelectMode.SIMPLE instead.
 com.vaadin.shared.ui.MultiSelectMode multiSelectMode
          For internal use only.
 java.lang.String paintableId
          For internal use only.
 boolean readonly
          For internal use only.
 boolean rendering
          For internal use only.
 boolean selectable
          For internal use only.
 java.util.Set<java.lang.String> selectedIds
          For internal use only.
 
Constructor Summary
VTree()
           
 
Method Summary
 void bindAriaCaption(com.google.gwt.user.client.Element captionElement)
          Called to bind the provided caption (label in HTML speak) element to the main input element of the Widget.
 void clearNodeToKeyMap()
           
 void deselectAll()
          Deselects all items in the tree
 java.lang.String getActionCaption(java.lang.String actionKey)
           
 java.lang.String getActionIcon(java.lang.String actionKey)
           
 Action[] getActions()
           
 ApplicationConnection getClient()
           
 VTree.TreeNode getCommonGrandParent(VTree.TreeNode node1, VTree.TreeNode node2)
          Returns the first common parent of two nodes
 VDropHandler getDropHandler()
           
protected  VTree.TreeNode getFirstRootNode()
          Returns the first root node of the tree or null if there are no root nodes.
protected  VTree.TreeNode getLastRootNode()
          Returns the last root node of the tree or null if there are no root nodes.
protected  int getNavigationDownKey()
          Get the key that moves the selection head downwards.
protected  int getNavigationEndKey()
          Get the key the moves the selection to the end of the table.
protected  int getNavigationLeftKey()
          Get the key that scrolls to the left in the table.
protected  int getNavigationPageDownKey()
          Get the key the moves the selection one page down in the table.
protected  int getNavigationPageUpKey()
          Get the key the moves the selection one page up in the table.
protected  int getNavigationRightKey()
          Get the key that scroll to the right on the table.
protected  int getNavigationSelectKey()
          Get the key that selects an item in the table.
protected  int getNavigationStartKey()
          Get the key the moves the selection to the beginning of the table.
protected  int getNavigationUpKey()
          Get the key that moves the selection head upwards.
 VTree.TreeNode getNodeByKey(java.lang.String key)
           
 java.lang.String getPaintableId()
           
protected  java.util.List<VTree.TreeNode> getRootNodes()
          Returns a list of all root nodes in the Tree in the order they appear in the tree.
 com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
          Locates an element inside a component using the identifier provided in subPart.
 java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
          Provides an identifier that identifies the element within the component.
protected  boolean handleKeyNavigation(int keycode, boolean ctrl, boolean shift)
          Handles the keyboard navigation
 boolean isSelected(VTree.TreeNode treeNode)
          Is a node selected in the tree
 void onBlur(BlurEvent event)
           
 void onBrowserEvent(Event event)
           
 void onFocus(FocusEvent event)
           
 void onKeyDown(KeyDownEvent event)
           
 void onKeyPress(KeyPressEvent event)
           
 void registerAction(java.lang.String key, java.lang.String caption, java.lang.String iconUrl)
           
 void registerNode(VTree.TreeNode treeNode)
           
 void setFocusedNode(VTree.TreeNode node)
          Focuses a node and scrolls it into view
 void setFocusedNode(VTree.TreeNode node, boolean scrollIntoView)
          Sets the node currently in focus
 void setSelected(VTree.TreeNode treeNode, boolean selected)
           
 void updateDropHandler(UIDL childUidl)
          For internal use only.
 
Methods inherited from class com.vaadin.client.ui.FocusElementPanel
getFocusElement, setFocus, setTabIndex, setWidget
 
Methods inherited from class com.vaadin.client.ui.SimpleFocusablePanel
addBlurHandler, addFocusHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, focus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME
See Also:
Constant Field Values

MULTISELECT_MODE_DEFAULT

@Deprecated
public static final com.vaadin.shared.ui.MultiSelectMode MULTISELECT_MODE_DEFAULT
Deprecated. As of 7.0, use MultiSelectMode.DEFAULT instead.

MULTISELECT_MODE_SIMPLE

@Deprecated
public static final com.vaadin.shared.ui.MultiSelectMode MULTISELECT_MODE_SIMPLE
Deprecated. As of 7.0, use MultiSelectMode.SIMPLE instead.

body

public final FlowPanel body
For internal use only. May be removed or replaced in the future.


selectedIds

public java.util.Set<java.lang.String> selectedIds
For internal use only. May be removed or replaced in the future.


client

public ApplicationConnection client
For internal use only. May be removed or replaced in the future.


paintableId

public java.lang.String paintableId
For internal use only. May be removed or replaced in the future.


selectable

public boolean selectable
For internal use only. May be removed or replaced in the future.


isMultiselect

public boolean isMultiselect
For internal use only. May be removed or replaced in the future.


lastSelection

public VTree.TreeNode lastSelection
For internal use only. May be removed or replaced in the future.


focusedNode

public VTree.TreeNode focusedNode
For internal use only. May be removed or replaced in the future.


multiSelectMode

public com.vaadin.shared.ui.MultiSelectMode multiSelectMode
For internal use only. May be removed or replaced in the future.


immediate

public boolean immediate
For internal use only. May be removed or replaced in the future.


isNullSelectionAllowed

public boolean isNullSelectionAllowed
For internal use only. May be removed or replaced in the future.


disabled

public boolean disabled
For internal use only. May be removed or replaced in the future.


readonly

public boolean readonly
For internal use only. May be removed or replaced in the future.


rendering

public boolean rendering
For internal use only. May be removed or replaced in the future.


dragMode

public int dragMode
For internal use only. May be removed or replaced in the future.


bodyActionKeys

public java.lang.String[] bodyActionKeys
For internal use only. May be removed or replaced in the future.


connector

public TreeConnector connector
For internal use only. May be removed or replaced in the future.


iconLoaded

public VLazyExecutor iconLoaded
Constructor Detail

VTree

public VTree()
Method Detail

onBrowserEvent

public void onBrowserEvent(Event event)

getActionCaption

public java.lang.String getActionCaption(java.lang.String actionKey)

getActionIcon

public java.lang.String getActionIcon(java.lang.String actionKey)

getFirstRootNode

protected VTree.TreeNode getFirstRootNode()
Returns the first root node of the tree or null if there are no root nodes.

Returns:
The first root VTree.TreeNode

getLastRootNode

protected VTree.TreeNode getLastRootNode()
Returns the last root node of the tree or null if there are no root nodes.

Returns:
The last root VTree.TreeNode

getRootNodes

protected java.util.List<VTree.TreeNode> getRootNodes()
Returns a list of all root nodes in the Tree in the order they appear in the tree.

Returns:
A list of all root VTree.TreeNodes.

updateDropHandler

public void updateDropHandler(UIDL childUidl)
For internal use only. May be removed or replaced in the future.


setSelected

public void setSelected(VTree.TreeNode treeNode,
                        boolean selected)

isSelected

public boolean isSelected(VTree.TreeNode treeNode)
Is a node selected in the tree

Parameters:
treeNode - The node to check
Returns:

getDropHandler

public VDropHandler getDropHandler()
Specified by:
getDropHandler in interface VHasDropHandler

getNodeByKey

public VTree.TreeNode getNodeByKey(java.lang.String key)

deselectAll

public void deselectAll()
Deselects all items in the tree


getCommonGrandParent

public VTree.TreeNode getCommonGrandParent(VTree.TreeNode node1,
                                           VTree.TreeNode node2)
Returns the first common parent of two nodes

Parameters:
node1 - The first node
node2 - The second node
Returns:
The common parent or null

setFocusedNode

public void setFocusedNode(VTree.TreeNode node,
                           boolean scrollIntoView)
Sets the node currently in focus

Parameters:
node - The node to focus or null to remove the focus completely
scrollIntoView - Scroll the node into view

setFocusedNode

public void setFocusedNode(VTree.TreeNode node)
Focuses a node and scrolls it into view

Parameters:
node - The node to focus

onFocus

public void onFocus(FocusEvent event)

onBlur

public void onBlur(BlurEvent event)

onKeyPress

public void onKeyPress(KeyPressEvent event)

onKeyDown

public void onKeyDown(KeyDownEvent event)

handleKeyNavigation

protected boolean handleKeyNavigation(int keycode,
                                      boolean ctrl,
                                      boolean shift)
Handles the keyboard navigation

Parameters:
keycode - The keycode of the pressed key
ctrl - Was ctrl pressed
shift - Was shift pressed
Returns:
Returns true if the key was handled, else false

getNavigationUpKey

protected int getNavigationUpKey()
Get the key that moves the selection head upwards. By default it is the up arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationDownKey

protected int getNavigationDownKey()
Get the key that moves the selection head downwards. By default it is the down arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationLeftKey

protected int getNavigationLeftKey()
Get the key that scrolls to the left in the table. By default it is the left arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationRightKey

protected int getNavigationRightKey()
Get the key that scroll to the right on the table. By default it is the right arrow key but by overriding this you can change the key to whatever you want.

Returns:
The keycode of the key

getNavigationSelectKey

protected int getNavigationSelectKey()
Get the key that selects an item in the table. By default it is the space bar key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationPageUpKey

protected int getNavigationPageUpKey()
Get the key the moves the selection one page up in the table. By default this is the Page Up key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationPageDownKey

protected int getNavigationPageDownKey()
Get the key the moves the selection one page down in the table. By default this is the Page Down key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationStartKey

protected int getNavigationStartKey()
Get the key the moves the selection to the beginning of the table. By default this is the Home key but by overriding this you can change the key to whatever you want.

Returns:

getNavigationEndKey

protected int getNavigationEndKey()
Get the key the moves the selection to the end of the table. By default this is the End key but by overriding this you can change the key to whatever you want.

Returns:

getSubPartElement

public com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
Description copied from interface: SubPartAware
Locates an element inside a component using the identifier provided in subPart. The subPart identifier is component specific and may be any string of characters, numbers, space characters and brackets.

Specified by:
getSubPartElement in interface SubPartAware
Parameters:
subPart - The identifier for the element inside the component
Returns:
The element identified by subPart or null if the element could not be found.

getSubPartName

public java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
Description copied from interface: SubPartAware
Provides an identifier that identifies the element within the component. The subElement is a part of the component and must never be null.

Note! getSubPartElement(getSubPartName(element)) == element is not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions with subElement are the same as interactions with the element identified by the return value. For example a button can return an identifier for the root element even though a DIV inside the button was passed as subElement because interactions with the DIV and the root button element produce the same result.

Specified by:
getSubPartName in interface SubPartAware
Parameters:
subElement - The element the identifier string should uniquely identify
Returns:
An identifier that uniquely identifies subElement or null if no identifier could be provided.

getActions

public Action[] getActions()
Specified by:
getActions in interface ActionOwner
Returns:
Array of IActions

getClient

public ApplicationConnection getClient()
Specified by:
getClient in interface ActionOwner

getPaintableId

public java.lang.String getPaintableId()
Specified by:
getPaintableId in interface ActionOwner

registerAction

public void registerAction(java.lang.String key,
                           java.lang.String caption,
                           java.lang.String iconUrl)

registerNode

public void registerNode(VTree.TreeNode treeNode)

clearNodeToKeyMap

public void clearNodeToKeyMap()

bindAriaCaption

public void bindAriaCaption(com.google.gwt.user.client.Element captionElement)
Description copied from interface: HandlesAriaCaption
Called to bind the provided caption (label in HTML speak) element to the main input element of the Widget. Binding should be removed from the main input field when captionElement is null.

Specified by:
bindAriaCaption in interface HandlesAriaCaption
Parameters:
captionElement - Element of the caption


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.