AbstractBackEndHierarchicalDataProvider
, such as the
example in Vaadin Sampler for File System Explorer.@Deprecated public class FilesystemContainer extends Object implements Container.Hierarchical
Modifier and Type | Class and Description |
---|---|
class |
FilesystemContainer.FileExtensionFilter
Deprecated.
|
class |
FilesystemContainer.FileItem
Deprecated.
|
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
Modifier and Type | Field and Description |
---|---|
static Collection<String> |
FILE_PROPERTIES
Deprecated.
List of the string identifiers for the available properties.
|
static String |
PROPERTY_ICON
Deprecated.
String identifier of a file's "icon" property.
|
static String |
PROPERTY_LASTMODIFIED
Deprecated.
String identifier of a file's "last modified" property.
|
static String |
PROPERTY_NAME
Deprecated.
String identifier of a file's "name" property.
|
static String |
PROPERTY_SIZE
Deprecated.
String identifier of a file's "size" property.
|
Constructor and Description |
---|
FilesystemContainer(File root)
Deprecated.
Constructs a new
FileSystemContainer with the specified file
as the root of the filesystem. |
FilesystemContainer(File root,
boolean recursive)
Deprecated.
Constructs a new
FileSystemContainer with the specified file
as the root of the filesystem. |
FilesystemContainer(File root,
FilenameFilter filter,
boolean recursive)
Deprecated.
Constructs a new
FileSystemContainer with the specified root
and recursivity status. |
FilesystemContainer(File root,
String extension,
boolean recursive)
Deprecated.
Constructs a new
FileSystemContainer with the specified file
as the root of the filesystem. |
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, and assign it an automatic ID.
|
Item |
addItem(Object itemId)
Deprecated.
Creates a new Item with the given ID in the Container.
|
void |
addRoot(File root)
Deprecated.
Adds new root file directory.
|
boolean |
areChildrenAllowed(Object itemId)
Deprecated.
Tests if the specified Item in the container may have children.
|
boolean |
containsId(Object itemId)
Deprecated.
Tests if the Container contains the specified Item.
|
Collection<File> |
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 specified property of the specified file Item.
|
Collection<String> |
getContainerPropertyIds()
Deprecated.
Gets the collection of available file properties.
|
FilenameFilter |
getFilter()
Deprecated.
Returns the file filter used to limit the files in this container.
|
Item |
getItem(Object itemId)
Deprecated.
Gets the
Item with the given Item ID from the Container. |
Collection<File> |
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 specified property's data type.
|
boolean |
hasChildren(Object itemId)
Deprecated.
Tests if the Item specified with
itemId has child Items
or if it is a leaf. |
boolean |
isRecursive()
Deprecated.
Is this container recursive filesystem.
|
boolean |
isRoot(Object itemId)
Deprecated.
Tests if the Item specified with
itemId is a root Item. |
boolean |
removeAllItems()
Deprecated.
Removes all Items from the Container.
|
boolean |
removeContainerProperty(Object propertyId)
Deprecated.
Removes a Property specified by the given Property ID from the Container.
|
boolean |
removeItem(Object itemId)
Deprecated.
Removes the Item identified by
ItemId from the
Container. |
Collection<File> |
rootItemIds()
Deprecated.
Gets the IDs of all Items in the container that don't have a parent.
|
boolean |
setChildrenAllowed(Object itemId,
boolean areChildrenAllowed)
Deprecated.
Returns
false when conversion from files to directories is
not supported. |
void |
setFilter(FilenameFilter filter)
Deprecated.
Sets the file filter used to limit the files in this container.
|
void |
setFilter(String extension)
Deprecated.
Sets the file filter used to limit the files in this container.
|
boolean |
setParent(Object itemId,
Object newParentId)
Deprecated.
Returns
false when moving files around in the filesystem is
not supported. |
void |
setRecursive(boolean recursive)
Deprecated.
Sets the container recursive property.
|
int |
size()
Deprecated.
Gets the number of Items in the container.
|
public static String PROPERTY_NAME
public static String PROPERTY_SIZE
public static String PROPERTY_ICON
public static String PROPERTY_LASTMODIFIED
public static Collection<String> FILE_PROPERTIES
public FilesystemContainer(File root)
FileSystemContainer
with the specified file
as the root of the filesystem. The files are included recursively.root
- the root file for the new file-system container. Null values
are ignored.public FilesystemContainer(File root, boolean recursive)
FileSystemContainer
with the specified file
as the root of the filesystem. The files are included recursively.root
- the root file for the new file-system container.recursive
- should the container recursively contain subdirectories.public FilesystemContainer(File root, String extension, boolean recursive)
FileSystemContainer
with the specified file
as the root of the filesystem.root
- the root file for the new file-system container.extension
- the Filename extension (w/o separator) to limit the files in
container.recursive
- should the container recursively contain subdirectories.public FilesystemContainer(File root, FilenameFilter filter, boolean recursive)
FileSystemContainer
with the specified root
and recursivity status.root
- the root file for the new file-system container.filter
- the Filename filter to limit the files in container.recursive
- should the container recursively contain subdirectories.public void addRoot(File root)
FilesystemContainer
.root
- the File to be added as root directory. Null values are
ignored.public boolean areChildrenAllowed(Object itemId)
FileSystemContainer
contains files and directories, this
method returns true
for directory Items only.areChildrenAllowed
in interface Container.Hierarchical
itemId
- the id of the item.true
if the specified Item is a directory,
false
otherwise.public Collection<File> 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<File> 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
false
when conversion from files to directories is
not supported.setChildrenAllowed
in interface Container.Hierarchical
itemId
- the ID of the item.areChildrenAllowed
- the boolean value specifying if the Item can have children or
not.true
if the operaton is successful otherwise
false
.UnsupportedOperationException
- if the setChildrenAllowed is not supported.public boolean setParent(Object itemId, Object newParentId) throws UnsupportedOperationException
false
when moving files around in the filesystem is
not supported.setParent
in interface Container.Hierarchical
itemId
- the ID of the item.newParentId
- the ID of the Item that's to be the new parent of the Item
identified with itemId.true
if the operation is successful otherwise
false
.UnsupportedOperationException
- if the setParent 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<File> 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)
null
is returned.getContainerProperty
in interface Container
itemId
- the ID of the file whose property is requested.propertyId
- the property's ID.null
public Collection<String> getContainerPropertyIds()
getContainerPropertyIds
in interface Container
public Class<?> getType(Object propertyId)
String
,
"Size" is a Long
, "Last Modified" is a Date
. If
propertyId is not one of those, null
is returned.public int size()
public FilenameFilter getFilter()
public void setFilter(FilenameFilter filter)
filter
- The filter to set. null
disables filtering.public void setFilter(String extension)
extension
- the Filename extension (w/o separator) to limit the files in
container.public boolean isRecursive()
true
if container is recursive, false
otherwise.public void setRecursive(boolean recursive)
Note : This is meaningful only if the root really is a directory.
recursive
- the New value for recursive property.public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
Container
This functionality is optional.
addContainerProperty
in interface Container
propertyId
- ID of the Propertytype
- Data type of the new PropertydefaultValue
- The value all created Properties are initialized totrue
if the operation succeeded, false
if notUnsupportedOperationException
- if the container does not support explicitly adding container
propertiespublic Object addItem() throws UnsupportedOperationException
Container
The new ID is returned, or null
if the operation fails.
After a successful call you can use the
method to fetch the Item.
getItem
This functionality is optional.
addItem
in interface Container
null
in case of a
failureUnsupportedOperationException
- if adding an item without an explicit item ID is not
supported by the containerpublic Item addItem(Object itemId) throws UnsupportedOperationException
Container
The new Item is returned, and it is ready to have its Properties
modified. Returns null
if the operation fails or the
Container already contains a Item with the given ID.
This functionality is optional.
addItem
in interface Container
itemId
- ID of the Item to be creatednull
in case of a failureUnsupportedOperationException
- if adding an item with an explicit item ID is not supported
by the containerpublic boolean removeAllItems() throws UnsupportedOperationException
Container
Note that Property ID and type information is preserved. This functionality is optional.
removeAllItems
in interface Container
true
if the operation succeeded, false
if notUnsupportedOperationException
- if the container does not support removing all itemspublic boolean removeItem(Object itemId) throws UnsupportedOperationException
Container.Hierarchical
Removes the Item identified by ItemId
from the
Container.
Note that this does not remove any children the item might have.
removeItem
in interface Container
removeItem
in interface Container.Hierarchical
itemId
- ID of the Item to removetrue
if the operation succeeded,
false
if notUnsupportedOperationException
- if the container does not support removing individual itemspublic boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
Container
This functionality is optional.
removeContainerProperty
in interface Container
propertyId
- ID of the Property to removetrue
if the operation succeeded, false
if notUnsupportedOperationException
- if the container does not support removing container
propertiesCopyright © 2020 Vaadin Ltd. All rights reserved.