Class FilesystemContainer

A hierarchical container wrapper for a filesystem.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.data.util.FilesystemContainer

FilesystemContainer(File)

Parameters

root

root file for the new file-system container. Null values are ignored.

Construct a new FileSystemContainer with the specified file as the root of the filesystem. The files are included recursively.

FilesystemContainer(File, boolean)

Parameters

root

root file for the new file-system container

recursive

should the container recursively contain subdirectories.

Construct a new FileSystemContainer with the specified file as the root of the filesystem. The files are included recursively.

FilesystemContainer(File, FilenameFilter, boolean)

Parameters

root

root file for the new file-system container

filter

Filename filter to limit the files in container.

recursive

should the container recursively contain subdirectories.

Construct a new FileSystemContainer with the specified root and recursivity status.

FilesystemContainer(File, String, boolean)

Parameters

root

root file for the new file-system container

extension

Filename extension (w/o separator) to limit the files in container.

recursive

should the container recursively contain subdirectories.

Construct a new FileSystemContainer with the specified file as the root of the filesystem.

FILE_PROPERTIES

List of the string identifiers for the available properties

PROPERTY_ICON

String identifier of a file's "icon" property.

PROPERTY_LASTMODIFIED

String identifier of a file's "last modified" property.

PROPERTY_NAME

String identifier of a file's "name" property.

PROPERTY_SIZE

String identifier of a file's "size" property.

addContainerProperty(Object, Class, Object)

addItem()

See Also
addItem()

addItem(Object)

addRoot(File)

Parameters

root

File to be added as root directory. Null values are ignored.

Add new root file directory. Adds a file to be included as root file directory in the FilesystemContainer.

areChildrenAllowed(Object)

Parameters

return

true if the specified Item is a directory, false otherwise.

Tests if the specified Item in the container may have children. Since a FileSystemContainer contains files and directories, this method returns true for directory Items only.

getChildren(Object)

Parameters

itemId

ID of the Item whose children the caller is interested in

return

An unmodifiable collection containing the IDs of all other Items that are children in the container hierarchy

Description copied from interface: getChildren

Gets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.

getContainerProperty(Object, Object)

Parameters

itemId

ID of the file whose property is requested

propertyId

The property's ID

return

the requested property's value, or null

Gets the specified property of the specified file Item. The available file properties are "Name", "Size" and "Last Modified". If propertyId is not one of those, null is returned.

getContainerPropertyIds()

Parameters

return

Unmodifiable collection containing all available file properties.

Gets the collection of available file properties.

getFilter()

Parameters

return

Used filter instance or null if no filter is assigned.

Returns the file filter used to limit the files in this container.

getParent(Object)

Parameters

itemId

ID of the Item whose parent the caller wishes to find out.

return

the ID of the parent Item. Will be null if the specified Item is a root element.

Description copied from interface: getParent

Gets the ID of the parent Item of the specified Item.

getType(Object)

Parameters

propertyId

ID of the property whose type is requested.

return

data type of the requested property, or null

Gets the specified property's data type. "Name" is a String , "Size" is a Long , "Last Modified" is a Date . If propertyId is not one of those, null is returned.

hasChildren(Object)

Parameters

itemId

ID of the Item whose leaf status is to be tested

return

true if the specified Item is a leaf, false if not

Description copied from interface: hasChildren

Tests if the Item specified with itemId has any child Items, that is, is it a leaf Item. The getChildren(java.lang.Object) 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.

.

isRecursive()

Parameters

return

true if container is recursive, false otherwise.

Is this container recursive filesystem.

isRoot(Object)

Parameters

itemId

ID of the Item whose root status is to be tested

return

true if the specified Item is a root, false if not

Description copied from interface: isRoot

Tests if the Item specified with 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 getParent(java.lang.Object) method always returns null for root Items.

removeAllItems()

removeContainerProperty(Object)

removeItem(Object)

rootItemIds()

Parameters

return

An unmodifiable collection containing IDs of all root elements of the container

Description copied from interface: rootItemIds

Gets the IDs of all Items in the container that don't have a parent. Such items are called root Items. The returned collection is unmodifiable.

setChildrenAllowed(Object, boolean)

Parameters

return

false

Return false - conversion from files to directories is not supported.

setFilter(FilenameFilter)

Parameters

filter

The filter to set. null disables filtering.

Sets the file filter used to limit the files in this container.

setFilter(String)

Parameters

extension

Filename extension (w/o separator) to limit the files in container.

Sets the file filter used to limit the files in this container.

setParent(Object, Object)

Parameters

return

false

Return false - moving files around in the filesystem is not supported.

setRecursive(boolean)

Parameters

New

value for recursive property.

Sets the container recursive property. Set this to false to limit the files directly under the root file. Note, that this is meaningful only if the root really is a directory.

size()

Parameters

return

Number of Items in the container.

Gets the number of Items in the container. In effect, this is the combined amount of files and directories.