ilog.views.appframe.settings
Class IlvSettingsManager

java.lang.Object
  extended by ilog.views.appframe.settings.IlvSettings
      extended by ilog.views.appframe.settings.IlvSettingsManager
All Implemented Interfaces:
Document, Node

public class IlvSettingsManager
extends IlvSettings

Defines settings that manage other settings added to layers. The application uses a settings manager for storing its settings and giving access to them.

Query methods apply to all the settings added to the settings manager. If a query accesses the same settings model nodes in different nodes, nodes will be merged into one result settings node, according to the cascading mode specified to the settings of those nodes (see IlvSettings.getCascadingMode()).


Nested Class Summary
 
Nested classes/interfaces inherited from class ilog.views.appframe.settings.IlvSettings
IlvSettings.AttributeID, IlvSettings.IDAttributeMapper, IlvSettings.IDResolver
 
Field Summary
static String APPFRAME_LAYER
          Layer for the use of Application Framework.
static String APPLICATION_DATA_LAYER
          Layer to put the default application data in.
static String CLIENT_DEVICE_LAYER
          Layer for inserting application data that depends on the client device.
static String DEFAULT_NAME
          Constant value for the default name of settings managers.
static String ROLE_LAYER
          Layer for inserting application data that depends on the role of the user.
static String USER_LAYER
          Layer where Application Framework inserts the user-customized data when the user session ends.
 
Fields inherited from class ilog.views.appframe.settings.IlvSettings
APPLY_DIFF_MODE, EVERY_NODE_KEY, READABLE, SET_MODE, UNREADABLE, VERBOSE, WRITABLE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
IlvSettingsManager()
          Constructs a settings manager with a name set to DEFAULT_NAME.
IlvSettingsManager(String name)
          Constructs a settings manager with the specified name.
 
Method Summary
 boolean addSettings(IlvSettings settings, String layerName)
          Adds the specified settings to the specified layer.
 void addSettingsListener(SettingsListener listener)
          Adds a settings listener to the settings manager.
 boolean areSettingsInitialized()
          Determines whether the settings are initialized.
 void commit()
          Commits changes that occurred on the settings to the specified writable settings.
 boolean containsSettings(IlvSettings settings)
          Determines whether this settings manager contains the specified settings.
 IlvSettingsElement createSettingsElement(String typeName)
          Creates a new settings element with the specified type name.
protected  void fireInitializationEvent()
          Fires an initialization event to all the settings listeners registered with the settings manager.
protected  void fireSettingsAddedEvent(IlvSettings settings)
          Notifies all the settings listeners registered with the settings manager that the specified settings have been added to the settings manager.
protected  void fireSettingsRemovedEvent(IlvSettings settings)
          Notifies all the settings listeners registered with the settings manager that the specified settings have been removed from the settings manager.
 void freezeMutationNotifications()
          Freezes the notification of modification events to the settings listeners registered with this settings manager.
 IlvApplication getApplication()
          Returns the application that owns this settings manager.
protected  int getLayerIndex(String layerName)
          Retrieves the storage index of the layer with the given name layerName.
 String getLayerName(IlvSettings settings)
          Returns the name of the layer that the specified settings are inserted in.
 String[] getLayers()
          Returns the names of the layers managed by this settings manager.
 IlvSettings[] getSettings()
          Returns the settings managed by this settings manager.
 IlvSettings getSettings(String name)
          Finds the settings with the given name.
 IlvSettings getWritableSettings()
          Returns the settings where settings modifications are stored.
 boolean initializeSettings()
          Initializes the settings.
 boolean insertLayer(String layerName, String layerRef, boolean higherPriority)
          Inserts a new settings layer.
 boolean removeLayer(String layerName)
          Removes the layer with the given name.
 boolean removeSettings(IlvSettings settings)
          Removes the specified settings.
 boolean removeSettingsListener(SettingsListener listener)
          Removes a settings listener from the list of listeners of the settings manager.
 void setApplication(IlvApplication application)
          Sets the application that owns this settings manager.
 void setWritableSettings(IlvSettings writableSettings)
          Sets the settings where modifications made to settings owned by this settings manager would be stored.
 void unFreezeMutationNotifications()
          Unfreezes the settings listeners.
 
