Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.loaders 5.9.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Nested Class Summary
`static class` | `DataEditorSupport.Env` Environment that connects the data object and the CloneableEditorSupport.

Nested classes/interfaces inherited from class org.openide.text.CloneableEditorSupport
`CloneableEditorSupport.Pane`

Field Summary

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 boolean` | `canClose()` Checks whether is possible to close support components.
`static CloneableEditorSupport` | `create(DataObject obj, MultiDataObject.Entry entry, CookieSet set)` Factory method to create simple CloneableEditorSupport for a given entry of a given DataObject.
`protected StyledDocument` | `createStyledDocument(EditorKit kit)` Let's the super method create the document and also annotates it with Title and StreamDescription properities.
`protected String` | `documentID()`
`static DataObject` | `findDataObject(Line l)` Support method that extracts a DataObject from a Line.
`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` | `messageHtmlName()`
`protected String` | `messageLine(Line line)` Computes display name for a line based on the name of the associated DataObject and the line number.
`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.
`protected void` | `notifyClosed()` Called when closed all components.
`void` | `saveDocument()` Saves document.

Methods inherited from class org.openide.text.CloneableEditorSupport
`addChangeListener, addPropertyChangeListener, close, createCloneableEditor, createCloneableTopComponent, createEditorKit, createPane, createPositionRef, createUndoRedoManager, firePropertyChange, getDocument, getInputStream, getLineSet, getOpenedPanes, getUndoRedo, isDocumentLoaded, isModified, loadFromStreamToKit, notifyModified, notifyUnmodified, open, openAt, openDocument, prepareDocument, print, reloadDocument, removeChangeListener, removePropertyChangeListener, saveFromKitToStream, setMIMEType, updateTitles, wrapEditorComponent`

Methods inherited from class org.openide.windows.CloneableOpenSupport
`close, edit, 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

### create

    public static CloneableEditorSupport create(DataObject obj,
                                                MultiDataObject.Entry entry,
                                                CookieSet set)

  Factory method to create simple CloneableEditorSupport for a given entry of a given DataObject. The common use inside DataObject looks like this:

        getCookieSet().add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), getCookieSet()));

  Parameters:
    `obj` - the data object
    `entry` - the entry to read and write from
    `set` - cookie set to add remove additional cookies (currently only `SaveCookie`)
  Returns:
    a subclass of DataEditorSupport that implements at least `OpenCookie`, `EditCookie`, `EditorCookie.Observable`, `PrintCookie`, `CloseCookie`
  Since:
    5.2

### 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.

  Specified by:
    `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.

  Specified by:
    `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.

  Specified by:
    `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.

  Specified by:
    `messageName` in class `CloneableEditorSupport`
  Returns:
    name of the editor

### messageHtmlName

    protected String messageHtmlName()

  Overrides:
    `messageHtmlName` in class `CloneableEditorSupport`

### documentID

    protected String documentID()

  Overrides:
    `documentID` in class `CloneableEditorSupport`

### messageToolTip

    protected String messageToolTip()

  Text to use as tooltip for component.

  Specified by:
    `messageToolTip` in class `CloneableEditorSupport`
  Returns:
    text to show to the user

### messageLine

    protected String messageLine(Line line)

  Computes display name for a line based on the name of the associated DataObject and the line number.

  Overrides:
    `messageLine` in class `CloneableEditorSupport`
  Parameters:
    `line` - the line object to compute display name for
  Returns:
    display name for the line like "MyFile.java:243"
  Since:
    4.3

### 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

### notifyClosed

    protected void notifyClosed()

  Called when closed all components. Overrides superclass method, also unregisters listening on node delegate.

  Overrides:
    `notifyClosed` in class `CloneableEditorSupport`

### 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

### canClose

    protected boolean canClose()

  Checks whether is possible to close support components. Overrides superclass method, adds checking for read-only property of saving file and warns user in that case.

  Overrides:
    `canClose` in class `CloneableEditorSupport`

### saveDocument

    public void saveDocument()
                      throws IOException

  Saves document. Overrides superclass method, adds checking for read-only property of saving file and warns user in that case.

  Overrides:
    `saveDocument` in class `CloneableEditorSupport`
  Throws:
    `IOException`

### findDataObject

    public static DataObject findDataObject(Line l)

  Support method that extracts a DataObject from a Line. If the line is created by a DataEditorSupport then associated DataObject can be accessed by this method.

  Parameters:
    `l` - line object
  Returns:
    data object or null
  Since:
    4.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.loaders 5.9.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.