ilog.cpl.model
Class IlpDefaultAttributeGroup

java.lang.Object
  extended by ilog.cpl.model.IlpDefaultAttributeGroup
All Implemented Interfaces:
IlpAttributeGroup, IlpMutableAttributeGroup
Direct Known Subclasses:
IlpExtendedAttributeGroup

public class IlpDefaultAttributeGroup
extends Object
implements IlpMutableAttributeGroup

This class models a simple attribute model, where the attributes may be marked as visible or not.

Since:
JTGO 3.0

Constructor Summary
IlpDefaultAttributeGroup()
          Default constructor
IlpDefaultAttributeGroup(IlpAttribute[] attributes)
          Convenience constructor.
IlpDefaultAttributeGroup(String name)
          Creates a default attribute group with the given name.
 
Method Summary
 void addAttribute(IlpAttribute a)
          Adds a new attribute to the model.
 void addAttributeGroupListener(AttributeGroupListener l)
          Adds a listener to model changes.
 void endChangingAttributeGroup()
          Indicates that the model has been changed and that the events may now be sent to the interested listeners.
 void fireEvent(AttributeGroupEvent ev)
          Notifies events to listeners.
 IlpAttribute getAttribute(String name)
          Returns the attribute that corresponds to the given name, independently of whether it is visible or not.
 Collection getAttributes()
          Returns the collection of attributes present in this model.
 Collection getDeclaredAttributes()
          Returns the collection of attributes declared in this model.
 String getName()
          Returns the Attribute Group name.
 boolean hasAttribute(IlpAttribute attr)
          Returns whether the given attribute is part of the model, independently of whether the attribute is visible or not.
 boolean isAttributeVisible(IlpAttribute attr)
          Checks whether the given attribute is visible or not.
 void removeAttribute(IlpAttribute a)
          Removes the given attribute from the model.
 void removeAttributeGroupListener(AttributeGroupListener l)
          Removes the model listener.
 void setAttributeVisible(IlpAttribute attr, boolean visible)
          Sets whether the given attribute should be visible to users of the model.
 void startChangingAttributeGroup()
          Indicates that the model will be changed and events will be fired only when the method endChangingAttributeGroup is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpDefaultAttributeGroup

public IlpDefaultAttributeGroup()
Default constructor


IlpDefaultAttributeGroup

public IlpDefaultAttributeGroup(IlpAttribute[] attributes)
Convenience constructor.


IlpDefaultAttributeGroup

public IlpDefaultAttributeGroup(String name)
Creates a default attribute group with the given name.

Method Detail

getName

public String getName()
Returns the Attribute Group name.

Specified by:
getName in interface IlpAttributeGroup

getAttributes

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

Only visible attributes are returned.

The attributes returned by this method are present according to the insertion order. If an attribute is made invisible and then visible again, its position is the same as if it had been removed and inserted in the group.

Specified by:
getAttributes in interface IlpAttributeGroup
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 returned by this method are present according to the insertion order. If an attribute is made invisible and then visible again, its position is the same as if it had been removed and inserted in the group.

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

getAttribute

public IlpAttribute getAttribute(String name)
Returns the attribute that corresponds to the given name, independently of whether it is visible or not.

Specified by:
getAttribute in interface IlpAttributeGroup
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.
Throws:
IllegalArgumentException - if the name is invalid.

hasAttribute

public boolean hasAttribute(IlpAttribute attr)
Returns whether the given attribute is part of the model, independently of whether the attribute is visible or not.

Specified by:
hasAttribute in interface IlpAttributeGroup

addAttribute

public void addAttribute(IlpAttribute a)
Adds a new attribute to the model. This method fires an ATTRIBUTE_ADDED event to the listeners.

Specified by:
addAttribute in interface IlpMutableAttributeGroup
See Also:
IlpAttribute.setAttributeGroup(ilog.cpl.model.IlpAttributeGroup)

removeAttribute

public void removeAttribute(IlpAttribute a)
Removes the given attribute from the model. This method fires an ATTRIBUTE_REMOVED event to the listeners.

Specified by:
removeAttribute in interface IlpMutableAttributeGroup
See Also:
IlpAttribute.setAttributeGroup(ilog.cpl.model.IlpAttributeGroup)

addAttributeGroupListener

public void addAttributeGroupListener(AttributeGroupListener l)
Adds a listener to model changes.

Specified by:
addAttributeGroupListener in interface IlpAttributeGroup

removeAttributeGroupListener

public void removeAttributeGroupListener(AttributeGroupListener l)
Removes the model listener.

Specified by:
removeAttributeGroupListener in interface IlpAttributeGroup

fireEvent

public void fireEvent(AttributeGroupEvent ev)
Notifies events to listeners.

Specified by:
fireEvent in interface IlpAttributeGroup

startChangingAttributeGroup

public void startChangingAttributeGroup()
Indicates that the model will be changed and events will be fired only when the method endChangingAttributeGroup is called.

See Also:
endChangingAttributeGroup()

endChangingAttributeGroup

public void endChangingAttributeGroup()
Indicates that the model has been changed and that the events may now be sent to the interested listeners.

See Also:
startChangingAttributeGroup()

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.

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.

Returns:
true if the attribute is contained in the model and visible.


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