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

DataEditorSupport.Env (NetBeans Loaders API) - NetBeans API Javadoc 4.1.0

 

org.openide.text
Class DataEditorSupport.Env

java.lang.Object
  extended byorg.openide.loaders.OpenSupport.Env
      extended byorg.openide.text.DataEditorSupport.Env
All Implemented Interfaces:
CloneableEditorSupport.Env, CloneableOpenSupport.Env, EventListener, PropertyChangeListener, Serializable, VetoableChangeListener
Enclosing class:
DataEditorSupport

public abstract static class DataEditorSupport.Env
extends OpenSupport.Env
implements CloneableEditorSupport.Env, Serializable, PropertyChangeListener, VetoableChangeListener

Environment that connects the data object and the CloneableEditorSupport.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.openide.text.CloneableEditorSupport.Env
PROP_TIME
 
Fields inherited from interface org.openide.windows.CloneableOpenSupport.Env
PROP_MODIFIED, PROP_VALID
 
Constructor Summary
DataEditorSupport.Env(DataObject obj)
          Constructor.
 
Method Summary
protected  void changeFile()
          Method that allows subclasses to notify this environment that the file associated with this support has changed and that the environment should listen on modifications of different file object.
 CloneableOpenSupport findCloneableOpenSupport()
          Method that allows environment to find its cloneable open support.
protected abstract  FileObject getFile()
          Getter for file associated with this environment.
 String getMimeType()
          Mime type of the document.
 Date getTime()
          The time when the data has been modified
 InputStream inputStream()
          Obtains the input stream.
 void markModified()
          First of all tries to lock the primary file and if it succeeds it marks the data object modified.
 OutputStream outputStream()
          Obtains the output stream.
protected abstract  FileLock takeLock()
          Locks the file.
 void unmarkModified()
          Reverse method that can be called to make the environment unmodified.
 
Methods inherited from class org.openide.loaders.OpenSupport.Env
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getDataObject, isModified, isValid, propertyChange, removePropertyChangeListener, removeVetoableChangeListener, vetoableChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openide.windows.CloneableOpenSupport.Env
addPropertyChangeListener, addVetoableChangeListener, isModified, isValid, removePropertyChangeListener, removeVetoableChangeListener
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface java.beans.VetoableChangeListener
vetoableChange
 

Constructor Detail

DataEditorSupport.Env

public DataEditorSupport.Env(DataObject obj)
Constructor.

Parameters:
obj - this support should be associated with
Method Detail

getFile

protected abstract FileObject getFile()
Getter for file associated with this environment.

Returns:
the file input/output operation should be performed on

takeLock

protected abstract FileLock takeLock()
                              throws IOException
Locks the file.

Returns:
the lock on the file getFile ()
Throws:
IOException - if the file cannot be locked

changeFile

protected final void changeFile()
Method that allows subclasses to notify this environment that the file associated with this support has changed and that the environment should listen on modifications of different file object.


inputStream

public InputStream inputStream()
                        throws IOException
Obtains the input stream.

Specified by:
inputStream in interface CloneableEditorSupport.Env
Throws:
IOException - if an I/O error occures

outputStream

public OutputStream outputStream()
                          throws IOException
Obtains the output stream.

Specified by:
outputStream in interface CloneableEditorSupport.Env
Throws:
IOException - if an I/O error occures

getTime

public Date getTime()
The time when the data has been modified

Specified by:
getTime in interface CloneableEditorSupport.Env

getMimeType

public String getMimeType()
Mime type of the document.

Specified by:
getMimeType in interface CloneableEditorSupport.Env
Returns:
the mime type to use for the document

markModified

public void markModified()
                  throws IOException
First of all tries to lock the primary file and if it succeeds it marks the data object modified.

Note: There is a contract (better saying a curse) that this method has to call takeLock() method in order to keep working some special filesystem's feature. See issue #28212.

Specified by:
markModified in interface CloneableOpenSupport.Env
Overrides:
markModified in class OpenSupport.Env
Throws:
IOException - if the environment cannot be marked modified (for example when the file is readonly), when such exception is the support should discard all previous changes
See Also:
FileObject.isReadOnly()

unmarkModified

public void unmarkModified()
Reverse method that can be called to make the environment unmodified.

Specified by:
unmarkModified in interface CloneableOpenSupport.Env
Overrides:
unmarkModified in class OpenSupport.Env

findCloneableOpenSupport

public CloneableOpenSupport findCloneableOpenSupport()
Description copied from class: OpenSupport.Env
Method that allows environment to find its cloneable open support.

Specified by:
findCloneableOpenSupport in interface CloneableOpenSupport.Env
Overrides:
findCloneableOpenSupport in class OpenSupport.Env
Returns:
the support or null if the environemnt is not in valid state and the CloneableOpenSupport cannot be found for associated data object

 

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