HierarchicalDataProvider
such as TreeDataProvider
or AbstractBackEndHierarchicalDataProvider
.@Deprecated public class ContainerHierarchicalWrapper extends Object implements Container.Hierarchical, Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier
A wrapper class for adding external hierarchy to containers not implementing
the Container.Hierarchical
interface.
If the wrapped container is changed directly (that is, not through the
wrapper), and does not implement Container.ItemSetChangeNotifier and/or
Container.PropertySetChangeNotifier the hierarchy information must be updated
with the updateHierarchicalWrapper()
method.
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
Constructor and Description |
---|
ContainerHierarchicalWrapper(Container toBeWrapped)
Deprecated.
Constructs a new hierarchical wrapper for an existing Container.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Deprecated.
Adds a new Property to all Items in the Container.
|
Object |
addItem()
Deprecated.
Creates a new Item into the Container, assigns it an automatic ID, and
adds it to the hierarchy.
|
Item |
addItem(Object itemId)
Deprecated.
Adds a new Item by its ID to the underlying container and to the
hierarchy.
|
void |
addItemSetChangeListener(Container.ItemSetChangeListener listener)
Deprecated.
Adds an Item set change listener for the object.
|
void |
addListener(Container.ItemSetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addItemSetChangeListener(Container.ItemSetChangeListener) |
void |
addListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(Container.PropertySetChangeListener) |
void |
addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
Registers a new Property set change listener for this Container.
|
boolean |
areChildrenAllowed(Object itemId)
Deprecated.
Tests if the Item with given ID can have children.
|
boolean |
containsId(Object itemId)
Deprecated.
Tests if the Container contains the specified Item.
|
Collection<?> |
getChildren(Object itemId)
Deprecated.
Gets the IDs of all Items that are children of the specified Item.
|
Property |
getContainerProperty(Object itemId,
Object propertyId)
Deprecated.
Gets the Property identified by the given itemId and propertyId from the
Container.
|
Collection<?> |
getContainerPropertyIds()
Deprecated.
Gets the ID's of all Properties stored in the Container.
|
Item |
getItem(Object itemId)
Deprecated.
Gets the
Item with the given Item ID from the Container. |
Collection<?> |
getItemIds()
Deprecated.
Gets the ID's of all visible (after filtering and sorting) Items stored
in the Container.
|
Object |
getParent(Object itemId)
Deprecated.
Gets the ID of the parent Item of the specified Item.
|
Class<?> |
getType(Object propertyId)
Deprecated.
Gets the data type of all Properties identified by the given Property ID.
|
boolean |
hasChildren(Object itemId)
Deprecated.
Tests if the Item specified with
itemId has child Items
or if it is a leaf. |
boolean |
isRoot(Object itemId)
Deprecated.
Tests if the Item specified with
itemId is a root Item. |
boolean |
removeAllItems()
Deprecated.
Removes all items from the underlying container and from the hierarcy.
|
boolean |
removeContainerProperty(Object propertyId)
Deprecated.
Removes the specified Property from the underlying container and from the
hierarchy.
|
boolean |
removeItem(Object itemId)
Deprecated.
Removes an Item specified by the itemId from the underlying container and
from the hierarchy.
|
boolean |
removeItemRecursively(Object itemId)
Deprecated.
Removes the Item identified by given itemId and all its children.
|
void |
removeItemSetChangeListener(Container.ItemSetChangeListener listener)
Deprecated.
Removes the Item set change listener from the object.
|
void |
removeListener(Container.ItemSetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removeItemSetChangeListener(Container.ItemSetChangeListener) |
void |
removeListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(Container.PropertySetChangeListener) |
void |
removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
Removes a previously registered Property set change listener.
|
Collection<?> |
rootItemIds()
Deprecated.
Gets the IDs of all Items in the container that don't have a parent.
|
boolean |
setChildrenAllowed(Object itemId,
boolean childrenAllowed)
Deprecated.
Sets the given Item's capability to have children.
|
boolean |
setParent(Object itemId,
Object newParentId)
Deprecated.
Sets the parent of an Item.
|
int |
size()
Deprecated.
Gets the number of visible Items in the Container.
|
void |
updateHierarchicalWrapper()
Deprecated.
Updates the wrapper's internal hierarchy data to include all Items in the
underlying container.
|
public ContainerHierarchicalWrapper(Container toBeWrapped)
Container.Hierarchical
interface.toBeWrapped
- the container that needs to be accessed hierarchicallyupdateHierarchicalWrapper()
public void updateHierarchicalWrapper()
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 testedtrue
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 incollection
containing the IDs of all other Items that are children in
the container hierarchy; null
if item does not have
any children.public 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 testedtrue
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 testedtrue
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 childrenAllowed)
Sets the given Item's capability to have children. If the Item identified
with the itemId already has children and the areChildrenAllowed is false
this method fails and false
is returned; the children must
be first explicitly removed with
setParent(Object itemId, Object newParentId)
or
Container.removeItem(Object itemId)
.
setChildrenAllowed
in interface Container.Hierarchical
itemId
- the ID of the Item in the container whose child capability is
to be set.childrenAllowed
- the boolean value specifying if the Item can have children or
not.true
if the operation succeeded, false
if notpublic boolean setParent(Object itemId, Object newParentId)
Sets the parent of an Item. The new parent item must exist and be able to
have children. (canHaveChildren(newParentId) == true
). It is
also possible to detach a node from the hierarchy (and thus make it root)
by setting the parent null
.
setParent
in interface Container.Hierarchical
itemId
- the ID of the item to be set as the child of the Item
identified with newParentId.newParentId
- the ID of the Item that's to be the new parent of the Item
identified with itemId.true
if the operation succeeded, false
if notpublic Object addItem() throws UnsupportedOperationException
addItem
in interface Container
null
if the
operation failedUnsupportedOperationException
- if the addItem is not supported.public Item addItem(Object itemId) throws UnsupportedOperationException
addItem
in interface Container
itemId
- the ID of the Item to be created.null
if the operation failed.UnsupportedOperationException
- if the addItem is not supported.public boolean removeAllItems() throws UnsupportedOperationException
removeAllItems
in interface Container
true
if the operation succeeded, false
if notUnsupportedOperationException
- if the removeAllItems is not supported.public boolean removeItem(Object itemId) throws UnsupportedOperationException
removeItem
in interface Container
removeItem
in interface Container.Hierarchical
itemId
- the ID of the Item to be removed.true
if the operation succeeded, false
if notUnsupportedOperationException
- if the removeItem is not supported.public boolean removeItemRecursively(Object itemId)
itemId
- the identifier of the Item to be removedremoveItem(Object)
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
addContainerProperty
in interface Container
propertyId
- the ID of the new Property.type
- the Data type of the new Property.defaultValue
- the value all created Properties are initialized to.true
if the operation succeeded, false
if notUnsupportedOperationException
- if the addContainerProperty is not supported.public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
Note : The Property will be removed from all Items in the Container.
removeContainerProperty
in interface Container
propertyId
- the ID of the Property to remove.true
if the operation succeeded, false
if notUnsupportedOperationException
- if the removeContainerProperty is not supported.public boolean containsId(Object itemId)
Container
Filtering can hide items so that they will not be visible through the container API, and this method should respect visibility of items (i.e. only indicate visible items as being in the container) if feasible for the container.
containsId
in interface Container
itemId
- ID the of Item to be testedpublic Item getItem(Object itemId)
Container
Item
with the given Item ID from the Container. If the
Container does not contain the requested Item, null
is
returned.
Containers should not return Items that are filtered out.
public Collection<?> getItemIds()
Container
If the container is Container.Ordered
, the collection returned by this
method should follow that order. If the container is Container.Sortable
,
the items should be in the sorted order.
Calling this method for large lazy containers can be an expensive operation and should be avoided when practical.
getItemIds
in interface Container
public Property getContainerProperty(Object itemId, Object propertyId)
Container
null
is
returned.getContainerProperty
in interface Container
itemId
- ID of the visible Item which contains the PropertypropertyId
- ID of the Property to retrievenull
public Collection<?> getContainerPropertyIds()
Container
getContainerPropertyIds
in interface Container
public Class<?> getType(Object propertyId)
Container
public int size()
Container
Filtering can hide items so that they will not be visible through the container API.
public void addItemSetChangeListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
addItemSetChangeListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be added@Deprecated public void addListener(Container.ItemSetChangeListener listener)
addItemSetChangeListener(Container.ItemSetChangeListener)
addListener
in interface Container.ItemSetChangeNotifier
public void removeItemSetChangeListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
removeItemSetChangeListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be removed@Deprecated public void removeListener(Container.ItemSetChangeListener listener)
removeItemSetChangeListener(Container.ItemSetChangeListener)
removeListener
in interface Container.ItemSetChangeNotifier
public void addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
addPropertySetChangeListener
in interface Container.PropertySetChangeNotifier
listener
- The new Listener to be registered@Deprecated public void addListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener(Container.PropertySetChangeListener)
addListener
in interface Container.PropertySetChangeNotifier
public void removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
removePropertySetChangeListener
in interface Container.PropertySetChangeNotifier
listener
- Listener to be removed@Deprecated public void removeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener(Container.PropertySetChangeListener)
removeListener
in interface Container.PropertySetChangeNotifier
Copyright © 2020 Vaadin Ltd. All rights reserved.