站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

DataShadow (NetBeans Loaders API) - NetBeans API Javadoc 5.0.0

 

org.openide.loaders
Class DataShadow

java.lang.Object
  extended byorg.openide.loaders.DataObject
      extended byorg.openide.loaders.MultiDataObject
          extended byorg.openide.loaders.DataShadow
All Implemented Interfaces:
DataObject.Container, HelpCtx.Provider, Node.Cookie, Serializable

public class DataShadow
extends MultiDataObject
implements DataObject.Container

Default implementation of a shortcut to another data object. Since 1.13 it extends MultiDataObject.

See Also:
Serialized Form

Nested Class Summary
protected static class DataShadow.ShadowNode
          Node for a shadow object.
 
Nested classes inherited from class org.openide.loaders.MultiDataObject
MultiDataObject.Entry
 
Nested classes inherited from class org.openide.loaders.DataObject
DataObject.Container, DataObject.Registry
 
Field Summary
 
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
 
Fields inherited from interface org.openide.loaders.DataObject.Container
PROP_CHILDREN
 
Constructor Summary
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.
 
Method Summary
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.
 Node.Cookie getCookie(Class c)
          Look for a cookie in the current cookie set matching the requested class.
 HelpCtx getHelpCtx()
          Get help context for this 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()
           
 
Methods inherited from class org.openide.loaders.MultiDataObject
addSecondaryEntry, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCreateFromTemplate, handleDelete, handleRename, 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, getName, 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
 

Constructor Detail

DataShadow

protected DataShadow(FileObject fo,
                     DataObject original,
                     MultiFileLoader loader)
              throws DataObjectExistsException
Constructs new data shadow for given primary file and referenced original. Method to allow subclasses of data shadow.

Parameters:
fo - the primary file
original - original data object
loader - the loader that created the object

DataShadow

protected DataShadow(FileObject fo,
                     DataObject original,
                     DataLoader loader)
              throws DataObjectExistsException
Deprecated. Since 1.13 do not use this constructor, it is for backward compatibility only

Constructs new data shadow for given primary file and referenced original. Method to allow subclasses of data shadow.

Parameters:
fo - the primary file
original - original data object
loader - the loader that created the object
Method Detail

create

public static DataShadow create(DataFolder folder,
                                DataObject original)
                         throws IOException
Method that creates new data shadow in a folder. The name chosen is based on the name of the original object.

Parameters:
folder - target folder to create data in
original - orignal object that should be represented by the shadow
Throws:
IOException

create

public static DataShadow create(DataFolder folder,
                                String name,
                                DataObject original)
                         throws IOException
Method that creates new data shadow in a folder. The default extension is used.

Parameters:
folder - target folder to create data in
name - name to give to the shadow
original - object that should be represented by the shadow
Throws:
IOException

create

public static DataShadow create(DataFolder folder,
                                String name,
                                DataObject original,
                                String ext)
                         throws IOException
Method that creates new data shadow in a folder. All modifications are done atomicly using FileSystem.runAtomicAction(org.openide.filesystems.FileSystem.AtomicAction).

Parameters:
folder - target folder to create data in
name - name to give to the shadow
original - orignal object that should be represented by the shadow
Throws:
IOException

deserialize

protected static DataObject deserialize(FileObject fileObject)
                                 throws IOException
Tries to load the original file from a shadow. Looks for file contents as well as the originalFile/originalFileSystem attributes.

Parameters:
fileObject - a data shadow
Returns:
the original DataObject referenced by the shadow
Throws:
IOException - error during load or broken link

getOriginal

public DataObject getOriginal()
Return the original shadowed object.

Returns:
the data object

getChildren

public DataObject[] getChildren()
Implementation of Container interface.

Specified by:
getChildren in interface DataObject.Container
Returns:
array of one element, the original

createNodeDelegate

protected Node createNodeDelegate()
Description copied from class: MultiDataObject
Provides node that should represent this data object.

Overrides:
createNodeDelegate in class MultiDataObject
Returns:
the node representation
See Also:
DataNode

isDeleteAllowed

public boolean isDeleteAllowed()
Description copied from class: DataObject
Test whether the object may be deleted.

Overrides:
isDeleteAllowed in class MultiDataObject

isCopyAllowed

public boolean isCopyAllowed()
Description copied from class: DataObject
Test whether the object may be copied.

Overrides:
isCopyAllowed in class MultiDataObject

isMoveAllowed

public boolean isMoveAllowed()
Description copied from class: DataObject
Test whether the object may be moved.

Overrides:
isMoveAllowed in class MultiDataObject

isRenameAllowed

public boolean isRenameAllowed()
Description copied from class: DataObject
Test whether the object may be renamed.

Overrides:
isRenameAllowed in class MultiDataObject

getHelpCtx

public HelpCtx getHelpCtx()
Description copied from class: DataObject
Get help context for this object.

Specified by:
getHelpCtx in interface HelpCtx.Provider
Overrides:
getHelpCtx in class MultiDataObject

handleCreateShadow

protected DataShadow handleCreateShadow(DataFolder f)
                                 throws IOException
Description copied from class: DataObject
Creates shadow for this object in specified folder (overridable in subclasses).

The default implementation creates a reference data shadow and pastes it into the specified folder.

Overrides:
handleCreateShadow in class DataObject
Parameters:
f - the folder to create a shortcut in
Returns:
the shadow
Throws:
IOException

getCookie

public Node.Cookie getCookie(Class c)
Description copied from class: MultiDataObject
Look for a cookie in the current cookie set matching the requested class.

Overrides:
getCookie in class MultiDataObject
Parameters:
c - the class to look for
Returns:
an instance of that class, or null if this class of cookie is not supported

refresh

public void refresh()

handleCopy

protected DataObject handleCopy(DataFolder f)
                         throws IOException
Description copied from class: MultiDataObject
Copies primary and secondary files to new folder. May ask for user confirmation before overwriting.

Overrides:
handleCopy in class MultiDataObject
Parameters:
f - the new folder
Returns:
data object for the new primary
Throws:
IOException - if there was a problem copying

handleMove

protected FileObject handleMove(DataFolder f)
                         throws IOException
Description copied from class: MultiDataObject
Moves primary and secondary files to a new folder. May ask for user confirmation before overwriting.

Overrides:
handleMove in class MultiDataObject
Parameters:
f - the new folder
Returns:
the moved primary file object
Throws:
IOException - if there was a problem moving

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.