org.openide.text
Class DataEditorSupport

java.lang.Object
  |
  +--org.openide.windows.CloneableOpenSupport
        |
        +--org.openide.text.CloneableEditorSupport
              |
              +--org.openide.text.DataEditorSupport

public class DataEditorSupport
extends CloneableEditorSupport

Support for associating an editor and a Swing Document to a data object.


Inner Class Summary
static class DataEditorSupport.Env
          Environment that connects the data object and the CloneableEditorSupport.
 
Inner classes inherited from class org.openide.text.CloneableEditorSupport
CloneableEditorSupport.Env
 
Inner classes inherited from class org.openide.windows.CloneableOpenSupport
CloneableOpenSupport.Env
 
Fields inherited from class org.openide.text.CloneableEditorSupport
EDITOR_MODE
 
Fields inherited from class org.openide.windows.CloneableOpenSupport
allEditors, env
 
Constructor Summary
DataEditorSupport(DataObject obj, CloneableEditorSupport.Env env)
          Editor support for a given data object.
 
Method Summary
protected  StyledDocument createStyledDocument(EditorKit kit)
          Let's the super method create the document and also annotates it with Title and StreamDescription properities.
 DataObject getDataObject()
          Getter of the data object that this support is associated with.
protected  void initializeCloneableEditor(CloneableEditor editor)
          Annotates the editor with icon from the data object and also sets appropriate selected node.
protected  String messageName()
          Constructs message that should be used to name the editor component.
protected  String messageOpened()
          Message to display when an object has been opened.
protected  String messageOpening()
          Message to display when an object is being opened.
protected  String messageSave()
          Constructs message that should be displayed when the data object is modified and is being closed.
protected  String messageToolTip()
          Text to use as tooltip for component.
 
Methods inherited from class org.openide.text.CloneableEditorSupport
addChangeListener, canClose, close, createCloneableEditor, createCloneableTopComponent, createEditorKit, createPositionRef, createUndoRedoManager, getDocument, getLineSet, getOpenedPanes, getUndoRedo, isDocumentLoaded, isModified, loadFromStreamToKit, notifyClosed, notifyModified, notifyUnmodified, openDocument, prepareDocument, print, reloadDocument, removeChangeListener, saveDocument, saveFromKitToStream, setMIMEType, updateTitles
 
Methods inherited from class org.openide.windows.CloneableOpenSupport
close, edit, open, openCloneableTopComponent, view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataEditorSupport

public DataEditorSupport(DataObject obj,
                         CloneableEditorSupport.Env env)
Editor support for a given data object. The file is taken from the data object and is updated if the object moves or renames itself.
Parameters:
obj - object to work with
env - environment to pass to
Method Detail

getDataObject

public final DataObject getDataObject()
Getter of the data object that this support is associated with.
Returns:
data object passed in constructor

messageOpening

protected String messageOpening()
Message to display when an object is being opened.
Overrides:
messageOpening in class CloneableOpenSupport
Returns:
the message or null if nothing should be displayed

messageOpened

protected String messageOpened()
Message to display when an object has been opened.
Overrides:
messageOpened in class CloneableOpenSupport
Returns:
the message or null if nothing should be displayed

messageSave

protected String messageSave()
Constructs message that should be displayed when the data object is modified and is being closed.
Overrides:
messageSave in class CloneableEditorSupport
Returns:
text to show to the user

messageName

protected String messageName()
Constructs message that should be used to name the editor component.
Overrides:
messageName in class CloneableEditorSupport
Returns:
name of the editor

messageToolTip

protected String messageToolTip()
Text to use as tooltip for component.
Overrides:
messageToolTip in class CloneableEditorSupport
Returns:
text to show to the user

initializeCloneableEditor

protected void initializeCloneableEditor(CloneableEditor editor)
Annotates the editor with icon from the data object and also sets appropriate selected node. But only in the case the data object is valid. This implementation also listen to display name and icon chamges of the node and keeps editor top component up-to-date. If you override this method and not call super, please note that you will have to keep things synchronized yourself.
Overrides:
initializeCloneableEditor in class CloneableEditorSupport
Parameters:
editor - the editor that has been created and should be annotated

createStyledDocument

protected StyledDocument createStyledDocument(EditorKit kit)
Let's the super method create the document and also annotates it with Title and StreamDescription properities.
Overrides:
createStyledDocument in class CloneableEditorSupport
Parameters:
kit - kit to user to create the document
Returns:
the document annotated by the properties


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