public class DataShadow extends MultiDataObject implements DataObject.Container
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DataShadow.ShadowNode
Node for a shadow object.
|
MultiDataObject.EntryDataObject.Container, DataObject.Factory, DataObject.RegistryPROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALIDPROP_CHILDREN| Modifier | Constructor and Description |
|---|---|
protected |
DataShadow(FileObject fo,
DataObject original,
DataLoader loader)
Deprecated.
Since 1.13 do not use this constructor, it is for backward compatibility only
|
protected |
DataShadow(FileObject fo,
DataObject original,
MultiFileLoader loader)
Constructs new data shadow for given primary file and referenced original.
|
| Modifier and Type | Method and Description |
|---|---|
static DataShadow |
create(DataFolder folder,
DataObject original)
Method that creates new data shadow in a folder.
|
static DataShadow |
create(DataFolder folder,
String name,
DataObject original)
Method that creates new data shadow in a folder.
|
static DataShadow |
create(DataFolder folder,
String name,
DataObject original,
String ext)
Method that creates new data shadow in a folder.
|
protected Node |
createNodeDelegate()
Provides node that should represent this data object.
|
protected static DataObject |
deserialize(FileObject fileObject)
Tries to load the original file from a shadow.
|
DataObject[] |
getChildren()
Implementation of Container interface.
|
<T extends Node.Cookie> |
getCookie(Class<T> c)
Look for a cookie in the current cookie set matching the requested class.
|
HelpCtx |
getHelpCtx()
Get help context for this object.
|
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 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() |
addSecondaryEntry, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopyRename, handleCreateFromTemplate, handleDelete, handleRename, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLockaddPropertyChangeListener, 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, writeReplaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPropertyChangeListener, removePropertyChangeListenerprotected DataShadow(FileObject fo, DataObject original, MultiFileLoader loader) throws DataObjectExistsException
fo - the primary fileoriginal - original data objectloader - the loader that created the objectDataObjectExistsException@Deprecated protected DataShadow(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 IOException
folder - target folder to create data inoriginal - original object that should be represented by the shadowIOExceptionpublic static DataShadow create(DataFolder folder, String name, DataObject original) throws IOException
folder - target folder to create data inname - name to give to the shadoworiginal - object that should be represented by the shadowIOExceptionpublic static DataShadow create(DataFolder folder, String name, DataObject original, String ext) throws 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 shadowIOExceptionprotected static DataObject deserialize(FileObject fileObject) throws IOException
fileObject - a data shadowDataObject referenced by the shadowIOException - error during load or broken linkpublic DataObject getOriginal()
public DataObject[] getChildren()
getChildren in interface DataObject.Containerprotected 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 HelpCtx getHelpCtx()
DataObjectgetHelpCtx in interface HelpCtx.ProvidergetHelpCtx in class MultiDataObjectprotected DataShadow handleCreateShadow(DataFolder f) throws 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 inIOExceptionpublic <T extends Node.Cookie> T getCookie(Class<T> c)
MultiDataObjectgetCookie in class MultiDataObjectc - the class to look fornull if this class of cookie
is not supportedpublic 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 interface Lookup.ProvidergetLookup in class DataObjectpublic void refresh()
protected DataObject handleCopy(DataFolder f) throws IOException
MultiDataObjecthandleCopy in class MultiDataObjectf - the new folderIOException - if there was a problem copyingUserCancelException - if the user cancelled the copyprotected FileObject handleMove(DataFolder f) throws IOException
MultiDataObjecthandleMove in class MultiDataObjectf - the new folderIOException - if there was a problem movingUserCancelException - if the user cancelled the moveBuilt on August 24 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.