DataObject.Container, org.openide.nodes.Node.Cookiepublic class DataFolder extends MultiDataObject implements DataObject.Container
Has special support for determining the sorting of the folder, or even explicit ordering of the children.
| Modifier and Type | Class | Description |
|---|---|---|
class |
DataFolder.FolderNode |
Node for a folder.
|
static class |
DataFolder.Index |
Support for index cookie for folder nodes.
|
static class |
DataFolder.SortMode |
Type-safe enumeration of sort modes for data folders.
|
DataObject.Container, DataObject.Factory, DataObject.Registration, DataObject.Registrations, DataObject.RegistryMultiDataObject.Entry| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
PROP_CHILDREN |
Name of property that holds children of this node.
|
static java.lang.String |
PROP_ORDER |
Name of property for order of children.
|
static java.lang.String |
PROP_SORT_MODE |
Name of property which decides sorting mode.
|
static java.lang.String |
SET_SORTING |
Name of set with sorting options.
|
PROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALID| Modifier | Constructor | Description |
|---|---|---|
|
DataFolder(org.openide.filesystems.FileObject fo) |
Deprecated.
This method should not be used in client code.
If you are searching for a
DataFolder for
a FileObject use findFolder(org.openide.filesystems.FileObject) factory method. |
protected |
DataFolder(org.openide.filesystems.FileObject fo,
DataLoader loader) |
Deprecated.
Since 1.13 do not use this constructor, it is for backward compatibility only.
|
protected |
DataFolder(org.openide.filesystems.FileObject fo,
MultiFileLoader loader) |
Create a data folder from a folder file object.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.util.Enumeration<DataObject> |
children() |
Get enumeration of children of this folder.
|
java.util.Enumeration<DataObject> |
children(boolean rec) |
Enumerate all children of this folder.
|
static DataFolder |
create(DataFolder folder,
java.lang.String name) |
Helper method to find or create a folder of a given path.
|
org.openide.nodes.Children |
createNodeChildren(DataFilter filter) |
Support method to obtain a children object that
can be added to any
Node. |
protected org.openide.nodes.Node |
createNodeDelegate() |
Create node representative for this folder.
|
static DataObject.Container |
findContainer(org.openide.filesystems.FileObject fo) |
Finds a DataObject.Container representing given folder.
|
static DataFolder |
findFolder(org.openide.filesystems.FileObject fo) |
Create a folder for a specified file object.
|
DataObject[] |
getChildren() |
Get the children of this folder.
|
org.openide.util.HelpCtx |
getHelpCtx() |
Get help context for this object.
|
org.openide.util.Lookup |
getLookup() |
Represents a context of the data object.
|
java.lang.String |
getName() |
Get the name of the data folder.
|
DataFolder.SortMode |
getSortMode() |
Get the sort mode of the folder.
|
protected DataObject |
handleCopy(DataFolder f) |
Copies primary and secondary files to new folder.
|
protected DataObject |
handleCreateFromTemplate(DataFolder f,
java.lang.String name) |
Create a new data object from template (implemented in subclasses).
|
protected DataShadow |
handleCreateShadow(DataFolder f) |
Creates shadow for this object in specified folder (overridable in subclasses).
|
protected void |
handleDelete() |
Delete this object (implemented by subclasses).
|
protected org.openide.filesystems.FileObject |
handleMove(DataFolder df) |
Moves primary and secondary files to a new folder.
|
protected org.openide.filesystems.FileObject |
handleRename(java.lang.String name) |
Rename this object (implemented in subclasses).
|
boolean |
isCopyAllowed() |
Test whether the object may be copied.
|
boolean |
isDeleteAllowed() |
Test whether the object may be deleted.
|
boolean |
isMoveAllowed() |
Test whether the object may be moved.
|
boolean |
isRenameAllowed() |
Test whether the object may be renamed.
|
void |
setOrder(DataObject[] arr) |
Set the order of the children.
|
void |
setSortMode(DataFolder.SortMode mode) |
Set the sort mode for the folder.
|
addPropertyChangeListener, addVetoableChangeListener, copy, createFromTemplate, createFromTemplate, createFromTemplate, createShadow, delete, dispose, find, firePropertyChange, fireVetoableChange, getCookie, getFolder, getLoader, getNodeDelegate, getPrimaryFile, getRegistry, isModified, isShadowAllowed, isTemplate, isValid, markFiles, move, removePropertyChangeListener, removeVetoableChangeListener, rename, setModified, setTemplate, setValid, toString, writeReplaceaddPropertyChangeListener, removePropertyChangeListeneraddSecondaryEntry, associateLookup, files, findSecondaryEntry, getCookie, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopyRename, registerEditor, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLockpublic static final java.lang.String PROP_CHILDREN
public static final java.lang.String PROP_SORT_MODE
public static final java.lang.String PROP_ORDER
public static final java.lang.String SET_SORTING
@Deprecated
public DataFolder(org.openide.filesystems.FileObject fo)
throws DataObjectExistsException,
java.lang.IllegalArgumentException
DataFolder for
a FileObject use findFolder(org.openide.filesystems.FileObject) factory method.fo - file folder to work onDataObjectExistsException - if there is one alreadyjava.lang.IllegalArgumentException - if fo is not folderprotected DataFolder(org.openide.filesystems.FileObject fo,
MultiFileLoader loader)
throws DataObjectExistsException,
java.lang.IllegalArgumentException
fo - file folder to work onloader - data loader for this data objectDataObjectExistsException - if there is one alreadyjava.lang.IllegalArgumentException - if fo is not folder@Deprecated
protected DataFolder(org.openide.filesystems.FileObject fo,
DataLoader loader)
throws DataObjectExistsException,
java.lang.IllegalArgumentException
fo - file folder to work onloader - data loader for this data objectDataObjectExistsException - if there is one alreadyjava.lang.IllegalArgumentException - if fo is not folderpublic static DataFolder create(DataFolder folder, java.lang.String name) throws java.io.IOException
folder - the folder to start inname - a subfolder path (e.g. com/mycom/testfolder)java.io.IOException - if the I/O failspublic final void setSortMode(DataFolder.SortMode mode) throws java.io.IOException
mode - an constant from DataFolder.SortModejava.io.IOException - if the mode cannot be setpublic final DataFolder.SortMode getSortMode()
public final void setOrder(DataObject[] arr) throws java.io.IOException
getChildren(). If there are any other children, they
will be appended to the array.arr - array of data objects (children of this
folder) to define the order; or null if any particular ordering should
be cancelledjava.io.IOException - if the order cannot be setpublic org.openide.util.Lookup getLookup()
DataObjectDataObject.getCookie(java.lang.Class<T>) and should preferably
be used instead of the old method. The default implementation
inside a data object
returns the getNodeDelegate().getLookup() - which is
the most compatible behaviour with previous versions. However
this code has significant potential to deadlocks. That is why the
preferred advice is to override the method to:
class MyDataObject extends MultiDataObject {
public @Override Lookup getLookup() {
return getCookieSet().getLookup();
}
}
Warning: the DataObject.getCookie(java.lang.Class<T>) method and DataObject.getLookup()
method are ment to be interchangable - e.g. if you override one of them
be sure to override also the other and try as much as possible to
keep the same content in each of them. The default implementation tries
to do that as much as possible.
getLookup in class MultiDataObjectpublic java.lang.String getName()
This implementation uses the name and extension of the primary file.
getName in class DataObjectpublic DataObject[] getChildren()
getChildren in interface DataObject.Containerpublic java.util.Enumeration<DataObject> children()
DataObjectspublic java.util.Enumeration<DataObject> children(boolean rec)
rec - whether to enumerate recursivelyDataObjectprotected org.openide.nodes.Node createNodeDelegate()
createNodeDelegate in class MultiDataObjectDataNodepublic org.openide.nodes.Children createNodeChildren(DataFilter filter)
Node. The provided filter can be
used to exclude some objects from the list.
Overriding this method is deprecated!
filter - filter of data objectspublic boolean isDeleteAllowed()
DataObjectisDeleteAllowed in class MultiDataObjecttrue if it maypublic boolean isCopyAllowed()
DataObjectisCopyAllowed in class MultiDataObjecttrue if it maypublic boolean isMoveAllowed()
DataObjectisMoveAllowed in class MultiDataObjecttrue if it maypublic boolean isRenameAllowed()
DataObjectisRenameAllowed in class MultiDataObjecttrue if it maypublic org.openide.util.HelpCtx getHelpCtx()
DataObjectgetHelpCtx in class MultiDataObjectpublic static DataFolder findFolder(org.openide.filesystems.FileObject fo)
fo - file objectjava.lang.IllegalArgumentException - if the file object is not folder
or if its responsible loader prevents the data object from being
instantiated - e.g. DataObject.find(org.openide.filesystems.FileObject) throws DataObjectNotFoundExceptionpublic static DataObject.Container findContainer(org.openide.filesystems.FileObject fo)
fo - file object (must be folder)java.lang.IllegalArgumentException - if the file object is not folderprotected DataObject handleCopy(DataFolder f) throws java.io.IOException
MultiDataObjecthandleCopy in class MultiDataObjectf - the new folderjava.io.IOException - if there was a problem copyingorg.openide.util.UserCancelException - if the user cancelled the copyprotected void handleDelete()
throws java.io.IOException
DataObjecthandleDelete in class MultiDataObjectjava.io.IOException - if an error occuresprotected org.openide.filesystems.FileObject handleRename(java.lang.String name)
throws java.io.IOException
DataObjecthandleRename in class MultiDataObjectname - name to rename the object tojava.io.IOException - if an error occuresprotected org.openide.filesystems.FileObject handleMove(DataFolder df) throws java.io.IOException
MultiDataObjecthandleMove in class MultiDataObjectdf - the new folderjava.io.IOException - if there was a problem movingorg.openide.util.UserCancelException - if the user cancelled the moveprotected DataObject handleCreateFromTemplate(DataFolder f, java.lang.String name) throws java.io.IOException
DataObjecthandleCreateFromTemplate in class MultiDataObjectf - data folder to create object inname - name to give to the new object (or null
if the name should be chosen according to the template)java.io.IOException - if an error occuredprotected DataShadow handleCreateShadow(DataFolder f) throws java.io.IOException
The default implementation creates a reference data shadow and pastes it into the specified folder.
handleCreateShadow in class DataObjectf - the folder to create a shortcut injava.io.IOExceptionBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.