|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.AbstractSelect
com.vaadin.ui.Table
com.vaadin.ui.TreeTable
public class TreeTable
TreeTable extends the Table
component so that it can also visualize a
hierarchy of its Items in a similar manner that Tree
does. The tree
hierarchy is always displayed in the first actual column of the TreeTable.
The TreeTable supports the usual Table
features like lazy loading, so
it should be no problem to display lots of items at once. Only required rows
and some cache rows are sent to the client.
TreeTable supports standard Container.Hierarchical
container interfaces, but
also a more fine tuned version - Collapsible
. A container
implementing the Collapsible
interface stores the collapsed/expanded
state internally and can this way scale better on the server side than with
standard Hierarchical implementations. Developer must however note that
Collapsible
containers can not be shared among several users as they
share UI state in the container.
Nested Class Summary |
---|
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 | |
---|---|
TreeTable()
Creates an empty TreeTable with a default container. |
|
TreeTable(String caption)
Creates an empty TreeTable with a default container. |
|
TreeTable(String caption,
Container dataSource)
Creates a TreeTable instance with given captions and data source. |
Method Summary | |
---|---|
void |
addListener(Tree.CollapseListener listener)
Adds a collapse listener. |
void |
addListener(Tree.ExpandListener listener)
Adds an expand listener. |
boolean |
areChildrenAllowed(Object itemId)
Tests if the Item with given ID can have children. |
void |
changeVariables(Object source,
Map<String,Object> variables)
Invoked when the value of a variable has changed. |
void |
containerItemSetChange(Container.ItemSetChangeEvent event)
Container datasource item set change. |
protected void |
fireCollapseEvent(Object itemId)
Emits a collapse event. |
protected void |
fireExpandEvent(Object itemId)
Emits an expand event. |
protected int |
getAddedRowCount()
Subclass and override this to enable partial row additions, bypassing the normal caching mechanism. |
Collection<?> |
getChildren(Object itemId)
Gets the IDs of all Items that are children of the specified Item. |
Container.Hierarchical |
getContainerDataSource()
Gets the viewing data-source container. |
protected int |
getFirstAddedItemIndex()
Subclass and override this to enable partial row additions, bypassing the normal caching mechanism. |
protected int |
getFirstUpdatedItemIndex()
Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism. |
Object |
getHierarchyColumnId()
|
protected Object |
getIdByIndex(int index)
|
Collection<?> |
getItemIds()
Gets the item Id collection from the container. |
Object |
getParent(Object itemId)
Gets the ID of the parent Item of the specified Item. |
protected int |
getUpdatedRowCount()
Subclass and override this to enable partial row updates, bypassing the normal caching and lazy loading mechanism. |
boolean |
hasChildren(Object itemId)
Tests if the Item specified with itemId has child Items
or if it is a leaf. |
protected int |
indexOfId(Object itemId)
|
boolean |
isAnimationsEnabled()
|
boolean |
isCollapsed(Object itemId)
Checks if Item with given identifier is collapsed in the UI. |
boolean |
isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the Container. |
protected boolean |
isPartialRowUpdate()
Subclass and override this to enable partial row updates and additions, which bypass the normal caching mechanism. |
boolean |
isRoot(Object itemId)
Tests if the Item specified with itemId is a root Item. |
Object |
lastItemId()
Gets the ID of the last Item in the Container. |
Object |
nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to itemId. |
void |
paintContent(PaintTarget target)
Paints the content of this component. |
protected void |
paintRowAttributes(PaintTarget target,
Object itemId)
A method where extended Table implementations may add their custom attributes for rows. |
protected void |
paintRowIcon(PaintTarget target,
Object[][] cells,
int indexInRowbuffer)
|
Object |
prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to the itemId. |
void |
removeListener(Tree.CollapseListener listener)
Removes a collapse listener. |
void |
removeListener(Tree.ExpandListener listener)
Removes an expand listener. |
Collection<?> |
rootItemIds()
Gets the IDs of all Items in the container that don't have a parent. |
void |
setAnimationsEnabled(boolean animationsEnabled)
Animations can be enabled by passing true to this method. |
boolean |
setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
Sets the given Item's capability to have children. |
void |
setCollapsed(Object itemId,
boolean collapsed)
Sets the Item specified by given identifier as collapsed or expanded. |
void |
setContainerDataSource(Container newDataSource)
Sets the Container that serves as the data source of the viewer. |
void |
setHierarchyColumn(Object hierarchyColumnId)
Explicitly sets the column in which the TreeTable visualizes the hierarchy. |
boolean |
setParent(Object itemId,
Object newParentId)
Sets the parent of an Item. |
protected boolean |
shouldHideAddedRows()
Subclass and override this to enable removing of rows, bypassing the normal caching and lazy loading mechanism. |
int |
size()
Gets the number of visible Items in the Container. |
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.Hierarchical |
---|
removeItem |
Methods inherited from interface com.vaadin.data.Container |
---|
addContainerProperty, addItem, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getType, removeAllItems, removeContainerProperty |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setParent, setReadOnly, setStyleName |
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, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setParent, setReadOnly, setStyleName |
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 |
---|
public TreeTable()
public TreeTable(String caption)
caption
- the caption for the TreeTablepublic TreeTable(String caption, Container dataSource)
caption
- the caption for the componentdataSource
- the dataSource that is used to list items in the componentMethod Detail |
---|
protected void paintRowAttributes(PaintTarget target, Object itemId) throws PaintException
Table
paintRowAttributes
in class Table
PaintException
protected void paintRowIcon(PaintTarget target, Object[][] cells, int indexInRowbuffer) throws PaintException
paintRowIcon
in class Table
PaintException
public void changeVariables(Object source, Map<String,Object> variables)
Table
changeVariables
in interface VariableOwner
changeVariables
in class Table
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.Select.changeVariables(java.lang.Object,
java.util.Map)
public void paintContent(PaintTarget target) throws PaintException
AbstractSelect
paintContent
in class Table
target
- the Paint Event.
PaintException
- if the paint operation failed.protected boolean isPartialRowUpdate()
Table
isPartialRowUpdate
in class Table
protected int getFirstAddedItemIndex()
Table
getFirstAddedItemIndex
in class Table
protected int getAddedRowCount()
Table
getAddedRowCount
in class Table
Table.getFirstAddedItemIndex()
. For plain Table it is always
0.protected int getFirstUpdatedItemIndex()
Table
getFirstUpdatedItemIndex
in class Table
protected int getUpdatedRowCount()
Table
getUpdatedRowCount
in class Table
Table.getFirstUpdatedItemIndex()
. For plain table it is always
0.protected boolean shouldHideAddedRows()
Table
Table.getFirstAddedItemIndex()
and Table.getAddedRowCount()
should
be hidden instead of added.
shouldHideAddedRows
in class Table
Table.getFirstAddedItemIndex()
and Table.getAddedRowCount()
) should be added or hidden. For
plain Table it is always false.public int size()
Container
size
in interface Container
size
in class AbstractSelect
public Container.Hierarchical getContainerDataSource()
AbstractSelect
getContainerDataSource
in interface Container.Viewer
getContainerDataSource
in class AbstractSelect
Container.Viewer.getContainerDataSource()
public void setContainerDataSource(Container newDataSource)
AbstractSelect
setContainerDataSource
in interface Container.Viewer
setContainerDataSource
in class Table
newDataSource
- the new data source.Container.Viewer.setContainerDataSource(Container)
public void containerItemSetChange(Container.ItemSetChangeEvent event)
Table
containerItemSetChange
in interface Container.ItemSetChangeListener
containerItemSetChange
in class Table
event
- change event textContainer.ItemSetChangeListener.containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)
protected Object getIdByIndex(int index)
getIdByIndex
in class Table
protected int indexOfId(Object itemId)
indexOfId
in class Table
public Object nextItemId(Object itemId)
Table
nextItemId
in interface Container.Ordered
nextItemId
in class Table
itemId
- ID of a visible Item in the Container
null
Container.Ordered.nextItemId(java.lang.Object)
public Object lastItemId()
Table
lastItemId
in interface Container.Ordered
lastItemId
in class Table
Container.Ordered.lastItemId()
public Object prevItemId(Object itemId)
Table
prevItemId
in interface Container.Ordered
prevItemId
in class Table
itemId
- ID of a visible Item in the Container
null
Container.Ordered.prevItemId(java.lang.Object)
public boolean isLastId(Object itemId)
Table
isLastId
in interface Container.Ordered
isLastId
in class Table
true
if the Item is last visible item in the
Container, false
if notContainer.Ordered.isLastId(java.lang.Object)
public Collection<?> getItemIds()
AbstractSelect
getItemIds
in interface Container
getItemIds
in class AbstractSelect
public boolean areChildrenAllowed(Object itemId)
Container.Hierarchical
areChildrenAllowed
in interface Container.Hierarchical
itemId
- ID of the Item in the container whose child capability is
to be tested
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.public Collection<?> getChildren(Object itemId)
Container.Hierarchical
getChildren
in interface Container.Hierarchical
itemId
- ID of the Item whose children the caller is interested in
collection
containing the IDs of all other Items that are children in
the container hierarchypublic Object getParent(Object itemId)
Container.Hierarchical
getParent
in interface Container.Hierarchical
itemId
- ID of the Item whose parent the caller wishes to find out.
null
if the
specified Item is a root element.public boolean hasChildren(Object itemId)
Container.Hierarchical
Tests if the Item specified with itemId
has child Items
or if it is a leaf. The Container.Hierarchical.getChildren(Object itemId)
method
always returns null
for leaf Items.
Note that being a leaf does not imply whether or not an Item is allowed to have children.
.
hasChildren
in interface Container.Hierarchical
itemId
- ID of the Item to be tested
true
if the specified Item has children,
false
if not (is a leaf)public boolean isRoot(Object itemId)
Container.Hierarchical
itemId
is a root Item.
The hierarchical container can have more than one root and must have
at least one unless it is empty. The Container.Hierarchical.getParent(Object itemId)
method always returns null
for root Items.
isRoot
in interface Container.Hierarchical
itemId
- ID of the Item whose root status is to be tested
true
if the specified Item is a root,
false
if notpublic Collection<?> rootItemIds()
Container.Hierarchical
root
Items. The returned
collection is unmodifiable.
rootItemIds
in interface Container.Hierarchical
collection
containing IDs of all root elements of the containerpublic boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) throws UnsupportedOperationException
Container.Hierarchical
Sets the given Item's capability to have children. If the Item
identified with itemId
already has children and
is false this method
fails and Container.Hierarchical.areChildrenAllowed(Object)
false
is returned.
The children must be first explicitly removed with
Container.Hierarchical.setParent(Object itemId, Object newParentId)
or
Container.removeItem(Object itemId)
.
This operation is optional. If it is not implemented, the method
always returns false
.
setChildrenAllowed
in interface Container.Hierarchical
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
true
if the operation succeeded,
false
if not
UnsupportedOperationException
public boolean setParent(Object itemId, Object newParentId) throws UnsupportedOperationException
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.
setParent
in interface Container.Hierarchical
itemId
- ID of the item to be set as the child of the Item
identified with newParentId
newParentId
- ID of the Item that's to be the new parent of the Item
identified with itemId
true
if the operation succeeded,
false
if not
UnsupportedOperationException
public void setCollapsed(Object itemId, boolean collapsed)
itemId
- the identifier of the Itemcollapsed
- true if the Item should be collapsed, false if expandedpublic boolean isCollapsed(Object itemId)
itemId
- the identifier of the checked Item
Collapsible.isCollapsed(Object)
public void setHierarchyColumn(Object hierarchyColumnId)
hierarchyColumnId
- public Object getHierarchyColumnId()
public void addListener(Tree.ExpandListener listener)
listener
- the Listener to be added.public void removeListener(Tree.ExpandListener listener)
listener
- the Listener to be removed.protected void fireExpandEvent(Object itemId)
itemId
- the item id.public void addListener(Tree.CollapseListener listener)
listener
- the Listener to be added.public void removeListener(Tree.CollapseListener listener)
listener
- the Listener to be removed.protected void fireCollapseEvent(Object itemId)
itemId
- the item id.public boolean isAnimationsEnabled()
public void setAnimationsEnabled(boolean animationsEnabled)
animationsEnabled
- true or false whether to enable animations or not.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |