Class SelectFlag

All Implemented Interfaces:
java.lang.Comparable, InteractorFlag
Direct Known Subclasses:

public class SelectFlag
extends ObjectFlag
implements InteractorFlag, java.lang.Comparable

Base class for "selection" interactor flags. Selection inherently involves logical grouping, with a given interactor being a member of none or more selection groups. Selection flags have a concrete flag type (used for identity and sorting), a selection order (typically representing an overlap or Z-order), and a selection role (such as a command type, or the parent aspect model).

The default Gumbo selection model uses InteractorFlags.SELECT_COMAND for command target selection (general interactive selection), and InteractorFlags.SELECT_ASPECT for aspect member selection. Also, the selection flag order parallels the picking order (see PickMapper). As such, a single selection order is used for all select flags. More sophisticated selection models may wish to maintain separate selection orders for separate concrete subtypes (such as for command targets and aspect models).

A select flag is an ObjectFlag, with the object identifying the selection role. The identity (equals(), hashCode()) of a select flag incorporates the selection role, the selection order, and an instanceof test for the concrete flag type (as implemented by checkConcreteType()). Breaking with the contract for Comparable, a select flag will have an equal sorting order if select order is equal, not if equals() is true. As such, sorting multiple select flags of the same concrete type and order but different roles will result in a single select flag, which is arbitrarily chosen.

Since an interactor cannot easily provide feedback for membership in an unlimited number of groups, a select flag includes a selection order. Typically, this number is used for overlap precedence or "Z order", with only the select flag with the highest order being presented. Logical grouping is often closely associated with data modelling, especially aspect models (soft models). To maintain correspondence between a selection group and its data model the selection role can be a reference to a parent data model. Since "hard" model interactors already contain a relation to their associated part models the data model reference is typically only used to associate "soft" model interactors with their parent aspect model. Typically, a data model's client data is used by an interactor as a rendering hint, such as border, background, and/or text colors. Such use requires cooperation between the interactors and the data models they represent.

$Revision: 1.3 $
Jon Barrilleaux ( of JMB and Associates Inc.

Constructor Summary
SelectFlag(int order, java.lang.Object role, java.lang.String name)
          Creates an instance.
Method Summary
protected  boolean checkConcreteType(SelectFlag obj)
          Called by the system for identity and comparability testing for the concrete type.
 int compareTo(java.lang.Object obj)
          Warning: Inconsistent with equals.
 boolean equals(java.lang.Object obj)
          True if object is an instance of this select flag subtype and has equal select order and data model.
 int getOrder()
          Returns the selection order of this selection flag.
 int hashCode()
          Returns the superclass hash code plus the select order.
 java.lang.String toString()
          Returns the order of this flag followed by its name and role.
Methods inherited from class gumbo.util.state.ObjectFlag
getObject, isObjectAssignableTo
Methods inherited from class gumbo.util.state.StateFlag
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public SelectFlag(int order,
                  java.lang.Object role,
                  java.lang.String name)
Creates an instance.

order - The selection order index of this flag's selection group. Typically the overlap precedence or Z-order (highest is presented).
role - The role of this flag's selection group as defined by the identify of this object. Null if none. Typically a Class, String, or DataModel. If a DataModel, the client data typically provides rendering hints.
name - Name of this state flag. If null, defaults to "SelectFlag".
Method Detail


public int getOrder()
Returns the selection order of this selection flag.

The order index.


protected boolean checkConcreteType(SelectFlag obj)
Called by the system for identity and comparability testing for the concrete type. The default implementation always returns true, which means that the concrete type is SelectFlag. One or more subclasses can override this method to form multiple concrete types. If so this base class should not be used as a select flag (to preserve the contract for identity, superclasses of the concrete classes should not be instantiated).

True if the object is non-null and an instance of this select flag's concrete type.


public int compareTo(java.lang.Object obj)
Warning: Inconsistent with equals. Returns zero if select order is equal, regardless of equals().

Specified by:
compareTo in interface java.lang.Comparable


public java.lang.String toString()
Returns the order of this flag followed by its name and role.

toString in class ObjectFlag


public boolean equals(java.lang.Object obj)
True if object is an instance of this select flag subtype and has equal select order and data model.

equals in class ObjectFlag


public int hashCode()
Returns the superclass hash code plus the select order.

hashCode in class ObjectFlag