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
-
AppObject()
- Creates an uninitialized AppObject.
-
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.
-
attrNotOfInterest(String)
- Remove the name of an attribute of interest to this object
-
attrOfInterest(String)
- Add the name of an attribute of interest to this object
-
delete()
- Called when an element is to be deleted.
-
draw()
- A convenience method that is equivalent to draw(null,null).
-
draw(GraphicContext, DrawPane)
- A convenience method for drawing -- calls the drawObject draw method
-
editListAdd(String)
- Add a name to the list of displayed/editable attributes.
-
editListElements()
- Get an enumeration of the elements in the attribute edit list.
-
editListEmpty()
- Empty the list of displayed/editable attributes (and thus make no
attributes available).
-
editListReset()
- Clear the list of displayed/editable attributes (and thus make all
attributes available).
-
editListSize()
- Get the size of the attribute edit list.
-
free()
- Included to help speed release of valuable memory.
-
getAccessibility()
- Get the accessibility of this AppObject.
-
getDrawObject()
- Get the draw object associated with this AppObject.
-
getElement()
- Get the element associated with this AppObject.
-
getHandle()
- By default, the Element's name is returned.
-
getRedrawFlag()
- Get the current redraw flag.
-
getTagClass(String, String, boolean)
- Get the class matching a name / value pair.
-
initialize(Element)
- Initializes the AppObject.
-
isOfInterest(String)
- Check if the name of an attribute of interest to this class
-
iSpy(Attribute)
- Check if supplied attribute is of interest; associated DrawObject,
if any, is also checked
-
iSpy(Attribute, Attribute)
- Check if supplied attribute is of interest; associated DrawObject,
if any, is also checked.
-
properties(MouseEvent, Point)
- Called when AppObject properties are requested by a mouseUp event
By default, an AttributePanel is displayed in a PopUpCard.
-
selected(MouseEvent, Point)
- Called whenever the AppObject is selected by a mouseUp event.
-
setAccessibility(boolean)
- Set the accessibility of this AppObject.
-
setAppObject(Element)
- Create the AppObject for the given Element.
-
setCurrent(boolean)
- Called whenever the currency of the associated Element changes.
-
setDrawObject(DrawObject)
- Set DrawObject associated with object.
-
setRedrawFlag(boolean)
- Set the redraw flag.
-
update(Observable, Object)
- This method is called whenever the observed Attribute is changed.
AppObject
public AppObject()
- Creates an uninitialized AppObject.
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
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.
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.
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
setRedrawFlag
public void setRedrawFlag(boolean mode)
- Set the redraw flag.
- Parameters:
- mode - set the redraw flag to this value
getRedrawFlag
public boolean getRedrawFlag()
- Get the current redraw flag.
- Returns:
- true if a redraw is indicated
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.
draw
public void draw()
- A convenience method that is equivalent to draw(null,null).
- See Also:
- draw
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
getElement
public Element getElement()
- Get the element associated with this AppObject.
- Returns:
- the Element associated with this AppObject
getDrawObject
public DrawObject getDrawObject()
- Get the draw object associated with this AppObject.
- Returns:
- the DrawObject associated with this AppObject
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)
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
getAccessibility
public boolean getAccessibility()
- Get the accessibility of this AppObject.
- Returns:
- true if the AppObject is currently accessible
- See Also:
- setAccessibility
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)
free
public void free()
- Included to help speed release of valuable memory.
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.
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
editListReset
public void editListReset()
- Clear the list of displayed/editable attributes (and thus make all
attributes available).
editListEmpty
public void editListEmpty()
- Empty the list of displayed/editable attributes (and thus make no
attributes available).
editListSize
public int editListSize()
- Get the size of the attribute edit list.
- Returns:
- the size of the edit list.
editListElements
public Enumeration editListElements()
- Get an enumeration of the elements in the attribute edit list.
- Returns:
- an Enumeration of String objects
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
setDrawObject
protected void setDrawObject(DrawObject drawObject)
- Set DrawObject associated with object.
- Parameters:
- drawObject - value to which drawObject is to be set
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
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
attrOfInterest
protected void attrOfInterest(String name)
- Add the name of an attribute of interest to this object
- Parameters:
- name - the name of the attribute
attrNotOfInterest
protected void attrNotOfInterest(String name)
- Remove the name of an attribute of interest to this object
- Parameters:
- name - the name of the attribute
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
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