T - the data typepublic class Tree<T> extends Composite implements HasHierarchicalDataProvider<T>, Component.Focusable
| Modifier and Type | Class and Description |
|---|---|
static class |
Tree.ItemClick<T>
Tree item click event.
|
static interface |
Tree.ItemClickListener<T>
A listener for item click events.
|
static class |
Tree.TreeContextClickEvent<T>
ContextClickEvent for the Tree Component.
|
static class |
Tree.TreeMultiSelectionModel<T>
Custom MultiSelectionModel for Tree.
|
class |
Tree.TreeRenderer
String renderer that handles icon resources and stores their identifiers
into data objects.
|
Component.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitHasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
Tree()
Constructs a new Tree Component.
|
Tree(HierarchicalDataProvider<T,?> dataProvider)
Constructs a new Tree Component with given
HierarchicalDataProvider. |
Tree(String caption)
Constructs a new Tree Component with given caption.
|
Tree(String caption,
HierarchicalDataProvider<T,?> dataProvider)
Constructs a new Tree Component with given caption and
HierarchicalDataProvider. |
Tree(String caption,
TreeData<T> treeData)
Constructs a new Tree Component with given caption and
TreeData. |
| Modifier and Type | Method and Description |
|---|---|
Registration |
addCollapseListener(CollapseEvent.CollapseListener<T> listener)
Adds a CollapseListener to this Tree.
|
Registration |
addContextClickListener(ContextClickEvent.ContextClickListener listener)
Adds a context click listener that gets notified when a context click
happens.
|
Registration |
addExpandListener(ExpandEvent.ExpandListener<T> listener)
Adds an ExpandListener to this Tree.
|
Registration |
addItemClickListener(Tree.ItemClickListener<T> listener)
Adds an item click listener.
|
Registration |
addSelectionListener(SelectionListener<T> listener)
Adds a selection listener to the current selection model.
|
void |
addStyleName(String style)
Adds one or more style names to this component.
|
SingleSelect<T> |
asSingleSelect()
Use this tree as a single select in
Binder. |
void |
collapse(Collection<T> items)
Collapse the given items.
|
void |
collapse(T... items)
Collapse the given items.
|
void |
collapseRecursively(Collection<T> items,
int depth)
Collapse the given items and their children recursively until the given
depth.
|
protected TreeGrid<T> |
createTreeGrid()
Create inner
TreeGrid object. |
void |
deselect(T item)
This method is a shorthand that delegates to the currently set selection
model.
|
protected T |
deserializeDeclarativeRepresentation(String item)
Deserializes a string to a data item.
|
void |
expand(Collection<T> items)
Expands the given items.
|
void |
expand(T... items)
Expands the given items.
|
void |
expandRecursively(Collection<T> items,
int depth)
Expands the given items and their children recursively until the given
depth.
|
protected void |
fireCollapseEvent(T item,
boolean userOriginated)
Fires a collapse event with given item.
|
protected void |
fireExpandEvent(T item,
boolean userOriginated)
Fires an expand event with given item.
|
void |
focus()
Sets the focus for this component if the component is
Focusable. |
String |
getCaption()
Gets the caption of the component.
|
ErrorMessage |
getComponentError()
Gets the component's error message.
|
ContentMode |
getContentMode()
Gets the currently set content mode of the item captions of this Tree.
|
HierarchicalDataProvider<T,?> |
getDataProvider()
Returns the source of data items used by this listing.
|
ErrorMessage |
getErrorMessage()
Gets the error message for this component.
|
Resource |
getIcon()
Gets the icon resource of the component.
|
String |
getId()
Gets currently set debug identifier.
|
ItemCaptionGenerator<T> |
getItemCaptionGenerator()
Gets the item caption generator.
|
ItemCollapseAllowedProvider<T> |
getItemCollapseAllowedProvider()
Gets the item collapse allowed provider.
|
DescriptionGenerator<T> |
getItemDescriptionGenerator()
Gets the item description generator.
|
IconGenerator<T> |
getItemIconGenerator()
Gets the item icon generator.
|
String |
getPrimaryStyleName()
Gets the primary style name of the component.
|
Set<T> |
getSelectedItems()
This method is a shorthand that delegates to the currently set selection
model.
|
SelectionModel<T> |
getSelectionModel()
Returns the selection model for this Tree.
|
StyleGenerator<T> |
getStyleGenerator()
Gets the style generator.
|
String |
getStyleName()
Gets all user-defined CSS style names of a component.
|
int |
getTabIndex()
Gets the tabulator index of the
Focusable component. |
boolean |
isAutoRecalculateWidth()
Returns the current state of automatic width recalculation.
|
boolean |
isCaptionAsHtml()
Checks whether captions are rendered as HTML
|
boolean |
isExpanded(T item)
Returns whether a given item is expanded or collapsed.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
removeContextClickListener(ContextClickEvent.ContextClickListener listener)
Deprecated.
|
void |
removeStyleName(String style)
Removes one or more style names from component.
|
void |
scrollTo(int row)
Scrolls to a certain item, using
ScrollDestination.ANY. |
void |
scrollTo(int row,
ScrollDestination destination)
Scrolls to a certain item, using user-specified scroll destination.
|
void |
scrollToEnd()
Scrolls to the end of the last data row.
|
void |
scrollToStart()
Scrolls to the beginning of the first data row.
|
void |
select(T item)
This method is a shorthand that delegates to the currently set selection
model.
|
protected String |
serializeDeclarativeRepresentation(T item)
Serializes an
item to a string. |
void |
setAutoRecalculateWidth(boolean autoRecalculateWidth)
Sets the automatic width recalculation on or off.
|
void |
setCaption(String caption)
Sets the caption of the component.
|
void |
setCaptionAsHtml(boolean captionAsHtml)
Sets whether the caption is rendered as HTML.
|
void |
setComponentError(ErrorMessage componentError)
Sets the component's error message.
|
void |
setContentMode(ContentMode contentMode)
Sets the content mode of the item caption.
|
void |
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
|
void |
setDescription(String description)
Sets the component's description.
|
void |
setDescription(String description,
ContentMode mode)
Sets the component's description using given content
mode. |
void |
setIcon(Resource icon)
Sets the component's icon.
|
void |
setId(String id)
Adds an unique id for component that is used in the client-side for
testing purposes.
|
void |
setItemCaptionGenerator(ItemCaptionGenerator<T> captionGenerator)
Sets the item caption generator that is used to produce the strings shown
as the text for each item.
|
void |
setItemCollapseAllowedProvider(ItemCollapseAllowedProvider<T> provider)
Sets the item collapse allowed provider for this Tree.
|
void |
setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator)
Sets the description generator that is used for generating tooltip
descriptions for items.
|
void |
setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator,
ContentMode contentMode)
Sets the description generator that is used for generating HTML tooltip
descriptions for items.
|
void |
setItemIconGenerator(IconGenerator<T> iconGenerator)
Sets the item icon generator that is used to produce custom icons for
items.
|
void |
setPrimaryStyleName(String style)
Changes the primary style name of the component.
|
void |
setRowHeight(double rowHeight)
Sets the height of a row.
|
SelectionModel<T> |
setSelectionMode(Grid.SelectionMode selectionMode)
Sets the tree's selection mode.
|
void |
setStyleGenerator(StyleGenerator<T> styleGenerator)
Sets the style generator that is used for generating class names for
items in this tree.
|
void |
setStyleName(String style)
Sets one or more user-defined style names of the component, replacing any
previous user-defined styles.
|
void |
setStyleName(String style,
boolean add)
Adds or removes a style name.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
beforeClientResponse, getCompositionRoot, getDebugId, getDescription, getHeight, getHeightUnits, getState, getState, getWidth, getWidthUnits, iterator, setCompositionRoot, setDebugId, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefinedaddListener, addShortcutListener, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCustomAttributes, getData, getLocale, getParent, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeListener, removeShortcutListener, setData, setEnabled, setLocale, setParent, setReadOnly, setRequiredIndicatorVisible, setResponsive, setVisibleaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetTreeData, setItems, setItems, setItems, setItems, setItems, setTreeDataaddListener, addStyleNames, attach, getDescription, getLocale, getParent, getUI, isEnabled, isVisible, removeListener, removeStyleNames, setEnabled, setParent, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefinedforEach, spliteratorpublic Tree()
public Tree(String caption)
caption - the caption for componentpublic Tree(String caption, TreeData<T> treeData)
TreeData.caption - the caption for componenttreeData - the tree data for componentpublic Tree(String caption, HierarchicalDataProvider<T,?> dataProvider)
HierarchicalDataProvider.caption - the caption for componentdataProvider - the hierarchical data provider for componentpublic Tree(HierarchicalDataProvider<T,?> dataProvider)
HierarchicalDataProvider.dataProvider - the hierarchical data provider for componentprotected TreeGrid<T> createTreeGrid()
TreeGrid object. May be overridden in subclasses.TreeGridpublic HierarchicalDataProvider<T,?> getDataProvider()
HasItemsgetDataProvider in interface HasItems<T>public void setDataProvider(DataProvider<T,?> dataProvider)
HasDataProvidersetDataProvider in interface HasDataProvider<T>dataProvider - the data provider, not nullpublic Registration addExpandListener(ExpandEvent.ExpandListener<T> listener)
listener - the listener to addExpandEventpublic Registration addCollapseListener(CollapseEvent.CollapseListener<T> listener)
listener - the listener to addCollapseEventprotected void fireExpandEvent(T item, boolean userOriginated)
item - the expanded itemuserOriginated - whether the expand was triggered by a user interaction or the
serverprotected void fireCollapseEvent(T item, boolean userOriginated)
item - the collapsed itemuserOriginated - whether the collapse was triggered by a user interaction or
the serverpublic void expand(T... items)
If an item is currently expanded, does nothing. If an item does not have any children, does nothing.
items - the items to expandpublic void expand(Collection<T> items)
If an item is currently expanded, does nothing. If an item does not have any children, does nothing.
items - the items to expandpublic void expandRecursively(Collection<T> items, int depth)
depth describes the maximum distance between a given item and its
descendant, meaning that expandRecursively(items, 0) expands only
the given items while expandRecursively(items, 2) expands the
given items as well as their children and grandchildren.
items - the items to expand recursivelydepth - the maximum depth of recursionpublic void collapse(T... items)
For items that are already collapsed, does nothing.
items - the collection of items to collapsepublic void collapse(Collection<T> items)
For items that are already collapsed, does nothing.
items - the collection of items to collapsepublic void collapseRecursively(Collection<T> items, int depth)
depth describes the maximum distance between a given item and its
descendant, meaning that collapseRecursively(items, 0) collapses
only the given items while collapseRecursively(items, 2)
collapses the given items as well as their children and grandchildren.
items - the items to expand recursivelydepth - the maximum depth of recursionpublic boolean isExpanded(T item)
item - the item to checkpublic Set<T> getSelectedItems()
getSelectionModel()public void select(T item)
item - item to selectSelectionModel.select(Object),
getSelectionModel()public void deselect(T item)
item - item to deselectSelectionModel.deselect(Object),
getSelectionModel()public Registration addSelectionListener(SelectionListener<T> listener)
NOTE: If selection mode is switched with
#setSelectionMode(SelectionMode), then this listener is not
triggered anymore when selection changes!
listener - the listener to addUnsupportedOperationException - if selection has been disabled with
Grid.SelectionMode.NONEpublic SingleSelect<T> asSingleSelect()
Binder. Throws
IllegalStateException if the tree is not using
Grid.SelectionMode.SINGLE.public SelectionModel<T> getSelectionModel()
nullpublic void setItemCaptionGenerator(ItemCaptionGenerator<T> captionGenerator)
String.valueOf(Object) is
used.captionGenerator - the item caption provider to use, not nullpublic void setItemIconGenerator(IconGenerator<T> iconGenerator)
null for items with no icon.iconGenerator - the item icon generator to set, not nullNullPointerException - if itemIconGenerator is nullIconGeneratorpublic void setItemCollapseAllowedProvider(ItemCollapseAllowedProvider<T> provider)
true for any item that the user can collapse.
Note: This callback will be accessed often when sending data to the client. The callback should not do any costly operations.
provider - the item collapse allowed provider, not nullpublic void setStyleGenerator(StyleGenerator<T> styleGenerator)
styleGenerator - the item style generator to set, not nullNullPointerException - if styleGenerator is nullStyleGeneratorpublic void setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator)
descriptionGenerator - the item description generator to set, or null to
remove a previously set generatorpublic void setItemDescriptionGenerator(DescriptionGenerator<T> descriptionGenerator, ContentMode contentMode)
descriptionGenerator - the item description generator to set, or null to
remove a previously set generatorcontentMode - how client should interpret textual valuespublic ItemCaptionGenerator<T> getItemCaptionGenerator()
public IconGenerator<T> getItemIconGenerator()
IconGeneratorpublic ItemCollapseAllowedProvider<T> getItemCollapseAllowedProvider()
public StyleGenerator<T> getStyleGenerator()
StyleGeneratorpublic DescriptionGenerator<T> getItemDescriptionGenerator()
public Registration addItemClickListener(Tree.ItemClickListener<T> listener)
Tree is clicked.listener - the item click listener, not nulladdContextClickListener(com.vaadin.event.ContextClickEvent.ContextClickListener)public SelectionModel<T> setSelectionMode(Grid.SelectionMode selectionMode)
The built-in selection modes are:
Grid.SelectionMode.SINGLE the default modelGrid.SelectionMode.MULTIGrid.SelectionMode.NONE preventing selectionselectionMode - the selection mode to switch to, not nullGrid.SelectionModepublic void setCaption(String caption)
Component
A caption is an explanatory textual label accompanying a user
interface component, usually shown above, left of, or inside the
component. Icon (see setIcon() is
closely related to caption and is usually displayed horizontally before
or after it, depending on the component and the containing layout.
The caption can usually also be given as the first parameter to a constructor, though some components do not support it.
RichTextArea area = new RichTextArea();
area.setCaption("You can edit stuff here");
area.setValue("<h1>Helpful Heading</h1>"
+ "<p>All this is for you to edit.</p>");
The contents of a caption are automatically quoted, so no raw HTML can be rendered in a caption. The validity of the used character encoding, usually UTF-8, is not checked.
The caption of a component is, by default, managed and displayed by the
layout component or component container in which the component is placed.
For example, the VerticalLayout component shows the captions
left-aligned above the contained components, while the FormLayout
component shows the captions on the left side of the vertically laid
components, with the captions and their associated components
left-aligned in their own columns. The CustomComponent does not
manage the caption of its composition root, so if the root component has
a caption, it will not be rendered. Some components, such as
Button and Panel, manage the caption themselves and
display it inside the component.
setCaption in interface ComponentsetCaption in class Compositecaption - the new caption for the component. If the caption is
null, no caption is shown and it does not normally
take any spacepublic String getCaption()
Component
See Component.setCaption(String) for a detailed description of the
caption.
getCaption in interface ComponentgetCaption in class Compositenull if the caption is
not set.Component.setCaption(String)public void setIcon(Resource icon)
AbstractComponentsetIcon in interface ComponentsetIcon in class Compositeicon - the icon to be shown with the component's caption.Component.getIcon(),
Component.setCaption(String)public Resource getIcon()
Component
See Component.setIcon(Resource) for a detailed description of the icon.
getIcon in interface ComponentgetIcon in class Compositenull if the
component has no iconComponent.setIcon(Resource)public String getStyleName()
ComponentThe style names are returned only in the basic form in which they were added; each user-defined style name shows as two CSS style class names in the rendered HTML: one as it was given and one prefixed with the component-specific style name. Only the former is returned.
getStyleName in interface ComponentgetStyleName in class CompositeComponent.setStyleName(String),
Component.addStyleName(String),
Component.removeStyleName(String)public void setStyleName(String style)
Component
Label label = new Label("This text has a lot of style");
label.setStyleName("myonestyle myotherstyle");
Each style name will occur in two versions: one as specified and one that
is prefixed with the style name of the component. For example, if you
have a Button component and give it "mystyle" style, the
component will have both "mystyle" and "v-button-mystyle"
styles. You could then style the component either with:
.myonestyle {background: blue;}
or
.v-button-myonestyle {background: blue;}
It is normally a good practice to use addStyleName() rather than this setter, as different software
abstraction layers can then add their own styles without accidentally
removing those defined in other layers.
setStyleName in interface ComponentsetStyleName in class Compositestyle - the new style or styles of the component as a space-separated
listComponent.getStyleName(),
Component.addStyleName(String),
Component.removeStyleName(String)public void setStyleName(String style, boolean add)
Componentadd parameter is true, the style name is added to the
component. If the add parameter is false, the style name is
removed from the component.
Functionally this is equivalent to using Component.addStyleName(String) or
Component.removeStyleName(String)
setStyleName in interface ComponentsetStyleName in class Compositestyle - the style name to be added or removedadd - true to add the given style, false
to remove itComponent.addStyleName(String),
Component.removeStyleName(String)public void addStyleName(String style)
Component
Label label = new Label("This text has style");
label.addStyleName("mystyle");
Each style name will occur in two versions: one as specified and one that
is prefixed with the style name of the component. For example, if you
have a Button component and give it "mystyle" style, the
component will have both "mystyle" and "v-button-mystyle"
styles. You could then style the component either with:
.mystyle {font-style: italic;}
or
.v-button-mystyle {font-style: italic;}
addStyleName in interface ComponentaddStyleName in class Compositestyle - the new style to be added to the componentComponent.getStyleName(),
Component.setStyleName(String),
Component.removeStyleName(String)public void removeStyleName(String style)
Component
The parameter must be a valid CSS style name. Only user-defined style
names added with addStyleName() or
setStyleName() can be removed; built-in
style names defined in Vaadin or GWT can not be removed.
removeStyleName in interface ComponentremoveStyleName in class Compositestyle - the style name or style names to be removedComponent.getStyleName(),
Component.setStyleName(String),
Component.addStyleName(String)public String getPrimaryStyleName()
ComponentComponent.setPrimaryStyleName(String) for a better description of
the primary stylename.getPrimaryStyleName in interface ComponentgetPrimaryStyleName in class Compositepublic void setPrimaryStyleName(String style)
ComponentThe primary style name identifies the component when applying the CSS theme to the Component. By changing the style name all CSS rules targeted for that style name will no longer apply, and might result in the component not working as intended.
To preserve the original style of the component when changing to a new primary style you should make your new primary style inherit the old primary style using the SASS @include directive. See more in the SASS tutorials.
setPrimaryStyleName in interface ComponentsetPrimaryStyleName in class Compositestyle - The new primary style namepublic void setId(String id)
Componentpublic String getId()
Componentpublic void setCaptionAsHtml(boolean captionAsHtml)
AbstractComponentIf set to true, the captions are rendered in the browser as HTML and the developer is responsible for ensuring no harmful HTML is used. If set to false, the caption is rendered in the browser as plain text.
The default is false, i.e. to render that caption as plain text.
setCaptionAsHtml in class CompositecaptionAsHtml - true if the captions are rendered as HTML, false if rendered
as plain textpublic boolean isCaptionAsHtml()
AbstractComponentThe default is false, i.e. to render that caption as plain text.
isCaptionAsHtml in class Compositepublic void setDescription(String description)
AbstractComponentAbstractComponent.getDescription() for more
information on what the description is.setDescription in class Compositedescription - the new description string for the component.AbstractComponent.setDescription(String, ContentMode)public void setDescription(String description, ContentMode mode)
AbstractComponentmode. See
AbstractComponent.getDescription() for more information on what the description
is.
If the content mode is ContentMode.HTML the
description is displayed as HTML in tooltips or directly in certain
components so care should be taken to avoid creating the possibility for
HTML injection and possibly XSS vulnerabilities.
setDescription in class Compositedescription - the new description string for the component.mode - the content mode for the descriptionpublic ErrorMessage getErrorMessage()
AbstractComponentgetErrorMessage in class Compositepublic ErrorMessage getComponentError()
AbstractComponentgetComponentError in class Compositepublic void setComponentError(ErrorMessage componentError)
AbstractComponentsetComponentError in class CompositecomponentError - the new ErrorMessage of the component.public void setRowHeight(double rowHeight)
rowHeight - The height of a row in pixels or -1 for automatic calculationpublic ContentMode getContentMode()
ContentModepublic void setContentMode(ContentMode contentMode)
contentMode - the content modeContentModepublic boolean isAutoRecalculateWidth()
true if enabled; false if disabledpublic void setAutoRecalculateWidth(boolean autoRecalculateWidth)
autoRecalculateWidth - true to enable recalculation; false to turn it
offpublic Registration addContextClickListener(ContextClickEvent.ContextClickListener listener)
addContextClickListener in interface ContextClickEvent.ContextClickNotifieraddContextClickListener in class AbstractComponentlistener - the context click listener to add, not null actual event
provided to the listener is Tree.TreeContextClickEventaddItemClickListener(com.vaadin.ui.Tree.ItemClickListener<T>),
Registration@Deprecated public void removeContextClickListener(ContextClickEvent.ContextClickListener listener)
ContextClickEvent.ContextClickNotifier#addContextClickListener(ContextClickListener).removeContextClickListener in interface ContextClickEvent.ContextClickNotifierremoveContextClickListener in class AbstractComponentlistener - the context click listener to removepublic void writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractComponentdesign - The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext - The DesignContext instance used for writing the designpublic void readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractComponentdesign - The element to obtain the state fromdesignContext - The DesignContext instance used for parsing the designprotected T deserializeDeclarativeRepresentation(String item)
Default implementation is able to handle only String as an item
type. There will be a ClassCastException if T is not a
String.
item - string to deserializeClassCastException - if type T is not a StringserializeDeclarativeRepresentation(Object)protected String serializeDeclarativeRepresentation(T item)
item to a string. Used when saving this Tree to its
declarative format.
Default implementation delegates a call to item.toString().
item - a data itemitem.deserializeDeclarativeRepresentation(String)public void scrollTo(int row)
throws IllegalArgumentException
ScrollDestination.ANY.
If the item has an open details row, its size will also be taken into account.
row - zero based index of the item to scroll to in the current view.IllegalArgumentException - if the provided row is outside the item rangepublic void scrollTo(int row,
ScrollDestination destination)
If the item has an open details row, its size will also be taken into account.
row - zero based index of the item to scroll to in the current view.destination - value specifying desired position of scrolled-to row, not
nullIllegalArgumentException - if the provided row is outside the item rangepublic void scrollToStart()
public void scrollToEnd()
public int getTabIndex()
Component.FocusableFocusable component.getTabIndex in interface Component.FocusableFocusable componentComponent.Focusable.setTabIndex(int)public void setTabIndex(int tabIndex)
Component.FocusableFocusable component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.
Form loginBox = new Form();
loginBox.setCaption("Login");
layout.addComponent(loginBox);
// Create the first field which will be focused
TextField username = new TextField("User name");
loginBox.addField("username", username);
// Set focus to the user name
username.focus();
TextField password = new TextField("Password");
loginBox.addField("password", password);
Button login = new Button("Login");
loginBox.getFooter().addComponent(login);
// An additional component which natural focus order would
// be after the button.
CheckBox remember = new CheckBox("Remember me");
loginBox.getFooter().addComponent(remember);
username.setTabIndex(1);
password.setTabIndex(2);
remember.setTabIndex(3); // Different than natural place
login.setTabIndex(4);
After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
setTabIndex in interface Component.FocusabletabIndex - the tab order of this component. Indexes usually start
from 1. Zero means that default tab order should be used.
A negative value means that the field should not be
included in the tabbing sequence.Component.Focusable.getTabIndex()public void focus()
AbstractComponentFocusable.focus in interface Component.Focusablefocus in class AbstractComponentFieldEvents,
FieldEvents.FocusEvent,
FieldEvents.FocusListener,
FieldEvents.BlurEvent,
FieldEvents.BlurListenerCopyright © 2019 Vaadin Ltd. All rights reserved.