public class IlvDataContainerDocument extends IlvAbstractFileDocument implements IlvDataContainerProvider
Modifier and Type | Field and Description |
---|---|
static String |
DATA_CONTAINER_PROPERTY
Bound property name for the data container associated with the document.
|
static String |
NODE_DOCUMENTS_ATTACHED_PROPERTY
Bound property name for the mode that determines whether node documents
created by this document are attached to it.
|
PATHNAME_PROPERTY
REDO_CMD, UNDO_CMD
FILE_FILTER_PROPERTY, MRU_PROPERTY
APPLICATION_PROPERTY, ATTACHED_DOCUMENTS_PROPERTY, DOCUMENT_OWNER_PROPERTY, DOCUMENT_TEMPLATE_PROPERTY, EDITABLE_PROPERTY, MODIFIED_PROPERTY, SAVEABLE_PROPERTY, TITLE_PROPERTY
Constructor and Description |
---|
IlvDataContainerDocument()
Constructs an empty
IlvDataContainerDocument . |
Modifier and Type | Method and Description |
---|---|
boolean |
areNodeDocumentsAttached()
Determines whether the node documents are attached to the data container
document.
|
void |
attachNodeDocuments(boolean attach)
Attaches or detaches the document created by this document for associating
with the data container nodes.
|
boolean |
canOpenDocument(Object node)
Determines whether a new document can be opened and associated with
the specified data container
node . |
protected IlvDataContainer |
createDataContainer(Object userData)
Factory method for creating a new data container to associate with this
document.
|
protected IlvDocument |
createDocument(Object node)
Factory method for creating a document to associate with the specified
data container
node . |
protected void |
endInitializeDataContainer(IlvDataContainer dataContainer)
Finishes initializing the specified
dataContainer . |
IlvDataContainer |
getDataContainer()
Returns the data container associated with this document.
|
String |
getNodeTitle(Object node)
Returns the title associated with the specified data container
node . |
IlvDocument |
getOpenDocument(Object node)
Retrieves a document opened for the specified
node . |
protected void |
initializeDataContainer(IlvDataContainer dataContainer,
Object userData)
Initializes the specified
dataContainer . |
boolean |
initializeDocument(Object userData)
Initializes a new data container document.
|
IlvDocument |
openDocument(Object node)
Opens a document associated with the specified data container
node . |
protected boolean |
readDataContainer(IlvDataContainer dataContainer,
Reader reader,
IlvFileFilter filter)
Reads the content of the specified
dataContainer from the
specified reader . |
protected boolean |
readDocument(Reader reader,
IlvFileFilter filter)
Reads a data container from the specified
reader . |
boolean |
readDocument(URL url,
IlvFileFilter filter)
Initializes the document data from the specified file
url . |
void |
setDataContainer(IlvDataContainer dataContainer)
Sets the data container of this document.
|
void |
setNodeTitle(Object node,
String title)
Sets the title associated with the specified data container
node . |
protected boolean |
writeDataContainer(IlvDataContainer dataContainer,
Writer writer,
IlvFileFilter filter)
Writes the content of the specified
dataContainer into the
specified writer . |
boolean |
writeDocument(URL url,
IlvFileFilter filter)
Stores the document data in the file with the specified
url . |
boolean |
writeDocument(Writer writer,
IlvFileFilter filter)
Writes the associated data container to the specified
writer . |
activated, getFileDocumentTemplate, getPathName, readStreamDocument, setPathName, writeStreamDocument
actionPerformed, addActionHandler, addEdit, addPropertyChangeListener, addView, attachDocument, canRedo, canUndo, clean, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addView, clean, documentClosed, documentClosing, getApplication, getDocumentTemplate, getTitle, getView, getViewCount, isModified, removeView, removeViews, setModified, setTitle
isProcessingAction, updateAction
actionPerformed
receiveMessage
addPropertyChangeListener, getProperty, removePropertyChangeListener, setProperty
public static final String DATA_CONTAINER_PROPERTY
getDataContainer()
,
Constant Field Valuespublic static final String NODE_DOCUMENTS_ATTACHED_PROPERTY
Boolean.TRUE
, node
documents are attached to the document. Otherwise, node documents are not
attached.areNodeDocumentsAttached()
,
Constant Field Valuespublic IlvDataContainerDocument()
IlvDataContainerDocument
.public boolean initializeDocument(Object userData)
userData
is an IlvDataContainer
instance, it will be associated with the document with the method
setDataContainer(ilog.views.appframe.docview.project.IlvDataContainer)
. Otherwise, a new data container is created
with the method createDataContainer(java.lang.Object)
and associated with the
document.initializeDocument
in interface IlvDocument
initializeDocument
in class IlvAbstractDocument
userData
- The user data to initialize the document with - can be
null
or an IlvDataContainer
instance.false
if the document could not create a new
data container; true
otherwise.IlvApplication.newDocument(java.lang.Object, boolean)
,
IlvApplication.newDocument()
,
IlvApplication.newDocument(IlvDocumentTemplate, boolean, Object)
public IlvDataContainer getDataContainer()
getDataContainer
in interface IlvDataContainerProvider
setDataContainer(ilog.views.appframe.docview.project.IlvDataContainer)
,
DATA_CONTAINER_PROPERTY
public void setDataContainer(IlvDataContainer dataContainer)
DATA_CONTAINER_PROPERTY
.dataContainer
- The new data container of the document.getDataContainer()
,
DATA_CONTAINER_PROPERTY
public boolean readDocument(URL url, IlvFileFilter filter)
url
.
By default, a reader is created from the specified URL and is given
as the parameter to the readDocument(Reader, IlvFileFilter)
method.readDocument
in interface IlvFileDocument
readDocument
in class IlvAbstractFileDocument
url
- The URL of the file from which the data must be read.filter
- The file filter that indicates the format to use for
reading the data.true
if the document could read its data;
false
otherwise.writeDocument(java.net.URL, ilog.views.appframe.docview.IlvFileFilter)
protected boolean readDocument(Reader reader, IlvFileFilter filter)
reader
.
If no data container has already been associated with the document, a
new one will be created. The readDataContainer(ilog.views.appframe.docview.project.IlvDataContainer, java.io.Reader, ilog.views.appframe.docview.IlvFileFilter)
method is then
invoked with the data container of the document as the parameter.readDocument
in class IlvAbstractFileDocument
reader
- The reader to read the data from.filter
- The file filter that indicates the format to use for
reading the data.true
if a data container can be read;
false
otherwise.readDataContainer(ilog.views.appframe.docview.project.IlvDataContainer, java.io.Reader, ilog.views.appframe.docview.IlvFileFilter)
protected boolean readDataContainer(IlvDataContainer dataContainer, Reader reader, IlvFileFilter filter)
dataContainer
from the
specified reader
.dataContainer
- The data container to read the data of.reader
- The reader to read from.filter
- The file filter that indicates the format to use for
reading the data.true
if the data container can be read;
false
otherwise.endInitializeDataContainer(ilog.views.appframe.docview.project.IlvDataContainer)
public boolean writeDocument(URL url, IlvFileFilter filter)
url
.
By default, a writer is created from the specified URL and given
as the parameter to the writeDocument(Writer, IlvFileFilter)
method.writeDocument
in interface IlvFileDocument
writeDocument
in class IlvAbstractFileDocument
url
- The URL of the file to which the data is written.filter
- The file filter that indicates the format to use for
writing the data.true
if the document could write its data;
false
otherwise.writeDocument(Writer, IlvFileFilter)
public boolean writeDocument(Writer writer, IlvFileFilter filter)
writer
.
The implementation of this method is empty.writeDocument
in class IlvAbstractFileDocument
writer
- The writer to write the data of the document to.filter
- The file filter that indicates the format to use for
writing the data.true
if the document can write its data;
false
otherwise.readDocument(java.net.URL, ilog.views.appframe.docview.IlvFileFilter)
protected boolean writeDataContainer(IlvDataContainer dataContainer, Writer writer, IlvFileFilter filter)
dataContainer
into the
specified writer
.dataContainer
- The data container to read the data of.writer
- The writer to writer into.filter
- The file filter that indicates the format to use for
writing the data.true
if the data container can be written;
false
otherwise.readDataContainer(ilog.views.appframe.docview.project.IlvDataContainer, java.io.Reader, ilog.views.appframe.docview.IlvFileFilter)
protected IlvDataContainer createDataContainer(Object userData)
IlvDefaultDataContainer
. It can be overridden to create
other data container types.userData
- The user data parameter of the initializeDocument(java.lang.Object)
method - can be null
.IlvDataContainer
instance.protected void initializeDataContainer(IlvDataContainer dataContainer, Object userData)
dataContainer
.
This method is called when the document is initializing with the
initializeDocument
method and after the method
createDataContainer(java.lang.Object)
has been called. By default, it does nothing.
It can be overridden to create a default hierarchy of data that corresponds
to a document just initialized. For example, it is overridden by the
IlvProjectDocument
to create a project root node that
corresponds to the project document.dataContainer
- The data container to initialize.userData
- The user data parameter of the initializeDocument(java.lang.Object)
method - can be null
.endInitializeDataContainer(ilog.views.appframe.docview.project.IlvDataContainer)
protected void endInitializeDataContainer(IlvDataContainer dataContainer)
dataContainer
.
This method is called after the document and its associated
data container have been initialized, whether
with the initializeDocument
or readDocument
method. By default it does nothing. It should be overridden to finish
initializing the data container of the document, whether it was
initialized from a file or by default.
IlvProjectDocument
class for adding listeners to the
root node of the data container.dataContainer
- The data container to finish initializing.initializeDataContainer(ilog.views.appframe.docview.project.IlvDataContainer, java.lang.Object)
public IlvDocument openDocument(Object node)
node
.
If a document was previously created for this node
,
it would be reactivated with its views. If its views have been closed,
new views will be created
and activated.
If no document was previously created for this node
, a new
one would be created, together with the views for editing it.
node
- The node to create a document for.null
if a document
cannot be created for the specified node.public boolean canOpenDocument(Object node)
node
.
By default, it returns true
.true
if the node
can be opened;
false
otherwise.public boolean areNodeDocumentsAttached()
If node documents are attached to this document, they will be closed when this document closes. Otherwise, they must be closed by the application user after this document is closed and node file documents appear in the Most Recently Used file list managed by the application.
In both modes, the application user can close the node document.
true
if the documents associated with data container
nodes are attached to this document; false
otherwise.attachNodeDocuments(boolean)
,
IlvApplication.attachDocument(ilog.views.appframe.docview.IlvDocument, ilog.views.appframe.docview.IlvDocument)
,
NODE_DOCUMENTS_ATTACHED_PROPERTY
,
attachNodeDocuments(boolean)
public void attachNodeDocuments(boolean attach)
Triggers a property change event for the
NODE_DOCUMENTS_ATTACHED_PROPERTY
.
attach
- If true
, node documents will be attached to this
document. Otherwise, node documents are not attached.areNodeDocumentsAttached()
,
NODE_DOCUMENTS_ATTACHED_PROPERTY
public IlvDocument getOpenDocument(Object node)
node
.node
- The node to retrieve an associated document from.null
if no document has previously been opened for this node.openDocument(java.lang.Object)
protected IlvDocument createDocument(Object node)
node
.
This method is invoked by the openDocument(java.lang.Object)
method to create
a new document.public String getNodeTitle(Object node)
node
.
IlvDataContainer.getTitle(java.lang.Object)
for the specified node.node
- The node to get a title for.IlvDataContainer.getTitle(java.lang.Object)
,
setNodeTitle(java.lang.Object, java.lang.String)
public void setNodeTitle(Object node, String title)
node
.
IlvDataContainer.setTitle(java.lang.Object, java.lang.String)
for the specified node with the
specified title
.node
- The node to associate a new title with.title
- The new title of the node.IlvDataContainer.setTitle(java.lang.Object, java.lang.String)
,
getNodeTitle(java.lang.Object)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.