|
||||||||||
| 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
Provides support for handling of data objects with multiple files.
One file is represented by one MultiDataObject.Entry. Each handler
has one primary entry and zero or more secondary entries.
| Inner Class Summary | |
class |
MultiDataObject.Entry
Represents one file in a group data object. |
| Inner classes inherited from class org.openide.loaders.DataObject |
DataObject.Container, DataObject.Registry |
| 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 | |
MultiDataObject(FileObject fo,
MultiFileLoader loader)
Create a handler. |
|
| Method Summary | |
protected void |
addSecondaryEntry(MultiDataObject.Entry fe)
Add a new secondary entry to the list. |
protected Node |
createNodeDelegate()
Provides node that should represent this data object. |
Set |
files()
Get all contained files. |
MultiDataObject.Entry |
findSecondaryEntry(FileObject fo)
For a given file, find the associated secondary entry. |
Node.Cookie |
getCookie(Class type)
Look for a cookie in the current cookie set matching the requested class. |
protected CookieSet |
getCookieSet()
Get the set of cookies. |
HelpCtx |
getHelpCtx()
Get help context for this object. |
MultiFileLoader |
getMultiFileLoader()
Getter for the multi file loader that created this object. |
MultiDataObject.Entry |
getPrimaryEntry()
Get the primary entry. |
protected DataObject |
handleCopy(DataFolder df)
Copies primary and secondary files to new folder. |
protected DataObject |
handleCreateFromTemplate(DataFolder df,
String name)
Create a new data object from template (implemented 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. |
protected MultiDataObject.Entry |
registerEntry(FileObject fo)
Tests whether this file is between entries and if not, creates a secondary entry for it and adds it into set of secondary entries. |
protected void |
removeSecondaryEntry(MultiDataObject.Entry fe)
Remove a secondary entry from the list. |
Set |
secondaryEntries()
Get secondary entries. |
protected void |
setCookieSet(CookieSet s)
Deprecated. just use getCookieSet().add(...) instead |
protected FileLock |
takePrimaryFileLock()
Obtains lock for primary file. |
| Methods inherited from class org.openide.loaders.DataObject |
addPropertyChangeListener, addVetoableChangeListener, copy, createFromTemplate, createFromTemplate, createShadow, delete, dispose, find, firePropertyChange, fireVetoableChange, getCookie, getFolder, getLoader, getName, getNodeDelegate, getPrimaryFile, getRegistry, handleCreateShadow, 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 |
| Constructor Detail |
public MultiDataObject(FileObject fo,
MultiFileLoader loader)
throws DataObjectExistsException
fo - the primary file objectloader - loader of this data object| Method Detail |
public final MultiFileLoader getMultiFileLoader()
public Set files()
DataObjectimportant flag set appropriately.
The default implementation returns a set consisting only of the primary file.
files in class DataObjectorg.openide.loaders.DataObjectFileObjectspublic boolean isDeleteAllowed()
DataObjectisDeleteAllowed in class DataObjectorg.openide.loaders.DataObjecttrue if it maypublic boolean isCopyAllowed()
DataObjectisCopyAllowed in class DataObjectorg.openide.loaders.DataObjecttrue if it maypublic boolean isMoveAllowed()
DataObjectisMoveAllowed in class DataObjectorg.openide.loaders.DataObjecttrue if it maypublic boolean isRenameAllowed()
DataObjectisRenameAllowed in class DataObjectorg.openide.loaders.DataObjecttrue if it maypublic HelpCtx getHelpCtx()
DataObjectgetHelpCtx in class DataObjectorg.openide.loaders.DataObjectprotected Node createNodeDelegate()
createNodeDelegate in class DataObjectDataNodeprotected final void addSecondaryEntry(MultiDataObject.Entry fe)
fe - the entry to addprotected final void removeSecondaryEntry(MultiDataObject.Entry fe)
fe - the entry to removeprotected final MultiDataObject.Entry registerEntry(FileObject fo)
This method should be used in constructor of MultiDataObject to
register all the important files, that could belong to this data object.
As example, our XMLDataObject, tries to locate its xmlinfo
file and then do register it
fo - the file to register (can be null, then the action is ignored)public final MultiDataObject.Entry getPrimaryEntry()
public final Set secondaryEntries()
MultiDataObject.Entryspublic final MultiDataObject.Entry findSecondaryEntry(FileObject fo)
fo - file objectnull if there is no
such entry
protected FileLock takePrimaryFileLock()
throws IOException
DataObjecttakePrimaryFileLock in class DataObjectorg.openide.loaders.DataObjectIOException - if taking the lock fails
protected DataObject handleCopy(DataFolder df)
throws IOException
handleCopy in class DataObjectdf - the new folderIOException - if there was a problem copyingUserCancelException - if the user cancelled the copy
protected void handleDelete()
throws IOException
DataObjecthandleDelete in class DataObjectorg.openide.loaders.DataObjectIOException - if an error occures
protected FileObject handleRename(String name)
throws IOException
DataObjecthandleRename in class DataObjectorg.openide.loaders.DataObjectname - name to rename the object toIOException - if an error occures
protected FileObject handleMove(DataFolder df)
throws IOException
handleMove in class DataObjectdf - the new folderIOException - if there was a problem movingUserCancelException - if the user cancelled the move
protected DataObject handleCreateFromTemplate(DataFolder df,
String name)
throws IOException
DataObjecthandleCreateFromTemplate in class DataObjectorg.openide.loaders.DataObjectdf - 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 final void setCookieSet(CookieSet s)
DataObject.PROP_COOKIE.s - the cookie set to useprotected final CookieSet getCookieSet()
setCookieSet(org.openide.nodes.CookieSet), that set
is returned. Otherwise an empty set is
returned.null)public Node.Cookie getCookie(Class type)
getCookie in class DataObjecttype - the class to look fornull if this class of cookie
is not supported
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||