com.vaadin.ui.
Class Tree
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.AbstractSelect
com.vaadin.ui.Tree
All Implemented Interfaces:
Buffered, BufferedValidatable, Container, Container.Hierarchical, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Viewer, Property, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.Container, Action.ShortcutNotifier, DragSource, DropTarget, ItemClickEvent.ItemClickNotifier, ItemClickEvent.ItemClickSource, MethodEventSource, Paintable, Sizeable, VariableOwner, Component, Component.Focusable, Field, Serializable, EventListener
- extends AbstractSelect
- implements Container.Hierarchical, Action.Container, ItemClickEvent.ItemClickSource, ItemClickEvent.ItemClickNotifier, DragSource, DropTarget
public class Tree
Tree component. A Tree can be used to select an item (or multiple items) from a hierarchical set of items.
Since:
3.0
Version:
6.8.18
Author:
Vaadin Ltd.
See Also:
Nested Class Summary | |
---|---|
static class |
Tree.CollapseEvent
Collapse event |
static interface |
Tree.CollapseListener
Collapse event listener. |
static class |
Tree.ExpandEvent
Event to fired when a node is expanded. |
static interface |
Tree.ExpandListener
Expand event listener. |
static interface |
Tree.ItemStyleGenerator
ItemStyleGenerator can be used to add custom styles to tree items. |
class |
Tree.TargetInSubtree
An accept criterion that checks the parent node (or parent hierarchy) for the item identifier given in constructor. |
static class |
Tree.TargetItemAllowsChildren
A criterion that accepts Transferable only directly on a tree
node that can have children. |
static class |
Tree.TreeDragMode
Supported drag modes for Tree. |
static class |
Tree.TreeDropCriterion
Lazy loading accept criterion for Tree. |
class |
Tree.TreeTargetDetails
A TargetDetails implementation with Tree specific api. |
protected class |
Tree.TreeTransferable
Concrete implementation of DataBoundTransferable for data
transferred from a tree. |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
---|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
---|
Field.ValueChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
---|
Buffered.SourceException |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Field Summary |
---|
Fields inherited from class com.vaadin.ui.AbstractSelect |
---|
ITEM_CAPTION_MODE_EXPLICIT, ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID, ITEM_CAPTION_MODE_ICON_ONLY, ITEM_CAPTION_MODE_ID, ITEM_CAPTION_MODE_INDEX, ITEM_CAPTION_MODE_ITEM, ITEM_CAPTION_MODE_PROPERTY, itemIdMapper, items |
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
Tree()
Creates a new empty tree. |
|
Tree(String caption)
Creates a new empty tree with caption. |
|
Tree(String caption,
Container dataSource)
Creates a new tree with caption and connect it to a Container. |
Method Summary | |
---|---|
void |
addActionHandler(Action.Handler actionHandler)
Adds an action handler. |
void |
addListener(ItemClickEvent.ItemClickListener listener)
Register a listener to handle ItemClickEvent s. |
void |
addListener(Tree.CollapseListener listener)
Adds the collapse listener. |
void |
addListener(Tree.ExpandListener listener)
Adds the expand listener. |
boolean |
areChildrenAllowed(Object itemId)
Tests if the Item with given ID can have any children. |
void |
changeVariables(Object source,
Map<String,Object> variables)
Invoked when the value of a variable has changed. |
boolean |
collapseItem(Object itemId)
Collapses an item. |
boolean |
collapseItemsRecursively(Object startItemId)
Collapses the items recursively. |
boolean |
expandItem(Object itemId)
Expands an item. |
boolean |
expandItemsRecursively(Object startItemId)
Expands the items recursively Expands all the children recursively starting from an item. |
protected void |
fireCollapseEvent(Object itemId)
Emits collapse event. |
protected void |
fireExpandEvent(Object itemId)
Emits the expand event. |
Collection<?> |
getChildren(Object itemId)
Gets the IDs of all Items that are children of the specified Item. |
Tree.TreeDragMode |
getDragMode()
|
DropHandler |
getDropHandler()
|
AbstractSelect.ItemDescriptionGenerator |
getItemDescriptionGenerator()
Get the item description generator which generates tooltips for tree items |
Tree.ItemStyleGenerator |
getItemStyleGenerator()
|
AbstractSelect.MultiSelectMode |
getMultiselectMode()
Returns the mode the multiselect is in. |
Object |
getParent(Object itemId)
Gets the ID of the parent Item of the specified Item. |
Transferable |
getTransferable(Map<String,Object> payload)
DragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it. |
Collection<?> |
getVisibleItemIds()
Gets the visible item ids. |
boolean |
hasChildren(Object itemId)
Tests if the Item specified with itemId has child Items. |
boolean |
isExpanded(Object itemId)
Check is an item is expanded |
boolean |
isRoot(Object itemId)
Tests if the Item specified with itemId is a root Item. |
boolean |
isSelectable()
Returns the current selectable state. |
void |
paintContent(PaintTarget target)
Paints any needed component-specific things to the given UIDL stream. |
void |
removeActionHandler(Action.Handler actionHandler)
Removes an action handler. |
void |
removeAllActionHandlers()
Removes all action handlers |
boolean |
removeItem(Object itemId)
Removes the Item identified by ItemId from the Container. |
void |
removeListener(ItemClickEvent.ItemClickListener listener)
Removes an ItemClickListener. |
void |
removeListener(Tree.CollapseListener listener)
Removes the collapse listener. |
void |
removeListener(Tree.ExpandListener listener)
Removes the expand listener. |
void |
requestRepaint()
Requests that the paintable should be repainted as soon as possible. |
Collection<?> |
rootItemIds()
Gets the IDs of all Items in the container that don't have a parent. |
boolean |
setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
Sets the given Item's capability to have children. |
void |
setContainerDataSource(Container newDataSource)
Sets the Container that serves as the data source of the viewer. |
void |
setDragMode(Tree.TreeDragMode dragMode)
Sets the drag mode that controls how Tree behaves as a DragSource
. |
void |
setDropHandler(DropHandler dropHandler)
|
void |
setItemDescriptionGenerator(AbstractSelect.ItemDescriptionGenerator generator)
Set the item description generator which generates tooltips for the tree items |
void |
setItemStyleGenerator(Tree.ItemStyleGenerator itemStyleGenerator)
Sets the Tree.ItemStyleGenerator to be used with this tree. |
void |
setLazyLoading(boolean useLazyLoading)
Tree does not support lazy options loading mode. |
void |
setMultiselectMode(AbstractSelect.MultiSelectMode mode)
Sets the behavior of the multiselect mode |
void |
setNewItemsAllowed(boolean allowNewOptions)
Adding new items is not supported. |
void |
setNullSelectionItemId(Object nullSelectionItemId)
Tree does not support setNullSelectionItemId . |
boolean |
setParent(Object itemId,
Object newParentId)
Sets the parent of an Item. |
void |
setSelectable(boolean selectable)
Sets the selectable state. |
Tree.TreeTargetDetails |
translateDropTargetDetails(Map<String,Object> clientVariables)
Called before the DragAndDropEvent is passed to
DropHandler . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Container |
---|
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, size |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.terminal.Paintable |
---|
addListener, getDebugId, paint, removeListener, requestRepaintRequests, setDebugId |
Methods inherited from interface com.vaadin.terminal.VariableOwner |
---|
isImmediate |
Methods inherited from interface com.vaadin.terminal.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidth, setWidthUnits |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.terminal.Paintable |
---|
addListener, getDebugId, paint, removeListener, requestRepaintRequests, setDebugId |
Methods inherited from interface com.vaadin.terminal.VariableOwner |
---|
isImmediate |
Methods inherited from interface com.vaadin.terminal.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidth, setWidthUnits |
Methods inherited from interface com.vaadin.ui.Field |
---|
getDescription, setCaption, setDescription |
Constructor Detail |
---|
Tree
public Tree()
Creates a new empty tree.
Tree
public Tree(String caption)
- Parameters:
caption
-
Creates a new empty tree with caption.
Tree
public Tree(String caption,
Container dataSource)
- Parameters:
caption
-dataSource
-
Creates a new tree with caption and connect it to a Container.
Method Detail |
---|
isExpanded
public boolean isExpanded(Object itemId)
- Parameters:
itemId
- the item id.- Returns:
- true iff the item is expanded.
Check is an item is expanded
expandItem
public boolean expandItem(Object itemId)
- Parameters:
itemId
- the item id.- Returns:
- True iff the expand operation succeeded
Expands an item.
requestRepaint
public void requestRepaint()
- Specified by:
requestRepaint
in interfacePaintable
- Overrides:
requestRepaint
in classAbstractComponent
Description copied from interface: Paintable
Requests that the paintable should be repainted as soon as possible.
expandItemsRecursively
public boolean expandItemsRecursively(Object startItemId)
- Parameters:
startItemId
-- Returns:
- True iff the expand operation succeeded
Expands the items recursively Expands all the children recursively starting from an item. Operation succeeds only if all expandable items are expanded.
collapseItem
public boolean collapseItem(Object itemId)
- Parameters:
itemId
- the item id.- Returns:
- True iff the collapse operation succeeded
Collapses an item.
collapseItemsRecursively
public boolean collapseItemsRecursively(Object startItemId)
- Parameters:
startItemId
-- Returns:
- True iff the collapse operation succeeded
Collapses the items recursively. Collapse all the children recursively starting from an item. Operation succeeds only if all expandable items are collapsed.
isSelectable
public boolean isSelectable()
- Returns:
- the current selectable state.
Returns the current selectable state. Selectable determines if the a node
can be selected on the client side. Selectable does not affect
AbstractSelect.setValue(Object)
or AbstractSelect.select(Object)
.
The tree is selectable by default.
setSelectable
public void setSelectable(boolean selectable)
- Parameters:
selectable
- The new selectable state.
Sets the selectable state. Selectable determines if the a node can be
selected on the client side. Selectable does not affect
AbstractSelect.setValue(Object)
or AbstractSelect.select(Object)
.
The tree is selectable by default.
setMultiselectMode
public void setMultiselectMode(AbstractSelect.MultiSelectMode mode)
- Parameters:
mode
- The mode to set
Sets the behavior of the multiselect mode
getMultiselectMode
public AbstractSelect.MultiSelectMode getMultiselectMode()
- Returns:
- The mode
Returns the mode the multiselect is in. The mode controls how multiselection can be done.
changeVariables
public void changeVariables(Object source,
Map<String,Object> variables)
- Specified by:
changeVariables
in interfaceVariableOwner
- Overrides:
changeVariables
in classAbstractSelect
- Parameters:
source
- the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.- See Also:
AbstractComponent.changeVariables(java.lang.Object, java.util.Map)
Description copied from class: AbstractSelect
Invoked when the value of a variable has changed.
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Overrides:
paintContent
in classAbstractSelect
- Parameters:
target
- the Paint Event.- Throws:
PaintException
- if the paint operation failed.- See Also:
AbstractComponent.paintContent(PaintTarget)
Paints any needed component-specific things to the given UIDL stream.
areChildrenAllowed
public boolean areChildrenAllowed(Object itemId)
- Specified by:
areChildrenAllowed
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item in the container whose child capability is to be tested- Returns:
true
if the specified Item exists in the Container and it can have children,false
if it's not found from the container or it can't have children.- See Also:
Container.Hierarchical.areChildrenAllowed(Object)
Tests if the Item with given ID can have any children.
getChildren
public Collection<?> getChildren(Object itemId)
- Specified by:
getChildren
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item whose children the caller is interested in- Returns:
- An unmodifiable
collection
containing the IDs of all other Items that are children in the container hierarchy - See Also:
Container.Hierarchical.getChildren(Object)
Gets the IDs of all Items that are children of the specified Item.
getParent
public Object getParent(Object itemId)
- Specified by:
getParent
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item whose parent the caller wishes to find out.- Returns:
- the ID of the parent Item. Will be
null
if the specified Item is a root element. - See Also:
Container.Hierarchical.getParent(Object)
Gets the ID of the parent Item of the specified Item.
hasChildren
public boolean hasChildren(Object itemId)
- Specified by:
hasChildren
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item to be tested- Returns:
true
if the specified Item has children,false
if not (is a leaf)- See Also:
Container.Hierarchical.hasChildren(Object)
Tests if the Item specified with itemId
has child Items.
isRoot
public boolean isRoot(Object itemId)
- Specified by:
isRoot
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item whose root status is to be tested- Returns:
true
if the specified Item is a root,false
if not- See Also:
Container.Hierarchical.isRoot(Object)
Tests if the Item specified with itemId
is a root Item.
rootItemIds
public Collection<?> rootItemIds()
- Specified by:
rootItemIds
in interfaceContainer.Hierarchical
- Returns:
- An unmodifiable
collection
containing IDs of all root elements of the container - See Also:
Container.Hierarchical.rootItemIds()
Gets the IDs of all Items in the container that don't have a parent.
setChildrenAllowed
public boolean setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
- Specified by:
setChildrenAllowed
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the Item in the container whose child capability is to be setareChildrenAllowed
- boolean value specifying if the Item can have children or not- Returns:
true
if the operation succeeded,false
if not- See Also:
Container.Hierarchical.setChildrenAllowed(Object, boolean)
Sets the given Item's capability to have children.
setParent
public boolean setParent(Object itemId,
Object newParentId)
- Specified by:
setParent
in interfaceContainer.Hierarchical
- Parameters:
itemId
- ID of the item to be set as the child of the Item identified withnewParentId
newParentId
- ID of the Item that's to be the new parent of the Item identified withitemId
- Returns:
true
if the operation succeeded,false
if not
Description copied from interface: Container.Hierarchical
Sets the parent of an Item. The new parent item must exist and be
able to have children. (
). It is
also possible to detach a node from the hierarchy (and thus make it
root) by setting the parent Container.Hierarchical.areChildrenAllowed(Object)
== truenull
.
This operation is optional.
setContainerDataSource
public void setContainerDataSource(Container newDataSource)
- Specified by:
setContainerDataSource
in interfaceContainer.Viewer
- Overrides:
setContainerDataSource
in classAbstractSelect
- Parameters:
newDataSource
- the new data source.- See Also:
Container.Viewer.setContainerDataSource(Container)
Sets the Container that serves as the data source of the viewer.
addListener
public void addListener(Tree.ExpandListener listener)
- Parameters:
listener
- the Listener to be added.
Adds the expand listener.
removeListener
public void removeListener(Tree.ExpandListener listener)
- Parameters:
listener
- the Listener to be removed.
Removes the expand listener.
fireExpandEvent
protected void fireExpandEvent(Object itemId)
- Parameters:
itemId
- the item id.
Emits the expand event.
addListener
public void addListener(Tree.CollapseListener listener)
- Parameters:
listener
- the Listener to be added.
Adds the collapse listener.
removeListener
public void removeListener(Tree.CollapseListener listener)
- Parameters:
listener
- the Listener to be removed.
Removes the collapse listener.
fireCollapseEvent
protected void fireCollapseEvent(Object itemId)
- Parameters:
itemId
- the item id.
Emits collapse event.
addActionHandler
public void addActionHandler(Action.Handler actionHandler)
- Specified by:
addActionHandler
in interfaceAction.Container
- Parameters:
actionHandler
- the new handler to be added.- See Also:
Action.Container.addActionHandler(Action.Handler)
Adds an action handler.
removeActionHandler
public void removeActionHandler(Action.Handler actionHandler)
- Specified by:
removeActionHandler
in interfaceAction.Container
- Parameters:
actionHandler
- the handler to be removed.- See Also:
Action.Container.removeActionHandler(Action.Handler)
Removes an action handler.
removeAllActionHandlers
public void removeAllActionHandlers()
Removes all action handlers
getVisibleItemIds
public Collection<?> getVisibleItemIds()
- Overrides:
getVisibleItemIds
in classAbstractSelect
- See Also:
AbstractSelect.getVisibleItemIds()
Gets the visible item ids.
setNullSelectionItemId
public void setNullSelectionItemId(Object nullSelectionItemId)
throws UnsupportedOperationException
- Overrides:
setNullSelectionItemId
in classAbstractSelect
- Parameters:
nullSelectionItemId
- the nullSelectionItemId to set.- Throws:
UnsupportedOperationException
- See Also:
AbstractSelect.setNullSelectionItemId(java.lang.Object)
Tree does not support setNullSelectionItemId
.
setNewItemsAllowed
public void setNewItemsAllowed(boolean allowNewOptions)
throws UnsupportedOperationException
- Overrides:
setNewItemsAllowed
in classAbstractSelect
- Parameters:
allowNewOptions
- the New value of property allowNewOptions.- Throws:
UnsupportedOperationException
- if set to true.- See Also:
AbstractSelect.setNewItemsAllowed(boolean)
Adding new items is not supported.
setLazyLoading
public void setLazyLoading(boolean useLazyLoading)
- See Also:
com.vaadin.ui.Select#setLazyLoading(boolean)
Tree does not support lazy options loading mode. Setting this true will throw UnsupportedOperationException.
addListener
public void addListener(ItemClickEvent.ItemClickListener listener)
- Specified by:
addListener
in interfaceItemClickEvent.ItemClickNotifier
- Parameters:
listener
- ItemClickListener to be registered
Description copied from interface: ItemClickEvent.ItemClickNotifier
Register a listener to handle ItemClickEvent
s.
removeListener
public void removeListener(ItemClickEvent.ItemClickListener listener)
- Specified by:
removeListener
in interfaceItemClickEvent.ItemClickNotifier
- Parameters:
listener
- ItemClickListener to be removed
Description copied from interface: ItemClickEvent.ItemClickNotifier
Removes an ItemClickListener.
setItemStyleGenerator
public void setItemStyleGenerator(Tree.ItemStyleGenerator itemStyleGenerator)
- Parameters:
itemStyleGenerator
- item style generator or null to remove generator
Sets the Tree.ItemStyleGenerator
to be used with this tree.
getItemStyleGenerator
public Tree.ItemStyleGenerator getItemStyleGenerator()
- Returns:
- the current
Tree.ItemStyleGenerator
for this tree. Null ifTree.ItemStyleGenerator
is not set.
removeItem
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
- Specified by:
removeItem
in interfaceContainer
- Specified by:
removeItem
in interfaceContainer.Hierarchical
- Overrides:
removeItem
in classAbstractSelect
- Parameters:
itemId
- ID of the Item to remove- Returns:
true
if the operation succeeded,false
if not- Throws:
UnsupportedOperationException
- if the container does not support removing individual items
Description copied from interface: Container
Removes the Item identified by ItemId
from the Container.
Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
getDropHandler
public DropHandler getDropHandler()
- Specified by:
getDropHandler
in interfaceDropTarget
- Returns:
- the drop hanler that will receive the dragged data or null if drops are not currently accepted
setDropHandler
public void setDropHandler(DropHandler dropHandler)
translateDropTargetDetails
public Tree.TreeTargetDetails translateDropTargetDetails(Map<String,Object> clientVariables)
- Specified by:
translateDropTargetDetails
in interfaceDropTarget
- Parameters:
clientVariables
- data passed from the DropTargets client side counterpart.- Returns:
- A DropTargetDetails object with the translated data or null to use a default implementation.
- See Also:
DragSource.getTransferable(Map)
Description copied from interface: DropTarget
Called before the DragAndDropEvent
is passed to
DropHandler
. Implementation may for example translate the drop
target details provided by the client side (drop target) to meaningful
server side values. If null is returned the terminal implementation will
automatically create a TargetDetails
with raw client side data.
setDragMode
public void setDragMode(Tree.TreeDragMode dragMode)
- Parameters:
dragMode
-
Sets the drag mode that controls how Tree behaves as a DragSource
.
getDragMode
public Tree.TreeDragMode getDragMode()
- Returns:
- the drag mode that controls how Tree behaves as a
DragSource
. - See Also:
Tree.TreeDragMode
getTransferable
public Transferable getTransferable(Map<String,Object> payload)
- Specified by:
getTransferable
in interfaceDragSource
- Parameters:
payload
- the data that client side initially included inTransferable
s client side counterpart.- Returns:
- the
Transferable
instance that will be passed toDropHandler
(and/orAcceptCriterion
)
Description copied from interface: DragSource
DragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it.
For example Tree converts item identifiers to generated string keys for
the client side. Vaadin developer don't and can't know anything about
these generated keys, only about item identifiers. When tree node is
dragged client puts that key to Transferable
s client side
counterpart. In getTransferable(Map)
the key is converted
back to item identifier that the server side developer can use.
setItemDescriptionGenerator
public void setItemDescriptionGenerator(AbstractSelect.ItemDescriptionGenerator generator)
- Parameters:
generator
- The generator to use or null to disable
Set the item description generator which generates tooltips for the tree items
getItemDescriptionGenerator
public AbstractSelect.ItemDescriptionGenerator getItemDescriptionGenerator()
Get the item description generator which generates tooltips for tree items