gumbo.visualize.data
Class AspectModel

java.lang.Object
  |
  +--gumbo.util.AbstractDisposable
        |
        +--gumbo.visualize.data.DataModel
              |
              +--gumbo.visualize.data.AspectModel
All Implemented Interfaces:
Disposable, java.io.Serializable
Direct Known Subclasses:
ParityModel

public class AspectModel
extends DataModel
implements java.io.Serializable

A data model representing a special data relationship amongst client models beyond the conventional relationship of a whole model and its constituent parts. For example, an aspect model can represent a path spanning separate but contiguous graph models, or a subset of elements in one or more group models. Not being a whole model, an aspect model is not intended to be laid out and presented on its own. Not being a part model, an aspect model is not intended to be used as a part in a whole model, with a distinct presence in a whole view. Instead, an aspect model provides a simple logical grouping of "child" client models, as specified by their client IDs, under a "parent" data model. How to use an aspect model, such as to highlight a graph path or outline a sub-group, is outside the scope of this package. Subclasses of aspect models can impose restrictions on how the aspect model is structured.

An aspect model represents a logical relationship defined solely within the context of the client, without the constraint of a direct one-for-one visual representation imposed on other types of data models. As such, client IDs are used to identify child models instead of data model references, as in whole and part model trees. This has the benefit of allowing the client to reference child models that have not yet been instantiated as a data model for viewing, or have been instantiated for presentation in multiple views. For example, the client may have a large "master graph" spanned by a path through it. Only a portion of the master graph, however, may be instantiated as a whole model graph and presented to the user in a whole view. By using client IDs, which presumably uniquely identify the vertices and edges in the client's master graph, to define a "graph path" aspect model, the path can be automatically and consistently visualized no matter how many views of the master graph are created, or when they are created.

The parent aspect model to child client model relationship is many to many. This class maintains a global map so that all the sub models associated with a given client model can be efficiently found.

Version:
$Revision: 1.10 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.
See Also:
Serialized Form

Constructor Summary
AspectModel(java.lang.Object clientId, java.lang.Object clientData)
          Creates a new instance.
 
Method Summary
 void addClientModelChild(java.lang.Object childId)
          Adds a child model to this aspect model, and fires change events.
protected  void checkClientModelChild(java.lang.Object childId)
          Safely returns if a client model can be added as a child of this aspect model.
 java.util.Set getClientModelChildren()
          Gets the children of this aspect model.
protected  void implDispose()
          Removes itself as a global model, and clears its children.
 void removeClientModelChild(java.lang.Object childId)
          Removes a child model from this aspect model, and fires change events.
 
Methods inherited from class gumbo.visualize.data.DataModel
getClientData, getClientId, initDataModel, setClientData
 
Methods inherited from class gumbo.util.AbstractDisposable
dispose, isDisposed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectModel

public AspectModel(java.lang.Object clientId,
                   java.lang.Object clientData)
Creates a new instance.

Parameters:
clientId - See DataModel. Null if none, in which case the client ID defaults to this object.
clientData - See DataModel. Null if none.
Method Detail

addClientModelChild

public void addClientModelChild(java.lang.Object childId)
Adds a child model to this aspect model, and fires change events. The child must satisfy verifyClientModelChild().

Parameters:
childId - The client ID of the child model to be added. Duplicates are silently ignored. Never null.

removeClientModelChild

public void removeClientModelChild(java.lang.Object childId)
Removes a child model from this aspect model, and fires change events.

Parameters:
childId - The client ID of the child model to be removed. Missing models are silently ignored. Never null.

getClientModelChildren

public java.util.Set getClientModelChildren()
Gets the children of this aspect model.

Returns:
Immutable view of the client IDs (Object) of this aspect model's child models. Never null.

checkClientModelChild

protected void checkClientModelChild(java.lang.Object childId)
Safely returns if a client model can be added as a child of this aspect model. Override to add further qualifications.

Parameters:
childId - The client ID of a potential child model. Never null.
Throws:
java.lang.IllegalArgumentException - childId is null.

implDispose

protected void implDispose()
Removes itself as a global model, and clears its children.

Overrides:
implDispose in class DataModel