Methods inherited from class ilog.views.appframe.settings.IlvSettings
addIDResolver, addSettingsElement, adoptNode, appendChild, canWrite, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createModel, createProcessingInstruction, createTextNode, ensureCorrespondingElement, ensureSettingsElement, ensureSettingsElement, getAccessRights, getAttributes, getBaseURI, getCascadingMode, getChildNodes, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getFirstChild, getID, getID, getImplementation, getInputEncoding, getLastChild, getLocalName, getModel, getMutableModel, getName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSettingsManager, getStrictErrorChecking, getTextContent, getUserData, getXmlEncoding, getXmlStandalone, getXmlVersion, hasAttributes, hasChildNodes, importNode, insertBefore, isDefaultNamespace, isEqualNode, IsEveryNodeKey, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, normalizeDocument, removeAllSettingsElements, removeChild, removeIDResolver, removeSettingsElement, renameNode, replaceChild, select, select, select, selectElement, selectElement, selectElement, selectNodes, setAccessRights, setCascadingMode, setDocumentURI, setID, setModel, setName, setNodeValue, setPrefix, setSettingsManager, setStrictErrorChecking, setTextContent, setUserData, setXmlStandalone, setXmlVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPFRAME_LAYER

public static final String APPFRAME_LAYER
Layer for the use of Application Framework. This layer has the lowest priority.

See Also:
Constant Field Values

APPLICATION_DATA_LAYER

public static final String APPLICATION_DATA_LAYER
Layer to put the default application data in.

See Also:
Constant Field Values

CLIENT_DEVICE_LAYER

public static final String CLIENT_DEVICE_LAYER
Layer for inserting application data that depends on the client device.

See Also:
Constant Field Values

ROLE_LAYER

public static final String ROLE_LAYER
Layer for inserting application data that depends on the role of the user. For example, it is possible to insert different menu definitions in different settings that are selected depending on whether the user is an administrator or an end user.

See Also:
Constant Field Values

USER_LAYER

public static final String USER_LAYER
Layer where Application Framework inserts the user-customized data when the user session ends. This layer has the highest priority.

See Also:
Constant Field Values

DEFAULT_NAME

public static final String DEFAULT_NAME
Constant value for the default name of settings managers.

See Also:
Constant Field Values
Constructor Detail

IlvSettingsManager

public IlvSettingsManager(String name)
Constructs a settings manager with the specified name.

Parameters:
name - The name of the settings manager that allows those settings to be retrieved from other settings if included in a top level settings manager.

IlvSettingsManager

public IlvSettingsManager()
Constructs a settings manager with a name set to DEFAULT_NAME.

Method Detail

initializeSettings

public boolean initializeSettings()
Initializes the settings.

Overrides:
initializeSettings in class IlvSettings
Returns:
true if the initialization is successful; false otherwise.
See Also:
IlvSettings.areSettingsInitialized()

areSettingsInitialized

public boolean areSettingsInitialized()
Determines whether the settings are initialized.

Overrides:
areSettingsInitialized in class IlvSettings
Returns:
true if the settings are initialized; false otherwise.
See Also:
IlvSettings.initializeSettings()

setApplication

public void setApplication(IlvApplication application)
Sets the application that owns this settings manager.

Overrides:
setApplication in class IlvSettings
Parameters:
application - The new application of this manager.
See Also:
getApplication()

getApplication

public IlvApplication getApplication()
Returns the application that owns this settings manager.

Overrides:
getApplication in class IlvSettings
See Also:
setApplication(ilog.views.appframe.IlvApplication)

addSettings

public boolean addSettings(IlvSettings settings,
                           String layerName)
Adds the specified settings to the specified layer.

Parameters:
settings - The settings to add.
layerName - The name of the layer to add the settings to.
Returns:
true if the given settings could be inserted within the settings manager; false if the layerName does not correspond to an existing layer within the settings manager.

removeSettings

public boolean removeSettings(IlvSettings settings)
Removes the specified settings.

Parameters:
settings - The settings to remove.
Returns:
true if the given settings could be removed; false if the settings were not stored in this settings manager.

containsSettings

public boolean containsSettings(IlvSettings settings)
Determines whether this settings manager contains the specified settings.

Returns:
true if the settings have been added to the settings manager; false otherwise.

createSettingsElement

public IlvSettingsElement createSettingsElement(String typeName)
Creates a new settings element with the specified type name.
Even though the signification of the type name can depend on the settings implementation, it is recommended that the implementation of this method first checks whether a type with the same name is declared in one of the settings dictionaries added to the settings manager that owns those settings. If so, the type found should be used to instantiate this new element.

The settings returned by the newly created element by calling its method IlvSettingsNode.getSettings() must be equal to this settings instance.

Overrides:
createSettingsElement in class IlvSettings
Parameters:
typeName - The name of the type of the element to instantiate.
Returns:
The newly created settings element.

getSettings

public IlvSettings getSettings(String name)
Finds the settings with the given name.

Parameters:
name - The name of the settings to retrieve.
Returns:
The settings with the given name.

getSettings

public IlvSettings[] getSettings()
Returns the settings managed by this settings manager.

Returns:
The array of settings managed by this settings manager.

commit

public void commit()
Commits changes that occurred on the settings to the specified writable settings.

If the specified settings are equal to this settings instance, the implementation of this method should save all the content of those settings. Otherwise, if the writable settings are not equal to this settings instance, the implementation of this method may do nothing, since changes that occur on settings are automatically tracked and added to the writable settings using the IlvSettings.addSettingsElement(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.settings.IlvSettingsElement, int) method.

Overrides:
commit in class IlvSettings
See Also:
IlvSettings.getModel()

setWritableSettings

public void setWritableSettings(IlvSettings writableSettings)
Sets the settings where modifications made to settings owned by this settings manager would be stored.

Parameters:
writableSettings - The settings to store modifications in.

getWritableSettings

public IlvSettings getWritableSettings()
Returns the settings where settings modifications are stored.

Returns:
The writable settings.

insertLayer

public boolean insertLayer(String layerName,
                           String layerRef,
                           boolean higherPriority)
Inserts a new settings layer.

Parameters:
layerName - The name of the layer to insert.
layerRef - The name of the layer that indicates the position to insert the given layer. If this parameter is null, the newly created layer is inserted with a top priority and the parameter higherPriority is not taken into account.

Here is the list of predefined layers, given from the highest priority to the lowest:

  • USER_LAYER
  • ROLE_LAYER
  • CLIENT_DEVICE_LAYER
  • APPLICATION_DATA_LAYER
  • APPFRAME_LAYER
higherPriority - If this parameter is true, the new layer will be given a higher priority than the layer of name layerRef and a lower priority than all the layers previously inserted with a higher priority than the layer of name layerRef. Otherwise, the new layer is given a lower priority than the layer of name layerRef and a higher priority than all the layers previously inserted with a lower priority than the layer of name layerRef.
Returns:
true if the method could insert a new layer or false if the method could not insert the new layer; this can happen if the given parameter layerRef does not correspond to any of the layers already inserted in this settings manager.

removeLayer

public boolean removeLayer(String layerName)
Removes the layer with the given name.

Parameters:
layerName - The name of the layer to remove.
Returns:
true if the layer with the given name could be found and removed; false otherwise.

getLayerName

public String getLayerName(IlvSettings settings)
Returns the name of the layer that the specified settings are inserted in.

Parameters:
settings - The settings.
Returns:
The name of the layer.

getLayers

public String[] getLayers()
Returns the names of the layers managed by this settings manager.

Returns:
The names of the layers.

getLayerIndex

protected int getLayerIndex(String layerName)
Retrieves the storage index of the layer with the given name layerName.


addSettingsListener

public void addSettingsListener(SettingsListener listener)
Adds a settings listener to the settings manager.

Parameters:
listener - The listener to add.

removeSettingsListener

public boolean removeSettingsListener(SettingsListener listener)
Removes a settings listener from the list of listeners of the settings manager.

Parameters:
listener - The listener to remove.
Returns:
true if the listener could be removed from the list of listeners or false if the given listener could not be found in the listener list.

freezeMutationNotifications

public void freezeMutationNotifications()
Freezes the notification of modification events to the settings listeners registered with this settings manager.

When the settings manager is frozen, events for modifications that occur on the settings manager are stored. Once the settings manager is unfrozen, stored modification events are notified to the settings listeners.

See Also:
unFreezeMutationNotifications()

unFreezeMutationNotifications

public void unFreezeMutationNotifications()
Unfreezes the settings listeners.

See Also:
freezeMutationNotifications()

fireSettingsAddedEvent

protected void fireSettingsAddedEvent(IlvSettings settings)
Notifies all the settings listeners registered with the settings manager that the specified settings have been added to the settings manager.

Parameters:
settings - The settings that have been added.
See Also:
addSettings(ilog.views.appframe.settings.IlvSettings, java.lang.String)

fireSettingsRemovedEvent

protected void fireSettingsRemovedEvent(IlvSettings settings)
Notifies all the settings listeners registered with the settings manager that the specified settings have been removed from the settings manager.

Parameters:
settings - The settings that have been removed.
See Also:
removeSettings(ilog.views.appframe.settings.IlvSettings)

fireInitializationEvent

protected void fireInitializationEvent()
Fires an initialization event to all the settings listeners registered with the settings manager. Invoked by the initializeSettings() method after the settings owned by the manager have been initialized.

See Also:
initializeSettings()


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