All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.AppObject

java.lang.Object
   |
   +----att.grappa.AppObject

public class AppObject
extends Object
implements Observer
This class provides the basic handle for application writers to customize graph elements. Elements can be customized by extending this class and overriding methods already provided or adding new variables and methods as needed.

Version:
1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Constructor Index

 o AppObject()
Creates an uninitialized AppObject.

Method Index

 o addTag(String, String, String, String)
Specify the classes to use for the DrawObject and AppObject of an Element based on an attribute name/value pairing.
 o attrNotOfInterest(String)
Remove the name of an attribute of interest to this object
 o attrOfInterest(String)
Add the name of an attribute of interest to this object
 o delete()
Called when an element is to be deleted.
 o draw()
A convenience method that is equivalent to draw(null,null).
 o draw(GraphicContext, DrawPane)
A convenience method for drawing -- calls the drawObject draw method
 o editListAdd(String)
Add a name to the list of displayed/editable attributes.
 o editListElements()
Get an enumeration of the elements in the attribute edit list.
 o editListEmpty()
Empty the list of displayed/editable attributes (and thus make no attributes available).
 o editListReset()
Clear the list of displayed/editable attributes (and thus make all attributes available).
 o editListSize()
Get the size of the attribute edit list.
 o free()
Included to help speed release of valuable memory.
 o getAccessibility()
Get the accessibility of this AppObject.
 o getDrawObject()
Get the draw object associated with this AppObject.
 o getElement()
Get the element associated with this AppObject.
 o getHandle()
By default, the Element's name is returned.
 o getRedrawFlag()
Get the current redraw flag.
 o getTagClass(String, String, boolean)
Get the class matching a name / value pair.
 o initialize(Element)
Initializes the AppObject.
 o isOfInterest(String)
Check if the name of an attribute of interest to this class
 o iSpy(Attribute)
Check if supplied attribute is of interest; associated DrawObject, if any, is also checked
 o iSpy(Attribute, Attribute)
Check if supplied attribute is of interest; associated DrawObject, if any, is also checked.
 o properties(MouseEvent, Point)
Called when AppObject properties are requested by a mouseUp event By default, an AttributePanel is displayed in a PopUpCard.
 o selected(MouseEvent, Point)
Called whenever the AppObject is selected by a mouseUp event.
 o setAccessibility(boolean)
Set the accessibility of this AppObject.
 o setAppObject(Element)
Create the AppObject for the given Element.
 o setCurrent(boolean)
Called whenever the currency of the associated Element changes.
 o setDrawObject(DrawObject)
Set DrawObject associated with object.
 o setRedrawFlag(boolean)
Set the redraw flag.
 o update(Observable, Object)
This method is called whenever the observed Attribute is changed.

Constructors

 o AppObject
 public AppObject()
Creates an uninitialized AppObject.

Methods

 o initialize
 protected void initialize(Element element)
Initializes the AppObject. Application writers extending the AppObject class should best call super.initialize(element) when overriding this method.

Parameters:
element - the Element associated with this AppObject
 o addTag
 public static void addTag(String tagName,
                           String tagValue,
                           String className,
                           String drawClassName) throws IllegalArgumentException
Specify the classes to use for the DrawObject and AppObject of an Element based on an attribute name/value pairing. In other words, when an Element has an attribute with name tagName and value tagValue, then use className to instantiate its AppObject and drawClassName to instantiate its DrawObject. Those classes must exist and be sub-classes of AppObject and DrawObject, respectively.

Parameters:
tagName - the attribute name to sit up and take notice of
tagValue - the attribute value used for making the association
className - the class to use for instantiating the AppObject
drawClassName - the class to use for instantiating the DrawObject
Throws: IllegalArgumentException
whenever a parameter is null, a given class name does not exist or is not an appropriate sub-class, or the given relationship is not unique.
 o getTagClass
 public static Class getTagClass(String tagName,
                                 String tagValue,
                                 boolean getApp) throws IllegalArgumentException, ClassNotFoundException
Get the class matching a name / value pair. Whether the AppObject related class or the DrawObject related class is returned depends on an additional parameter.

Parameters:
tagName - the attribute name to require
tagValue - the attribute value to require
getApp - use true to get the AppObject class, false to get the DrawObject class
Returns:
the requested Class
Throws: IllegalArgumentException
whenever the parameters are null
Throws: ClassNotFoundException
whenever the tagName/tagValue combination are not registered or the corresponding class is no longer found.
 o setAppObject
 public static void setAppObject(Element elem) throws InstantiationException
Create the AppObject for the given Element.

Parameters:
elem - the Element whose AppObject is to be created
Throws: InstantiationException
whenever the AppObject cannot be created
 o setRedrawFlag
 public void setRedrawFlag(boolean mode)
Set the redraw flag.

Parameters:
mode - set the redraw flag to this value
 o getRedrawFlag
 public boolean getRedrawFlag()
Get the current redraw flag.

Returns:
true if a redraw is indicated
 o draw
 public void draw(GraphicContext gc,
                  DrawPane pane)
A convenience method for drawing -- calls the drawObject draw method

Parameters:
gc - the graphic context to use when drawing, if this value is null, then the draw object's context is used.
pane - limit drawing to the specified pane, if this value is null, then draw on all panes for this graph.
 o draw
 public void draw()
A convenience method that is equivalent to draw(null,null).

See Also:
draw
 o setCurrent
 public void setCurrent(boolean mode)
Called whenever the currency of the associated Element changes. Allows application writers to take specific action based on currency.

Parameters:
mode - true when the Element becomes current, false when the element is no longer current
See Also:
setCurrent
 o getElement
 public Element getElement()
Get the element associated with this AppObject.

Returns:
the Element associated with this AppObject
 o getDrawObject
 public DrawObject getDrawObject()
Get the draw object associated with this AppObject.

Returns:
the DrawObject associated with this AppObject
 o selected
 public boolean selected(MouseEvent evt,
                         Point p)
Called whenever the AppObject is selected by a mouseUp event. Used for application specific handling

Parameters:
evt - the mouseUp event (for reference)
p - the mouse up point (also for reference)
 o setAccessibility
 public boolean setAccessibility(boolean mode)
Set the accessibility of this AppObject. An inaccessible AppObject means that its corresponding element will not be found using DrawPane.findContainingElement() and this is unreachable via mouse events.

Parameters:
mode - pass true to make the AppObject accessible (default)
Returns:
the previous accessibility value
See Also:
findContainingElement
 o getAccessibility
 public boolean getAccessibility()
Get the accessibility of this AppObject.

Returns:
true if the AppObject is currently accessible
See Also:
setAccessibility
 o properties
 public boolean properties(MouseEvent evt,
                           Point p)
Called when AppObject properties are requested by a mouseUp event By default, an AttributePanel is displayed in a PopUpCard.

Parameters:
evt - the mouseUp event (for reference)
p - the mouse up point (also for reference)
 o free
 public void free()
Included to help speed release of valuable memory.

 o delete
 public void delete()
Called when an element is to be deleted. Can be overridden to provide application specific delete behavior. This method should not be called directly, rather use the delete() method of the Element class.

 o editListAdd
 public void editListAdd(String name)
Add a name to the list of displayed/editable attributes.

Parameters:
name - the attribute name to add to the list
 o editListReset
 public void editListReset()
Clear the list of displayed/editable attributes (and thus make all attributes available).

 o editListEmpty
 public void editListEmpty()
Empty the list of displayed/editable attributes (and thus make no attributes available).

 o editListSize
 public int editListSize()
Get the size of the attribute edit list.

Returns:
the size of the edit list.
 o editListElements
 public Enumeration editListElements()
Get an enumeration of the elements in the attribute edit list.

Returns:
an Enumeration of String objects
 o getHandle
 public String getHandle()
By default, the Element's name is returned. Override to provide a different name. In particular, this method is used by the AttributePanel class.

Returns:
the name of this AppObject
See Also:
AttributePanel
 o setDrawObject
 protected void setDrawObject(DrawObject drawObject)
Set DrawObject associated with object.

Parameters:
drawObject - value to which drawObject is to be set
 o iSpy
 public boolean iSpy(Attribute candidate)
Check if supplied attribute is of interest; associated DrawObject, if any, is also checked

Parameters:
candidate - the attribute to look for
Returns:
true if the attribute is worth watching
 o iSpy
 public boolean iSpy(Attribute candidate,
                     Attribute incumbent)
Check if supplied attribute is of interest; associated DrawObject, if any, is also checked. The incumbent, if not null or equal to the candidate, is no longer observed.

Parameters:
candidate - the attribute to look for
incumbent - the attribute that possibly was observed earlier
Returns:
true if the attribute is worth watching
 o attrOfInterest
 protected void attrOfInterest(String name)
Add the name of an attribute of interest to this object

Parameters:
name - the name of the attribute
 o attrNotOfInterest
 protected void attrNotOfInterest(String name)
Remove the name of an attribute of interest to this object

Parameters:
name - the name of the attribute
 o isOfInterest
 public boolean isOfInterest(String name)
Check if the name of an attribute of interest to this class

Parameters:
name - the name of the attribute
Returns:
true when the name is of interest
 o update
 public void update(Observable obs,
                    Object arg)
This method is called whenever the observed Attribute is changed. This method is requited by the Observer interface.

Parameters:
obs - the object being observed (in this case, an Attribute)
arg - when not null indicated that observation should be shifted from the current Observable (Attribute) to the Observable (Attribute) indicated by the arg
See Also:
Attribute, Observer, Observable

All Packages  Class Hierarchy  This Package  Previous  Next  Index