|
||||||||||
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.InstanceDataObject
A data object whose only purpose is to supply InstanceCookie
.
The instances are created by default instantiation; the name of the class
to instantiate is stored on disk, typically right in the file name.
This data object is generally used to configure menus and toolbars,
though it could be used in any situation requiring instances to be present in
a folder; for example, anything using FolderInstance
.
Typical instance classes are subclasses of SystemAction
to make
menu items or toolbar buttons; JSeparator
for a menu
separator; or JToolBar.Separator
for a toolbar
separator.
Use create(org.openide.loaders.DataFolder, java.lang.String, java.lang.String)
and remove(org.openide.loaders.DataFolder, java.lang.String, java.lang.String)
to make the objects.
Better yet, use an XML filesystem to install them declaratively.
Inner classes inherited from class org.openide.loaders.MultiDataObject |
MultiDataObject.Entry |
Inner classes inherited from class org.openide.loaders.DataObject |
DataObject.Registry |
Inner classes inherited from class org.openide.cookies.InstanceCookie |
InstanceCookie.Origin |
Field Summary | |
static String |
INSTANCE
File extension for instance data objects. |
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 | |
InstanceDataObject(FileObject pf,
MultiFileLoader loader)
Create a new instance. |
Method Summary | |
static InstanceDataObject |
create(DataFolder folder,
String name,
Class clazz)
Deprecated. Use of XML filesystems to install instances is preferred. |
static InstanceDataObject |
create(DataFolder folder,
String name,
String className)
Deprecated. Use of XML filesystems to install instances is preferred. |
protected Node |
createNodeDelegate()
Provides node that should represent this data object. |
static InstanceDataObject |
find(DataFolder folder,
String name,
Class clazz)
Finds instance of specified name in a given folder. |
static InstanceDataObject |
find(DataFolder folder,
String name,
String className)
Finds instance of specified name in a given folder. |
HelpCtx |
getHelpCtx()
Get help context for this object. |
String |
getName()
Get the name of the data object. |
protected FileObject |
handleRename(String name)
Rename this object (implemented in subclasses). |
Class |
instanceClass()
The representation type that may be created as instances. |
Object |
instanceCreate()
Create an instance. |
String |
instanceName()
The bean name for the instance. |
static boolean |
remove(DataFolder folder,
String name,
Class clazz)
Deprecated. Use of XML filesystems to install instances is preferred. |
static boolean |
remove(DataFolder folder,
String name,
String className)
Deprecated. Use of XML filesystems to install instances is preferred. |
Methods inherited from class org.openide.loaders.MultiDataObject |
addSecondaryEntry, files, findSecondaryEntry, getCookie, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopy, handleCreateFromTemplate, handleDelete, handleMove, isCopyAllowed, isDeleteAllowed, isMoveAllowed, isRenameAllowed, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLock |
Methods inherited from class org.openide.loaders.DataObject |
addPropertyChangeListener, addVetoableChangeListener, copy, createFromTemplate, createFromTemplate, createShadow, delete, dispose, find, firePropertyChange, fireVetoableChange, getFolder, getLoader, 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 |
Field Detail |
public static final String INSTANCE
Constructor Detail |
public InstanceDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException
create(org.openide.loaders.DataFolder, java.lang.String, java.lang.String)
.pf
- primary file object for this data objectloader
- the loaderDataObjectExistsException
- if it already existsMethod Detail |
public static InstanceDataObject find(DataFolder folder, String name, String className)
folder
- the folder to create the instance data object inname
- the name to give to the object (can be null
if no special name besides the class name is needed)className
- the name of the class the new object should provide an instance ofpublic static InstanceDataObject find(DataFolder folder, String name, Class clazz)
folder
- the folder to create the instance data object inname
- the name to give to the object (can be null
if no special name besides the class name is needed)clazz
- the class to create instance for (see class header for details)public static InstanceDataObject create(DataFolder folder, String name, String className) throws IOException
InstanceDataObject
in a given folder. If object with specified name already exists, it is returned.
You should specify the name if there is a chance another file of the same
instance class already exists in the folder; or just to provide a more
descriptive name, which will appear in the Explorer for example.folder
- the folder to create the instance data object inname
- the name to give to the object (can be null
if no special name besides the class name is needed)className
- the name of the class the new object should provide an instance of (see class header for details)IOException
- if the file cannot be createdpublic static InstanceDataObject create(DataFolder folder, String name, Class clazz) throws IOException
InstanceDataObject
in a given folder. If object with specified name already exists, it is returned.
You should specify the name if there is a chance another file of the same
instance class already exists in the folder; or just to provide a more
descriptive name, which will appear in the Explorer for example.folder
- the folder to create the instance data object inname
- the name to give to the object (can be null
if no special name besides the class name is needed)clazz
- the class to create instance for (see class header for details)IOException
- if the file cannot be createdpublic static boolean remove(DataFolder folder, String name, String className)
DataObject.delete()
;
this method lets you delete an instance you do not have an exact record
of the file name for, based on the same information used to create it.folder
- the folder to remove the file fromname
- the name of the instance (can be null
)className
- the name of class the object referred to (see class header for details)true
if the instance was succesfully removed, false
if notpublic static boolean remove(DataFolder folder, String name, Class clazz)
DataObject.delete()
;
this method lets you delete an instance you do not have an exact record
of the file name for, based on the same information used to create it.folder
- the folder to remove the file fromname
- the name of the instance (can be null
)className
- the name of class the object referred to (see class header for details)true
if the instance was succesfully removed, false
if notpublic HelpCtx getHelpCtx()
DataObject
getHelpCtx
in class MultiDataObject
org.openide.loaders.DataObject
protected Node createNodeDelegate()
MultiDataObject
createNodeDelegate
in class MultiDataObject
org.openide.loaders.MultiDataObject
DataNode
public String instanceName()
InstanceCookie
instanceName
in interface InstanceCookie
org.openide.cookies.InstanceCookie
public Class instanceClass() throws IOException, ClassNotFoundException
InstanceCookie
instanceClass
in interface InstanceCookie
org.openide.cookies.InstanceCookie
IOException
- if an I/O error occurredClassNotFoundException
- if a class was not foundpublic Object instanceCreate() throws IOException, ClassNotFoundException
InstanceCookie
instanceCreate
in interface InstanceCookie
org.openide.cookies.InstanceCookie
InstanceCookie.instanceClass()
IOException
- if an I/O error occuredClassNotFoundException
- if a class was not foundpublic String getName()
DataObject
The default implementation uses the name of the primary file.
getName
in class DataObject
org.openide.loaders.DataObject
protected 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 occures
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |