DataObject.Container, org.openide.nodes.Node.Cookiepublic class DataShadow extends MultiDataObject implements DataObject.Container
| Modifier and Type | Class | Description |
|---|---|---|
protected static class |
DataShadow.ShadowNode |
Node for a shadow object.
|
DataObject.Container, DataObject.Factory, DataObject.Registration, DataObject.Registrations, DataObject.RegistryMultiDataObject.EntryPROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALIDPROP_CHILDREN| Modifier | Constructor | Description |
|---|---|---|
protected |
DataShadow(org.openide.filesystems.FileObject fo,
DataObject original,
DataLoader loader) |
Deprecated.
Since 1.13 do not use this constructor, it is for backward compatibility only
|
protected |
DataShadow(org.openide.filesystems.FileObject fo,
DataObject original,
MultiFileLoader loader) |
Constructs new data shadow for given primary file and referenced original.
|
| Modifier and Type | Method | Description |
|---|---|---|
static DataShadow |
create(DataFolder folder,
java.lang.String name,
DataObject original) |
Method that creates new data shadow in a folder.
|
static DataShadow |
create(DataFolder folder,
java.lang.String name,
DataObject original,
java.lang.String ext) |
Method that creates new data shadow in a folder.
|
static DataShadow |
create(DataFolder folder,
DataObject original) |
Method that creates new data shadow in a folder.
|
protected org.openide.nodes.Node |
createNodeDelegate() |
Provides node that should represent this data object.
|
protected static DataObject |
deserialize(org.openide.filesystems.FileObject fileObject) |
Tries to load the original file from a shadow.
|
static org.openide.filesystems.FileObject |
findOriginal(org.openide.filesystems.FileObject fileObject) |
Tries to locate the original file from a shadow.
|
DataObject[] |
getChildren() |
Implementation of Container interface.
|
<T extends org.openide.nodes.Node.Cookie> |
getCookie(java.lang.Class<T> c) |
Look for a cookie in the current cookie set matching the requested class.
|
org.openide.util.HelpCtx |
getHelpCtx() |
Get help context for this object.
|
org.openide.util.Lookup |
getLookup() |
Represents a context of the data object.
|
DataObject |
getOriginal() |
Return the original shadowed object.
|
protected DataObject |
handleCopy(DataFolder f) |
Copies primary and secondary files to new folder.
|
protected DataShadow |
handleCreateShadow(DataFolder f) |
Creates shadow for this object in specified folder (overridable in subclasses).
|
protected org.openide.filesystems.FileObject |
handleMove(DataFolder f) |
Moves primary and secondary files to a new folder.
|
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 |
refresh() |
addPropertyChangeListener, addVetoableChangeListener, copy, createFromTemplate, createFromTemplate, createFromTemplate, createShadow, delete, dispose, find, firePropertyChange, fireVetoableChange, getCookie, getFolder, getLoader, getName, getNodeDelegate, getPrimaryFile, getRegistry, isModified, isShadowAllowed, isTemplate, isValid, markFiles, move, removePropertyChangeListener, removeVetoableChangeListener, rename, setModified, setTemplate, setValid, toString, writeReplaceaddPropertyChangeListener, removePropertyChangeListeneraddSecondaryEntry, associateLookup, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopyRename, handleCreateFromTemplate, handleDelete, handleRename, registerEditor, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLockprotected DataShadow(org.openide.filesystems.FileObject fo,
DataObject original,
MultiFileLoader loader)
throws DataObjectExistsException
fo - the primary fileoriginal - original data objectloader - the loader that created the objectDataObjectExistsException@Deprecated
protected DataShadow(org.openide.filesystems.FileObject fo,
DataObject original,
DataLoader loader)
throws DataObjectExistsException
fo - the primary fileoriginal - original data objectloader - the loader that created the objectDataObjectExistsExceptionpublic static DataShadow create(DataFolder folder, DataObject original) throws java.io.IOException
folder - target folder to create data inoriginal - original object that should be represented by the shadowjava.io.IOExceptionpublic static DataShadow create(DataFolder folder, java.lang.String name, DataObject original) throws java.io.IOException
folder - target folder to create data inname - name to give to the shadoworiginal - object that should be represented by the shadowjava.io.IOExceptionpublic static DataShadow create(DataFolder folder, java.lang.String name, DataObject original, java.lang.String ext) throws java.io.IOException
FileSystem.runAtomicAction(org.openide.filesystems.FileSystem.AtomicAction).folder - target folder to create data inname - name to give to the shadoworiginal - original object that should be represented by the shadowjava.io.IOExceptionpublic static org.openide.filesystems.FileObject findOriginal(org.openide.filesystems.FileObject fileObject)
throws java.io.IOException
null, if the target file could not be found (broken link)fileObject - a data shadowFileObject referenced by the shadowjava.io.IOException - error during loadUtilities.translate(java.lang.String)protected static DataObject deserialize(org.openide.filesystems.FileObject fileObject) throws java.io.IOException
fileObject - a data shadowDataObject referenced by the shadowjava.io.IOException - error during load or broken linkUtilities.translate(java.lang.String)public DataObject getOriginal()
public DataObject[] getChildren()
getChildren in interface DataObject.Containerprotected org.openide.nodes.Node createNodeDelegate()
MultiDataObjectcreateNodeDelegate in class MultiDataObjectDataNodepublic 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 MultiDataObjectprotected DataShadow handleCreateShadow(DataFolder f) throws java.io.IOException
DataObjectThe 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.IOExceptionpublic <T extends org.openide.nodes.Node.Cookie> T getCookie(java.lang.Class<T> c)
MultiDataObjectgetCookie in class MultiDataObjectc - the class to look fornull if this class of cookie
is not supportedpublic 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 void refresh()
protected 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 org.openide.filesystems.FileObject handleMove(DataFolder f) throws java.io.IOException
MultiDataObjecthandleMove in class MultiDataObjectf - the new folderjava.io.IOException - if there was a problem movingorg.openide.util.UserCancelException - if the user cancelled the moveBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.