ilog.cpl.model
Class IlpExtendedAttributeGroup

java.lang.Object
  extended by ilog.cpl.model.IlpDefaultAttributeGroup
      extended by ilog.cpl.model.IlpExtendedAttributeGroup
All Implemented Interfaces:
AttributeGroupListener, IlpAttributeGroup, IlpMutableAttributeGroup, ilog.cpl.model.internal.IlpAttributeGroupHierarchy, EventListener

public class IlpExtendedAttributeGroup
extends IlpDefaultAttributeGroup
implements AttributeGroupListener, ilog.cpl.model.internal.IlpAttributeGroupHierarchy

This class defines an attribute model that contains local attributes and also attributes from other attribute models.

Since:
JTGO 3.0

Constructor Summary
IlpExtendedAttributeGroup()
          Default constructor.
IlpExtendedAttributeGroup(IlpAttributeGroup defaultModel)
          Creates a new group with the given attribute group as a default group.
IlpExtendedAttributeGroup(String name)
          Creates a new attribute group with the given name.
 
Method Summary
 void addAttributeGroup(IlpAttributeGroup model)
          Adds the given model to be used by this one.
 void attributeAdded(AttributeGroupEvent ev)
          Is called when an attribute is added to an IlpAttributeGroup.
 void attributeChanged(AttributeGroupEvent ev)
          Is called when an attribute is changed in an IlpAttributeGroup.
 void attributeRemoved(AttributeGroupEvent ev)
          Is called when an attribute is removed from an IlpAttributeGroup.
 IlpAttribute getAttribute(String name)
          Returns a class instance attribute.
 Collection getAttributeGroups()
          Returns the list of all attribute groups being used by this one.
 Collection getAttributes()
          Returns the collection of visible attributes present in this model.
 Collection getDeclaredAttributes()
          Returns the collection of attributes declared in this model.
 IlpAttributeGroup getDefaultAttributeGroup()
          Returns the default attribute group.
 String getGroupName()
          Returns the name of this group, otherwise returns null;
 String getName()
          Returns the Attribute Group name, if one exist.
 boolean hasAttribute(IlpAttribute attr)
          Indicates whether the given attribute is part of the model.
 boolean hasAttributeGroup(IlpAttributeGroup model)
          Indicates whether this extended attribute model is using another model.
 boolean isAttributeVisible(IlpAttribute attr)
          Checks whether the given attribute is visible or not.
 void modelStructureChanged(AttributeGroupEvent ev)
          Is called when the attribute model has undergone several modifications.
 void removeAttributeGroup(IlpAttributeGroup model)
          Removes the given model from the list of models.
 void setAttributeVisible(IlpAttribute attr, boolean visible)
          Sets whether the given attribute should be visible to users of the model.
 void setDefaultAttributeGroup(IlpAttributeGroup group)
          Sets the default attribute group.
 
Methods inherited from class ilog.cpl.model.IlpDefaultAttributeGroup
addAttribute, addAttributeGroupListener, endChangingAttributeGroup, fireEvent, removeAttribute, removeAttributeGroupListener, startChangingAttributeGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpExtendedAttributeGroup

public IlpExtendedAttributeGroup()
Default constructor.


IlpExtendedAttributeGroup

public IlpExtendedAttributeGroup(IlpAttributeGroup defaultModel)
Creates a new group with the given attribute group as a default group.


IlpExtendedAttributeGroup

public IlpExtendedAttributeGroup(String name)
Creates a new attribute group with the given name.

Method Detail

getAttributes

public Collection getAttributes()
Returns the collection of visible attributes present in this model.

This implementation returns a collection where the attributes are in the following order:

When an attribute is made invisible and then visible again, its position in the collection will be the same as if the attribute had been removed and inserted in the group.

Specified by:
getAttributes in interface IlpAttributeGroup
Overrides:
getAttributes in class IlpDefaultAttributeGroup
Returns:
An unmodifiable collection containing IlpAttribute instances.

getDeclaredAttributes

public Collection getDeclaredAttributes()
Returns the collection of attributes declared in this model. Only visible attributes are returned.

The attributes are returned in the insertion order. When an attribute is made invisible and then visible again, its position in the list will be the same as if the attribute had been removed and added to the group.

