ilog.views.appframe.docview
Class IlvTextDocument

java.lang.Object
  extended by ilog.views.appframe.docview.IlvAbstractDocument
      extended by ilog.views.appframe.docview.IlvAbstractFileDocument
          extended by ilog.views.appframe.docview.IlvTextDocument
All Implemented Interfaces:
IlvDocument, IlvFileDocument, IlvStreamDocument, ActionHandler, MessageListener, IlvPropertyManager, ActionListener, EventListener

public class IlvTextDocument
extends IlvAbstractFileDocument

Defines documents that are associated with javax.swing.text.Document objects.


Field Summary
 
Fields inherited from class ilog.views.appframe.docview.IlvAbstractFileDocument
PATHNAME_PROPERTY
 
Fields inherited from class ilog.views.appframe.docview.IlvAbstractDocument
REDO_CMD, UNDO_CMD
 
Fields inherited from interface ilog.views.appframe.docview.IlvFileDocument
FILE_FILTER_PROPERTY, MRU_PROPERTY
 
Fields inherited from interface ilog.views.appframe.docview.IlvDocument
APPLICATION_PROPERTY, ATTACHED_DOCUMENTS_PROPERTY, DOCUMENT_OWNER_PROPERTY, DOCUMENT_TEMPLATE_PROPERTY, EDITABLE_PROPERTY, MODIFIED_PROPERTY, SAVEABLE_PROPERTY, TITLE_PROPERTY
 
Fields inherited from interface ilog.views.appframe.docview.IlvDocument
APPLICATION_PROPERTY, ATTACHED_DOCUMENTS_PROPERTY, DOCUMENT_OWNER_PROPERTY, DOCUMENT_TEMPLATE_PROPERTY, EDITABLE_PROPERTY, MODIFIED_PROPERTY, SAVEABLE_PROPERTY, TITLE_PROPERTY
 
Constructor Summary
IlvTextDocument()
          Constructs a new empty IlvTextDocument.
 
Method Summary
 void clean()
          Cleans up the document.
protected  Document createTextDocument()
          Factory method for creating a javax.swing.text.Document instance to associate with the text document.
 Document getTextDocument()
          Returns the Document instance associated with this document.
 boolean initializeDocument(Object userData)
          Initializes a new text document.
protected  void initializeTextDocument(Document document)
          Initializes a new created text document.
protected  boolean readDocument(Reader reader, IlvFileFilter filter)
          Reads the text of the document data from the specified reader.
 boolean writeDocument(Writer writer, IlvFileFilter filter)
          Writes the document text to the specified writer.
 
Methods inherited from class ilog.views.appframe.docview.IlvAbstractFileDocument
activated, getFileDocumentTemplate, getPathName, readDocument, readStreamDocument, setPathName, writeDocument, writeStreamDocument
 
Methods inherited from class ilog.views.appframe.docview.IlvAbstractDocument
actionPerformed, addActionHandler, addEdit, addPropertyChangeListener, addView, attachDocument, canRedo, canUndo, documentClosed, documentClosing, getActiveView, getApplication, getDocumentTemplate, getProperty, getTitle, getUndoManager, getView, getViewCount, getViews, isModified, isProcessingAction, notifyViews, receiveMessage, redo, registerMappings, removeActionHandler, removePropertyChangeListener, removeView, removeViews, setApplication, setModified, setProperty, setTitle, undo, updateAction, updateModificationState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.views.appframe.docview.IlvDocument
addView, documentClosed, documentClosing, getApplication, getDocumentTemplate, getTitle, getView, getViewCount, isModified, removeView, removeViews, setModified, setTitle
 
Methods inherited from interface ilog.views.appframe.event.ActionHandler
isProcessingAction, updateAction
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 
Methods inherited from interface ilog.views.appframe.event.MessageListener
receiveMessage
 
Methods inherited from interface ilog.views.appframe.util.IlvPropertyManager
addPropertyChangeListener, getProperty, removePropertyChangeListener, setProperty
 
Methods inherited from interface ilog.views.appframe.docview.IlvDocument
addView, documentClosed, documentClosing, getApplication, getDocumentTemplate, getTitle, getView, getViewCount, isModified, removeView, removeViews, setModified, setTitle
 
Methods inherited from interface ilog.views.appframe.event.ActionHandler
isProcessingAction, updateAction
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 
Methods inherited from interface ilog.views.appframe.event.MessageListener
receiveMessage
 
Methods inherited from interface ilog.views.appframe.util.IlvPropertyManager
addPropertyChangeListener, getProperty, removePropertyChangeListener, setProperty
 

Constructor Detail

IlvTextDocument

public IlvTextDocument()
Constructs a new empty IlvTextDocument.

Method Detail

initializeDocument

public boolean initializeDocument(Object userData)
Initializes a new text document. If the specified user data is a string, the text of the javax.swing.text.Document instance associated with this text document will be set to this string.

Specified by:
initializeDocument in interface IlvDocument
Overrides:
initializeDocument in class IlvAbstractDocument
Parameters:
userData - The user data to initialize the document with; can be null.
Returns:
true: an overridden method returns true if the document was successfully initialized, false otherwise.
See Also:
createTextDocument(), IlvApplication.newDocument(java.lang.Object, boolean), IlvApplication.newDocument(), IlvApplication.newDocument(IlvDocumentTemplate, boolean, Object)

clean

public void clean()
Cleans up the document.

Called before the document closes or before the document is initialized with new data if the document template of the document is not MDI. (See IlvDocumentTemplate.isMDI()).

Specified by:
clean in interface IlvDocument
Overrides:
clean in class IlvAbstractDocument

readDocument

protected boolean readDocument(Reader reader,
                               IlvFileFilter filter)
Reads the text of the document data from the specified reader. If a javax.swing.text.Document instance has not been initialized for the document, it is created with the method createTextDocument() and initialized with the method initializeTextDocument(javax.swing.text.Document).
This text read from the specified reader is then set to this javax.swing.text.Document instance.

Overrides:
readDocument in class IlvAbstractFileDocument
Parameters:
reader - The reader to read document text from.
filter - Parameter not used by default.
Returns:
true if the document could read its data; false otherwise.
See Also:
createTextDocument()

writeDocument

public boolean writeDocument(Writer writer,
                             IlvFileFilter filter)
Writes the document text to the specified writer.

Overrides:
writeDocument in class IlvAbstractFileDocument
Parameters:
writer - The writer to write the data of the document to.
filter - Parameter not used by default.
Returns:
true if the document could write its data; false otherwise.
See Also:
IlvAbstractFileDocument.writeDocument(java.net.URL, IlvFileFilter)

getTextDocument

public Document getTextDocument()
Returns the Document instance associated with this document.


createTextDocument

protected Document createTextDocument()
Factory method for creating a javax.swing.text.Document instance to associate with the text document.


initializeTextDocument

protected void initializeTextDocument(Document document)
Initializes a new created text document. By default, an undoable edit listener is added to the document for updating the undo, redo and repeat actions.

Parameters:
document - The new text document to initialize.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.