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

UniFileLoader (NetBeans Loaders API) - NetBeans API Javadoc 5.0.0

 

org.openide.loaders
Class UniFileLoader

java.lang.Object
  extended byorg.openide.util.SharedClassObject
      extended byorg.openide.loaders.DataLoader
          extended byorg.openide.loaders.MultiFileLoader
              extended byorg.openide.loaders.UniFileLoader
All Implemented Interfaces:
Externalizable, Serializable

public abstract class UniFileLoader
extends MultiFileLoader

Support class for loader handling one file at a time. This is used for many file types, e.g. HTML, images, etc. File extensions recognized by the loader may be set.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.openide.loaders.DataLoader
DataLoader.RecognizedFiles
 
Field Summary
static String PROP_EXTENSIONS
          name of property with extensions
 
Fields inherited from class org.openide.loaders.DataLoader
PROP_ACTIONS, PROP_DISPLAY_NAME
 
Constructor Summary
protected UniFileLoader(Class representationClass)
          Constructor.
protected UniFileLoader(String representationClassName)
          Constructor.
 
Method Summary
protected abstract  MultiDataObject createMultiObject(FileObject primaryFile)
          Creates the right data object for a given primary file.
protected  MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile)
          Creates the right primary entry for a given primary file.
protected  MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile)
          Do not create a seconday entry.
protected  FileObject findPrimaryFile(FileObject fo)
          Get the primary file.
 ExtensionList getExtensions()
          Get the extension list for this data loader.
 void readExternal(ObjectInput oi)
          Reads nothing from the stream.
 void setExtensions(ExtensionList ext)
          Set the extension list for this data loader.
 void writeExternal(ObjectOutput oo)
          Writes extensions to the stream.
 
Methods inherited from class org.openide.loaders.MultiFileLoader
handleFindDataObject
 
Methods inherited from class org.openide.loaders.DataLoader
actionsContext, clearSharedData, defaultActions, defaultDisplayName, findDataObject, getActions, getDisplayName, getLoader, getRepresentationClass, getRepresentationClassName, markFile, setActions, setDisplayName
 
Methods inherited from class org.openide.util.SharedClassObject
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, initialize, putProperty, putProperty, removeNotify, removePropertyChangeListener, reset, writeReplace
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_EXTENSIONS

public static final String PROP_EXTENSIONS
name of property with extensions

See Also:
Constant Field Values
Constructor Detail

UniFileLoader

protected UniFileLoader(Class representationClass)
Constructor.

Parameters:
representationClass - class that is produced by this loader

UniFileLoader

protected UniFileLoader(String representationClassName)
Constructor.

Parameters:
representationClassName - the fully qualified name of the representation class.
Since:
1.10
Method Detail

findPrimaryFile

protected FileObject findPrimaryFile(FileObject fo)
Get the primary file. By default, only accepts files, not folders.

Specified by:
findPrimaryFile in class MultiFileLoader
Parameters:
fo - the file to find the primary file for
Returns:
the primary file, or null if its extension is not recognized

createMultiObject

protected abstract MultiDataObject createMultiObject(FileObject primaryFile)
                                              throws DataObjectExistsException,
                                                     IOException
Description copied from class: MultiFileLoader
Creates the right data object for a given primary file. It is guaranteed that the provided file will actually be the primary file returned by MultiFileLoader.findPrimaryFile(org.openide.filesystems.FileObject).

Specified by:
createMultiObject in class MultiFileLoader
Parameters:
primaryFile - the primary file
Returns:
the data object for this file
Throws:
DataObjectExistsException - if the primary file already has a data object
IOException

createPrimaryEntry

protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj,
                                                   FileObject primaryFile)
Description copied from class: MultiFileLoader
Creates the right primary entry for a given primary file.

Specified by:
createPrimaryEntry in class MultiFileLoader
Parameters:
obj - requesting object
primaryFile - primary file recognized by this loader
Returns:
primary entry for that file

createSecondaryEntry

protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj,
                                                     FileObject secondaryFile)
Do not create a seconday entry.

Specified by:
createSecondaryEntry in class MultiFileLoader
Parameters:
obj - ignored
secondaryFile - ignored
Returns:
never returns
Throws:
UnsupportedOperationException - because this loader supports only a primary file object

setExtensions

public void setExtensions(ExtensionList ext)
Set the extension list for this data loader.

Parameters:
ext - new list of extensions

getExtensions

public ExtensionList getExtensions()
Get the extension list for this data loader.

Returns:
list of extensions

writeExternal

public void writeExternal(ObjectOutput oo)
                   throws IOException
Writes extensions to the stream.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class DataLoader
Parameters:
oo - ignored
Throws:
IOException

readExternal

public void readExternal(ObjectInput oi)
                  throws IOException,
                         ClassNotFoundException
Reads nothing from the stream.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class DataLoader
Parameters:
oi - ignored
Throws:
IOException
ClassNotFoundException

 

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