Specified by:
getDeclaredAttributes in interface IlpAttributeGroup
Overrides:
getDeclaredAttributes in class IlpDefaultAttributeGroup
Returns:
An unmodifiable collection containing IlpAttribute instances.
See Also:
IlpDefaultAttributeGroup.getAttributes()

getAttribute

public IlpAttribute getAttribute(String name)
Returns a class instance attribute.

Specified by:
getAttribute in interface IlpAttributeGroup
Overrides:
getAttribute in class IlpDefaultAttributeGroup
Parameters:
name - The name of the class instance attribute to be retrieved.
Returns:
The attribute corresponding to the specified name or null if there is no matching attribute.

hasAttribute

public boolean hasAttribute(IlpAttribute attr)
Indicates whether the given attribute is part of the model.

Specified by:
hasAttribute in interface IlpAttributeGroup
Overrides:
hasAttribute in class IlpDefaultAttributeGroup

setAttributeVisible

public void setAttributeVisible(IlpAttribute attr,
                                boolean visible)
Sets whether the given attribute should be visible to users of the model.

Attributes that are not visible will not be included in the list returned by getAttributes, but they will be accessible through the other APIs. Used to hide certain attributes from the reference model.

This method fires ATTRIBUTE_ADDED or ATTRIBUTE_REMOVED events according to the given visibility status.

Overrides:
setAttributeVisible in class IlpDefaultAttributeGroup
Throws:
IllegalArgumentException - if the given attribute is not part of the model.

isAttributeVisible

public boolean isAttributeVisible(IlpAttribute attr)
Checks whether the given attribute is visible or not.

Overrides:
isAttributeVisible in class IlpDefaultAttributeGroup
Returns:
true if the attribute is contained in the model and visible.

getName

public String getName()
Returns the Attribute Group name, if one exist.

Specified by:
getName in interface IlpAttributeGroup
Overrides:
getName in class IlpDefaultAttributeGroup

getGroupName

public String getGroupName()
Returns the name of this group, otherwise returns null;

Specified by:
getGroupName in interface ilog.cpl.model.internal.IlpAttributeGroupHierarchy
Internal method or field: do not use!

attributeAdded

public void attributeAdded(AttributeGroupEvent ev)
Is called when an attribute is added to an IlpAttributeGroup.

Specified by:
attributeAdded in interface AttributeGroupListener

attributeRemoved

public void attributeRemoved(AttributeGroupEvent ev)
Is called when an attribute is removed from an IlpAttributeGroup.

Specified by:
attributeRemoved in interface AttributeGroupListener

attributeChanged

public void attributeChanged(AttributeGroupEvent ev)
Is called when an attribute is changed in an IlpAttributeGroup.

Specified by:
attributeChanged in interface AttributeGroupListener

modelStructureChanged

public void modelStructureChanged(AttributeGroupEvent ev)
Is called when the attribute model has undergone several modifications. This method is called whenever the user buffers the model modifications.

Specified by:
modelStructureChanged in interface AttributeGroupListener

hasAttributeGroup

public boolean hasAttributeGroup(IlpAttributeGroup model)
Indicates whether this extended attribute model is using another model.

Parameters:
model - The model that may be used by this extended attribute model.
Returns:
true if the model is used by this extended attribute model.

addAttributeGroup

public void addAttributeGroup(IlpAttributeGroup model)
Adds the given model to be used by this one.

This method fires a MODEL_STRUCTURE_CHANGE event to the listeners.


removeAttributeGroup

public void removeAttributeGroup(IlpAttributeGroup model)
Removes the given model from the list of models.

This method fires a MODEL_STRUCTURE_CHANGE event to the listeners.


getDefaultAttributeGroup

public IlpAttributeGroup getDefaultAttributeGroup()
Returns the default attribute group.

The default attribute group is the first one used by this extended attribute group, which can be set or passed at construction time.

Specified by:
getDefaultAttributeGroup in interface ilog.cpl.model.internal.IlpAttributeGroupHierarchy

setDefaultAttributeGroup

public void setDefaultAttributeGroup(IlpAttributeGroup group)
                              throws IllegalArgumentException
Sets the default attribute group.

The default attribute group must be contained in this attribute group otherwise, an IllegalArgumentException is thrown.

Throws:
IllegalArgumentException - when the given attribute group is unknown.

getAttributeGroups

public Collection getAttributeGroups()
Returns the list of all attribute groups being used by this one.

See Also:
addAttributeGroup(ilog.cpl.model.IlpAttributeGroup)


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