public class IlvDocumentViewConfiguration extends Object
containerTemplates/containerTemplate
XPath
expression starting from the settings element defining the document
template.
View configuration properties
The view configuration initializes its properties from the settings element
that defines the configuration in the settings. Those properties are:
name
attribute, it defines the
name of the view configuration. This name is used to
retrieve the view configuration from the document template with
the method IlvDocumentTemplate.getViewConfiguration(java.lang.String)
.mainWindowTarget
attribute,
it defines the name of the container template that this view configuration
is associated with. This name is accessible with the method
getTemplateName()
.
autoCreate
attribute, it
determines whether a view container is automatically created for
this view configuration when a document is created. It is accessible
with the methods isAutoCreate()
and setAutoCreate(boolean)
.automaticTitle
attribute, it determines whether a title is automatically set
for the newly created view containers. If not specified, the value
of this property will be Boolean.TRUE
. It is accessible with
the methods isAutomaticContainerTitle()
and
isAutomaticContainerTitle()
.defaultTitle
attribute, it specifies the default title for view containers
created by the view configuration. It is accessible with
the methods getDefaultContainerTitle()
and
setDefaultContainerTitle(java.lang.String)
.closeDocumentOnClose
attribute, it determines whether documents associated with
the view container created for this configuration should be
closed when the view container is closed. It is accessible with
the methods isCloseDocumentOnClose()
and
setCloseDocumentOnClose(boolean)
.icon
attribute,
it provides the icon for the view configuration. It is accessible
with the methods getIcon()
and setIcon(javax.swing.Icon)
. Creation of view containers
The document template that created the view configuration
delegates the creation of view containers to the view configuration by
invoking its method newViewContainer(ilog.views.appframe.docview.IlvDocument, boolean)
.
A view configuration creates a view container using a container template
that is associated with the configuration when the method
connectMainWindow(ilog.views.appframe.docview.IlvMainWindow)
is invoked by the document template.
If the container template is an IlvMDIContainerTemplate
, a view container is
created for each new instance of the documents. For each
<viewTemplate>
child element
of the element initializing the view configuration, a document view is
created, using the method createView(ilog.views.appframe.settings.IlvSettingsElement, int, ilog.views.appframe.docview.IlvViewContainer)
. All created views are then
added to the new MDI view container.
Otherwise, the container template is an IlvSingleContainerTemplate
and
one view container is shared among all the instances of documents created
by the document template of the view configuration. However, at any one time,
the container is referred to by only one document - the document
currently active in the application. This container is
provided with the method IlvSingleContainerTemplate.getViewContainer()
.
Modifier and Type | Field and Description |
---|---|
static String |
ICON_ATTRIBUTE
The name of the settings attribute that specifies the icon
of this configuration.
|
Constructor and Description |
---|
IlvDocumentViewConfiguration(String name)
Constructs a new
IlvDocumentViewConfiguration with the
specified name . |
Modifier and Type | Method and Description |
---|---|
void |
connectMainWindow(IlvMainWindow mainWindow)
Initializes this configuration with the specified
mainWindow . |
protected IlvDocumentView |
createView(IlvSettingsElement viewTemplateElement,
int viewIndex,
IlvViewContainer container)
Instantiates a view according to the settings specification provided with
the
viewTemplateElement . |
IlvContainerTemplate |
getContainerTemplate()
Returns the container template associated with this view configuration.
|
String |
getDefaultContainerTitle()
Returns the default title to set to the view container created for this view
configuration.
|
IlvDocumentTemplate |
getDocumentTemplate()
Returns the document template that has created this view configuration.
|
Icon |
getIcon()
Returns the icon of this view configuration.
|
String |
getName()
Returns the name of this configuration.
|
String |
getTemplateName()
Returns the name of the container template that creates or provides view
containers for this configuration.
|
boolean |
isAutoCreate()
Determines whether this document view configuration is automatically
used for creating a container and its view(s) when a new document has been
created.
|
boolean |
isAutomaticContainerTitle()
Determines whether the view containers created for this view container
have titles set automatically according to the associated document title.
|
boolean |
isCloseDocumentOnClose()
Determines whether the document associated with a container created for
this configuration is closed when the container is closed.
|
boolean |
isContainerActiveByDefault()
Determines whether the container created for this configuration
should be automatically activated when created.
|
boolean |
isMDI()
Determines whether this configuration creates MDI containers.
|
IlvViewContainer |
newViewContainer(IlvDocument document,
boolean activateContainer)
Creates a new view container according to the parameters of this view
configuration.
|
void |
readSettings(IlvSettingsElement element,
IlvSettings settings)
Reads the settings of this document view configuration from the specified
settings element.
|
void |
setAutoCreate(boolean autoCreate)
Specifies whether this document view configuration should automatically
provide a view container and its view(s) when a new document is created.
|
void |
setAutomaticContainerTitle(boolean automatic)
Specifies whether the view containers created for this view container
have titles set automatically according to the associated document title.
|
void |
setCloseDocumentOnClose(boolean closeDocumentOnClose)
Closes the document associated with a container created for this
configuration, depending on the value of the specified parameter.
|
void |
setContainerActiveByDefault(boolean active)
Determines whether the container created for this configuration should be
automatically activated when created.
|
void |
setContainerTemplate(IlvContainerTemplate containerTemplate)
Sets the container template associated with this view configuration.
|
void |
setDefaultContainerTitle(String title)
Sets the default title to set to the view container created for this
view configuration.
|
void |
setDocumentTemplate(IlvDocumentTemplate documentTemplate)
Sets the document template associated with this document view configuration.
|
void |
setIcon(Icon icon)
Specifies the icon of this view configuration.
|
void |
setName(String name)
Sets the name of this configuration.
|
public static final String ICON_ATTRIBUTE
The value of this attribute should be a relative path to the
icon file that can be resolved into a full pathname by
the method IlvApplication.getImageIcon()
.
getIcon()
,
Constant Field Valuespublic IlvDocumentViewConfiguration(String name)
IlvDocumentViewConfiguration
with the
specified name
.name
- The name of the configuration.getName()
,
setName(java.lang.String)
public IlvViewContainer newViewContainer(IlvDocument document, boolean activateContainer)
document
- The document to link the newly created views with.activateContainer
- If true
, the view container will be
activated after it has been created. Otherwise, it is not
activated.null
if the view
container could not be created.getContainerTemplate()
protected IlvDocumentView createView(IlvSettingsElement viewTemplateElement, int viewIndex, IlvViewContainer container)
viewTemplateElement
. This method is only invoked if
the container template associated with the view configuration is an
IlvMDIContainerTemplate
.viewTemplateElement
- The settings element that stores information
on how the view should be created. By default, the javaClass
attribute of this element provides the class of the view to instantiate.viewIndex
- The index of the view within its view container. By
default, this parameter is not used.container
- The container the view will be inserted into.public void readSettings(IlvSettingsElement element, IlvSettings settings)
element
- The settings element to read the configuration settings from.settings
- The settings of the settings element.public void connectMainWindow(IlvMainWindow mainWindow)
mainWindow
.
This method is automatically invoked by the document template of the
view configuration. It allows the view configuration to initialize
its container template, which is given by the main window with its
IlvMainWindow.getContainerTemplate(java.lang.String)
method, giving as the
parameter the name of the template returned by getTemplateName()
.mainWindow
- The main window to initialize the configuration with.getTemplateName()
public final String getName()
"name"
attribute of the settings element specified
with the readSettings
method.setName(java.lang.String)
public void setName(String name)
name
- The new name of the configuration.getName()
public String getTemplateName()
mainWindowTarget
attribute of the settings element specified
with the readSettings(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.settings.IlvSettings)
method. If the attribute value is
null
, the name of the configuration is returned.connectMainWindow(ilog.views.appframe.docview.IlvMainWindow)
public boolean isMDI()
true
if this configuration creates MDI containers like
IlvInternalFrame
instances or
false
if this configuration provides a view container
that is shared by all the documents created by the document template of
this view configuration.public boolean isAutoCreate()
true
if containers of this configuration are
automatically created when a document is created. Otherwise, container and
views for this configuration can be created later, using the method
of the document template IlvDocumentTemplate.newViewContainer(IlvDocument, String, boolean)
.setAutoCreate(boolean)
public void setAutoCreate(boolean autoCreate)
autoCreate
- If true
, view containers are automatically
created. Otherwise, they are created later using the
method IlvDocumentTemplate.newViewContainer(IlvDocument, String, boolean)
.isAutoCreate()
public IlvDocumentTemplate getDocumentTemplate()
setDocumentTemplate(ilog.views.appframe.docview.IlvDocumentTemplate)
public void setDocumentTemplate(IlvDocumentTemplate documentTemplate)
documentTemplate
- The new document template of this configuration.getDocumentTemplate()
public IlvContainerTemplate getContainerTemplate()
public void setContainerTemplate(IlvContainerTemplate containerTemplate)
containerTemplate
- The new container template of this view configuration.getContainerTemplate()
public boolean isAutomaticContainerTitle()
true
if created view containers have their titles
set automatically by the document template;
false
otherwise, in which case, it is the responsibility of
the user to set the title to the container.setAutomaticContainerTitle(boolean)
public void setAutomaticContainerTitle(boolean automatic)
automatic
- If true
, the title of the next created
view containers will be automatically set according to the title of the
associated document. If false
, the user is responsible for
setting the title to the container.isAutomaticContainerTitle()
public String getDefaultContainerTitle()
This method is invoked only if the method isAutomaticContainerTitle()
returns false
. The default title is initialized from the
settings, with the defaultTitle
attribute of the
settings element providing the settings of this view configuration.
null
if the method
isAutomaticContainerTitle()
returns true
.setDefaultContainerTitle(java.lang.String)
,
isAutomaticContainerTitle()
,
setAutomaticContainerTitle(boolean)
public void setDefaultContainerTitle(String title)
title
- The default title. This parameter can be a key to a string
resource that will be translated before setting to the view container.getDefaultContainerTitle()
,
isAutomaticContainerTitle()
,
setAutomaticContainerTitle(boolean)
public boolean isCloseDocumentOnClose()
This property only applies if this view configuration is MDI (see isMDI()
).
If the property is true
, the document
will be closed when the container is closed, implying the closing of other
containers created for the document.
Otherwise, if only one container has been created for a document,
the document will be closed automatically when the container
is closed.
setCloseDocumentOnClose(boolean)
public void setCloseDocumentOnClose(boolean closeDocumentOnClose)
closeDocumentOnClose
- If true
, the document associated
with a container of this configuration is closed when the container is
closed, whatever other containers have been created for the document.isCloseDocumentOnClose()
public boolean isContainerActiveByDefault()
true
if the container is automatically activated;
false
otherwise.setContainerActiveByDefault(boolean)
public void setContainerActiveByDefault(boolean active)
active
- If true
, containers are automatically
activated; if false
, the container has to be explicitly
activated by calling the method
IlvViewContainer.activate()
.isContainerActiveByDefault()
public Icon getIcon()
ICON_ATTRIBUTE
,
this method returns this icon. Otherwise, this method returns
null
.setIcon(javax.swing.Icon)
,
ICON_ATTRIBUTE
public void setIcon(Icon icon)
icon
- The new icon of the view configuration.
It overrides the icon that is defined the settings
ICON_ATTRIBUTE
.ICON_ATTRIBUTE
,
getIcon()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.