ilog.views.appframe.docview
Class IlvDocumentViewConfiguration

java.lang.Object
  extended by ilog.views.appframe.docview.IlvDocumentViewConfiguration

public class IlvDocumentViewConfiguration
extends Object

Document view configurations are responsible for creating view containers and their document views for a document template. They are created by document templates according to their settings. One view configuration is created for each settings element selected with the 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:

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().

See Also:
IlvDocumentTemplate.getViewConfiguration(java.lang.String)

Field Summary
static String ICON_ATTRIBUTE
          The name of the settings attribute that specifies the icon of this configuration.
 
Constructor Summary
IlvDocumentViewConfiguration(String name)
          Constructs a new IlvDocumentViewConfiguration with the specified name.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_ATTRIBUTE

public static final String ICON_ATTRIBUTE
The name of the settings attribute that specifies the icon of this configuration.

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().

Since:
JViews6.0
See Also:
getIcon(), Constant Field Values
Constructor Detail

IlvDocumentViewConfiguration

public IlvDocumentViewConfiguration(String name)
Constructs a new IlvDocumentViewConfiguration with the specified name.

Parameters:
name - The name of the configuration.
See Also:
getName(), setName(java.lang.String)
Method Detail

newViewContainer

public IlvViewContainer newViewContainer(IlvDocument document,
                                         boolean activateContainer)
Creates a new view container according to the parameters of this view configuration.

Parameters:
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.
Returns:
The newly created view container or null if the view container could not be created.
See Also:
getContainerTemplate()

createView

protected IlvDocumentView createView(IlvSettingsElement viewTemplateElement,
                                     int viewIndex,
                                     IlvViewContainer container)
Instantiates a view according to the settings specification provided with the viewTemplateElement. This method is only invoked if the container template associated with the view configuration is an IlvMDIContainerTemplate.

Parameters:
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.
Returns:
The newly created view.

readSettings

public void readSettings(IlvSettingsElement element,
                         IlvSettings settings)
Reads the settings of this document view configuration from the specified settings element.

Parameters:
element - The settings element to read the configuration settings from.
settings - The settings of the settings element.

connectMainWindow

public void connectMainWindow(IlvMainWindow mainWindow)
Initializes this configuration with the specified 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().

Parameters:
mainWindow - The main window to initialize the configuration with.
See Also:
getTemplateName()

getName

public final String getName()
Returns the name of this configuration. By default, this name is initialized with the "name" attribute of the settings element specified with the readSettings method.

See Also:
setName(java.lang.String)

setName

public void setName(String name)
Sets the name of this configuration. This method is automatically called by the document template associated with this configuration, setting the name specified in the settings for this configuration.

Parameters:
name - The new name of the configuration.
See Also:
getName()

getTemplateName

public String getTemplateName()
Returns the name of the container template that creates or provides view containers for this configuration. This name is initialized with the 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.

Returns:
The name of the container template associated with this document view configuration.
See Also:
connectMainWindow(ilog.views.appframe.docview.IlvMainWindow)

isMDI

public boolean isMDI()
Determines whether this configuration creates MDI containers.

Returns:
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.

isAutoCreate

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

Returns:
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).
See Also:
setAutoCreate(boolean)

setAutoCreate

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

Parameters:
autoCreate - If true, view containers are automatically created. Otherwise, they are created later using the method IlvDocumentTemplate.newViewContainer(IlvDocument, String, boolean).
See Also:
isAutoCreate()

getDocumentTemplate

public IlvDocumentTemplate getDocumentTemplate()
Returns the document template that has created this view configuration.

Returns:
The document template.
See Also:
setDocumentTemplate(ilog.views.appframe.docview.IlvDocumentTemplate)

setDocumentTemplate

public void setDocumentTemplate(IlvDocumentTemplate documentTemplate)
Sets the document template associated with this document view configuration.

Parameters:
documentTemplate - The new document template of this configuration.
See Also:
getDocumentTemplate()

getContainerTemplate

public IlvContainerTemplate getContainerTemplate()
Returns the container template associated with this view configuration.

See Also:
setContainerTemplate(ilog.views.appframe.docview.IlvContainerTemplate)

setContainerTemplate

public void setContainerTemplate(IlvContainerTemplate containerTemplate)
Sets the container template associated with this view configuration.

Parameters:
containerTemplate - The new container template of this view configuration.
See Also:
getContainerTemplate()

isAutomaticContainerTitle

public boolean isAutomaticContainerTitle()
Determines whether the view containers created for this view container have titles set automatically according to the associated document title.

Returns:
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.
See Also:
setAutomaticContainerTitle(boolean)

setAutomaticContainerTitle

public void setAutomaticContainerTitle(boolean automatic)
Specifies whether the view containers created for this view container have titles set automatically according to the associated document title.

Parameters:
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.
See Also:
isAutomaticContainerTitle()

getDefaultContainerTitle

public String getDefaultContainerTitle()
Returns the default title to set to the view container created for this view configuration.

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.

Returns:
The default container title or null if the method isAutomaticContainerTitle() returns true.
See Also:
setDefaultContainerTitle(java.lang.String), isAutomaticContainerTitle(), setAutomaticContainerTitle(boolean)

setDefaultContainerTitle

public void setDefaultContainerTitle(String title)
Sets the default title to set to the view container created for this view configuration.

Parameters:
title - The default title. This parameter can be a key to a string resource that will be translated before setting to the view container.
See Also:
getDefaultContainerTitle(), isAutomaticContainerTitle(), setAutomaticContainerTitle(boolean)

isCloseDocumentOnClose

public boolean isCloseDocumentOnClose()
Determines whether the document associated with a container created for this configuration is closed when the container is closed.

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.

See Also:
setCloseDocumentOnClose(boolean)

setCloseDocumentOnClose

public void setCloseDocumentOnClose(boolean closeDocumentOnClose)
Closes the document associated with a container created for this configuration, depending on the value of the specified parameter.

Parameters:
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.
See Also:
isCloseDocumentOnClose()

isContainerActiveByDefault

public boolean isContainerActiveByDefault()
Determines whether the container created for this configuration should be automatically activated when created.

Returns:
true if the container is automatically activated; false otherwise.
See Also:
setContainerActiveByDefault(boolean)

setContainerActiveByDefault

public void setContainerActiveByDefault(boolean active)
Determines whether the container created for this configuration should be automatically activated when created.

Parameters:
active - If true, containers are automatically activated; if false, the container has to be explicitly activated by calling the method IlvViewContainer.activate().
See Also:
isContainerActiveByDefault()

getIcon

public Icon getIcon()
Returns the icon of this view configuration. If an icon has been specified with the ICON_ATTRIBUTE, this method returns this icon. Otherwise, this method returns null.

Since:
JViews 6.0
See Also:
setIcon(javax.swing.Icon), ICON_ATTRIBUTE

setIcon

public void setIcon(Icon icon)
Specifies the icon of this view configuration.

Parameters:
icon - The new icon of the view configuration. It overrides the icon that is defined the settings ICON_ATTRIBUTE.
Since:
JViews 6.0
See Also:
ICON_ATTRIBUTE, getIcon()


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