ilog.views.appframe.settings
Class IlvSettings.IDAttributeMapper

java.lang.Object
  extended by ilog.views.appframe.settings.IlvSettings.IDAttributeMapper
All Implemented Interfaces:
IlvSettings.IDResolver
Enclosing class:
IlvSettings

public static class IlvSettings.IDAttributeMapper
extends Object
implements IlvSettings.IDResolver

Maps the ID value of a settings element with the value of a specified attribute.

See Also:
IlvSettings.addIDResolver(ilog.views.appframe.settings.IlvSettings.IDResolver), IlvSettings.removeIDResolver(ilog.views.appframe.settings.IlvSettings.IDResolver)

Constructor Summary
IlvSettings.IDAttributeMapper(String type, String attributeName)
          Constructs an ID attribute mapper that resolves IDs for the elements with the specified type.
 
Method Summary
 Object getID(Object element, String type, IlvSettingsModel model)
          Returns the ID value for the specified element, if the specified type is equal to the type given to the constructor of this mapper.
 boolean setID(Object element, Object id, String type, IlvMutableSettingsModel model)
          Sets the specified ID value to the specified element if the specified type is equal to the type of element that this mapper maps.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvSettings.IDAttributeMapper

public IlvSettings.IDAttributeMapper(String type,
                                     String attributeName)
Constructs an ID attribute mapper that resolves IDs for the elements with the specified type.

Parameters:
type - The type of settings elements that this mapper resolves IDs for.
attributeName - The name of the attribute with a value that provides IDs.
Method Detail

getID

public Object getID(Object element,
                    String type,
                    IlvSettingsModel model)
Returns the ID value for the specified element, if the specified type is equal to the type given to the constructor of this mapper.
In this case, the value of the attributeName attribute of the element is returned. If the specified type does not correspond to the type of element that this mapper maps, null will be returned.

Specified by:
getID in interface IlvSettings.IDResolver
Parameters:
element - The settings element to retrieve the ID from.
type - The settings type of the specified element.
model - The settings model that owns the specified element.
Returns:
The ID value of the specified element.
See Also:
setID(java.lang.Object, java.lang.Object, java.lang.String, ilog.views.appframe.settings.IlvMutableSettingsModel)

setID

public boolean setID(Object element,
                     Object id,
                     String type,
                     IlvMutableSettingsModel model)
Sets the specified ID value to the specified element if the specified type is equal to the type of element that this mapper maps.
In this case, the attributeName attribute of the element is set to the id value. If the specified type does not correspond to the type of element that this mapper maps, false will be returned.

Specified by:
setID in interface IlvSettings.IDResolver
Parameters:
element - The element to set the ID to.
id - The ID value to set the specified element to.
type - The settings type of the specified element.
model - The settings model that owns the specified element.
Returns:
true if the specified type is equal to the type of element that this mapper maps; false otherwise.


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