|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.loaders.DataObject | +--org.openide.loaders.MultiDataObject | +--org.openide.loaders.DataFolder
A folder containing data objects. Is actually itself a data object, whose primary (and only) file object is a file folder.
Has special support for determining the sorting of the folder, or even explicit ordering of the children.
Inner Class Summary | |
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. |
Inner classes inherited from class org.openide.loaders.MultiDataObject |
MultiDataObject.Entry |
Inner classes inherited from class org.openide.loaders.DataObject |
DataObject.Container, DataObject.Registry |
Field Summary | |
static String |
PROP_CHILDREN
Name of property that holds children of this node. |
static String |
PROP_ORDER
Name of property for order of children. |
static String |
PROP_SORT_MODE
Name of property which decides sorting mode. |
static String |
SET_SORTING
Name of set with sorting options. |
Fields inherited from class org.openide.loaders.DataObject |
PROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALID |
Constructor Summary | |
|
DataFolder(FileObject fo)
Create a data folder from a folder file object. |
protected |
DataFolder(FileObject fo,
DataLoader loader)
Deprecated. Since 1.13 do not use this constructor, it is for backward compatibility only. |
protected |
DataFolder(FileObject fo,
MultiFileLoader loader)
Create a data folder from a folder file object. |
Method Summary | |
Enumeration |
children()
Get enumeration of children of this folder. |
Enumeration |
children(boolean rec)
Enumerate all children of this folder. |
static DataFolder |
create(DataFolder folder,
String name)
Helper method to find or create a folder of a given path. |
Children |
createNodeChildren(DataFilter filter)
Support method to obtain a children object that can be added to any Node . |
protected Node |
createNodeDelegate()
Create node representative for this folder. |
static DataObject.Container |
findContainer(FileObject fo)
Finds a DataObject.Container representing given folder. |
static DataFolder |
findFolder(FileObject fo)
Create a folder for a specified file object. |
DataObject[] |
getChildren()
Get the children of this folder. |
Node.Cookie |
getCookie(Class cookie)
Adds a compilation cookie . |
HelpCtx |
getHelpCtx()
Get help context for this object. |
String |
getName()
Get the name of the data folder. |
DataFolder.SortMode |
getSortMode()
Get the sort mode of the folder. |
protected DataObject |
handleCopy(DataFolder f)
Copy this object to a folder. |
protected DataObject |
handleCreateFromTemplate(DataFolder f,
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 FileObject |
handleMove(DataFolder df)
Moves primary and secondary files to a new folder. |
protected FileObject |
handleRename(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. |
Methods inherited from class org.openide.loaders.MultiDataObject |
addSecondaryEntry, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLock |
Methods inherited from class org.openide.loaders.DataObject |
addPropertyChangeListener, addVetoableChangeListener, copy, 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, writeReplace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openide.loaders.DataObject.Container |
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
public static final String PROP_CHILDREN
public static final String PROP_SORT_MODE
public static final String PROP_ORDER
public static final String SET_SORTING
Constructor Detail |
public DataFolder(FileObject fo) throws DataObjectExistsException, IllegalArgumentException
fo
- file folder to work onDataObjectExistsException
- if there is one alreadyIllegalArgumentException
- if fo
is not folderprotected DataFolder(FileObject fo, MultiFileLoader loader) throws DataObjectExistsException, IllegalArgumentException
fo
- file folder to work onloader
- data loader for this data objectDataObjectExistsException
- if there is one alreadyIllegalArgumentException
- if fo
is not folderprotected DataFolder(FileObject fo, DataLoader loader) throws DataObjectExistsException, IllegalArgumentException
fo
- file folder to work onloader
- data loader for this data objectDataObjectExistsException
- if there is one alreadyIllegalArgumentException
- if fo
is not folderMethod Detail |
public static DataFolder create(DataFolder folder, String name) throws IOException
folder
- the folder to start inname
- a subfolder path (e.g. com/mycom/testfolder
)IOException
- if the I/O failspublic final void setSortMode(DataFolder.SortMode mode) throws IOException
mode
- an constant from DataFolder.SortMode
IOException
- if the mode cannot be setpublic final DataFolder.SortMode getSortMode()
public final void setOrder(DataObject[] arr) throws 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 cancelledIOException
- if the order cannot be setpublic String getName()
This implementation uses the name and extension of the primary file.
getName
in class DataObject
public DataObject[] getChildren()
getChildren
in interface DataObject.Container
public Enumeration children()
DataObject
spublic Enumeration children(boolean rec)
rec
- whether to enumerate recursivelyDataObject
public Node.Cookie getCookie(Class cookie)
compilation cookie
.getCookie
in class MultiDataObject
org.openide.loaders.MultiDataObject
type
- the class to look fornull
if this class of cookie
is not supportedprotected Node createNodeDelegate()
createNodeDelegate
in class MultiDataObject
org.openide.loaders.MultiDataObject
DataNode
public 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()
DataObject
isDeleteAllowed
in class MultiDataObject
org.openide.loaders.DataObject
true
if it maypublic boolean isCopyAllowed()
DataObject
isCopyAllowed
in class MultiDataObject
org.openide.loaders.DataObject
true
if it maypublic boolean isMoveAllowed()
DataObject
isMoveAllowed
in class MultiDataObject
org.openide.loaders.DataObject
true
if it maypublic boolean isRenameAllowed()
DataObject
isRenameAllowed
in class MultiDataObject
org.openide.loaders.DataObject
true
if it maypublic HelpCtx getHelpCtx()
DataObject
getHelpCtx
in class MultiDataObject
org.openide.loaders.DataObject
public static DataFolder findFolder(FileObject fo)
fo
- file objectIllegalArgumentException
- if the file object is not folderpublic static DataObject.Container findContainer(FileObject fo)
fo
- file object (must be folder)IllegalArgumentException
- if the file object is not folderprotected DataObject handleCopy(DataFolder f) throws IOException
handleCopy
in class MultiDataObject
f
- the folder to copy object toIOException
- if something went wrongprotected void handleDelete() throws IOException
DataObject
handleDelete
in class MultiDataObject
org.openide.loaders.DataObject
IOException
- if an error occuresprotected FileObject handleRename(String name) throws IOException
DataObject
handleRename
in class MultiDataObject
org.openide.loaders.DataObject
name
- name to rename the object toIOException
- if an error occuresprotected FileObject handleMove(DataFolder df) throws IOException
MultiDataObject
handleMove
in class MultiDataObject
org.openide.loaders.MultiDataObject
df
- the new folderIOException
- if there was a problem movingUserCancelException
- if the user cancelled the moveprotected DataObject handleCreateFromTemplate(DataFolder f, String name) throws IOException
DataObject
handleCreateFromTemplate
in class MultiDataObject
org.openide.loaders.DataObject
df
- 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)IOException
- if an error occuredprotected DataShadow handleCreateShadow(DataFolder f) throws IOException
The default implementation creates a reference data shadow and pastes it into the specified folder.
handleCreateShadow
in class DataObject
f
- the folder to create a shortcut in
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |