org.openide.text
Class DataEditorSupport.Env

java.lang.Object
  |
  +--org.openide.loaders.OpenSupport.Env
        |
        +--org.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

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.
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, findCloneableOpenSupport, 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, findCloneableOpenSupport, 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.
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

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


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.