GeoAPI 1.0
Build 2004-05-18

org.opengis.go.display.primitive
Interface Graphic

All Known Subinterfaces:
AggregateGraphic, GraphicArc, GraphicCompositeCurve, GraphicCurveSegment, GraphicIcon, GraphicLabel, GraphicRing, GraphicScaledImage, GraphicSurfaceBoundary, GraphicSymbol, OrderedAggregateGraphic

public interface Graphic

The root abstraction of a graphic object taxonomy, specifying the methods common to a lightweight set of graphic objects.

Version:
$Revision: 1.2.2.1 $, $Date: 2004/05/18 11:20:27 $
Author:
OpenGIS® consortium

Method Summary
 void addGraphicListener(GraphicListener listener)
          Adds the given listener to this Graphic's list of listeners.
 Graphic cloneGraphic()
          Creates a new Graphic of the same type as this object.
 void dispose()
          Method that can be called when an object is no longer needed.
 void fireGraphicEvent(GraphicEvent ge)
          Calls the graphic event method of all listeners in this Graphic's list of listeners.
 Object getClientProperty(Object key)
          Returns the value of the property with the specified key.
 GraphicStyle getGraphicStyle()
          Returns the GraphicStyle for this Graphic.
 String getName()
          Returns the name assigned to this Graphic.
 Graphic getParent()
          Returns the parent of this Graphic.
 boolean isPassingEventsToParent()
          Returns a boolean indicating whether mouse events on this Graphic will be passed to the parent Graphic in addition to being passed to any listeners on this object.
 boolean isShowingAnchorHandles()
          Returns the boolean flag that indicates whether this object is showing anchor handles.
 boolean isShowingEditHandles()
          Returns the boolean flag that specifies whether this object is showing its edit handles.
 void putClientProperty(Object key, Object value)
          Adds an arbitrary key/value "client property" to this Graphic.
 void refresh()
          Flags this Graphic object as needing to be redrawn, due to changes to the internal data of the object which affect the rendering of the object.
 void removeGraphicListener(GraphicListener listener)
          Removes the given listener from this Graphic's list of listeners.
 void setName(String name)
          Sets the name of this Graphic to the given value.
 void setParent(Graphic parent)
          Sets the parent of this Graphic.
 void setPassingEventsToParent(boolean passToParent)
          Sets a boolean indicating whether mouse events on this Graphic should be passed to the parent Graphic in addition to being passed to any listeners on this object.
 void setShowingAnchorHandles(boolean showingHandles)
          Sets a boolean flag indicating whether this object is to show anchor handles.
 void setShowingEditHandles(boolean showingHandles)
          Sets a boolean flag specifying whether this object is to show its edit handles.
 

Method Detail

dispose

void dispose()
Method that can be called when an object is no longer needed. Implementations may use this method to release resources, if needed. Implementations may also implement this method to return an object to an object pool. It is an error to reference a Graphic in any way after its dispose method has been called.


refresh

void refresh()
Flags this Graphic object as needing to be redrawn, due to changes to the internal data of the object which affect the rendering of the object.

The actual flag set/unset mechanism is implementation-specific. The implementation also choses the manner and timing in which both the flag is checked and the Graphic object is redrawn.

An application would call this method when any geometric information for this Graphic object has changed; for example, when the underlying Geometry instance is changed or data in that instance has changed.


setName

void setName(String name)
Sets the name of this Graphic to the given value.

Parameters:
name - the new name to assign to this Graphic.

getName

String getName()
Returns the name assigned to this Graphic.

Returns:
the name assigned to this Graphic.

setParent

void setParent(Graphic parent)
Sets the parent of this Graphic.

Parameters:
parent - the parent of this Graphic.

REVISIT OPEN ISSUE (a GeoAPI comment)
The argument type is inconsistent with the getParent() return type.

getParent

Graphic getParent()
Returns the parent of this Graphic. This is most likely of type AggregateGraphic or GraphicCompositeCurve.

Returns:
the parent of this Graphic.

getGraphicStyle

GraphicStyle getGraphicStyle()
Returns the GraphicStyle for this Graphic. Implementations should return a reference to their internal GraphicStyle object, so that users may modify this Graphic's style properties directly through the style object.

Returns:
@return the GraphicStyle.

getClientProperty

Object getClientProperty(Object key)
Returns the value of the property with the specified key. Only properties added with putClientProperty will return a non-null value.

Returns:
the value of this property or null.
See Also:
putClientProperty(java.lang.Object, java.lang.Object)

putClientProperty

void putClientProperty(Object key,
                       Object value)
Adds an arbitrary key/value "client property" to this Graphic. The get/putClientProperty methods provide access to a small per-instance hashtable. Callers can use get/putClientProperty to annotate Graphics that were created by another module. If value is null this method will remove the property. Changes to client properties are reported with PropertyChange events. The name of the property (for the sake of PropertyChange events) is key.toString(). The clientProperty dictionary is not intended to support large scale extensions to Graphic nor should be it considered an alternative to subclassing when designing a new component.

Parameters:
key - the Object containing the key string.
value - the Object that is the client data.
See Also:
getClientProperty(java.lang.Object)

setPassingEventsToParent

void setPassingEventsToParent(boolean passToParent)
Sets a boolean indicating whether mouse events on this Graphic should be passed to the parent Graphic in addition to being passed to any listeners on this object. The default is false, indicating that events will not be passed to the parent. If the boolean is true, then the event will be passed to the parent after having been passed to the listeners on this object.

Parameters:
passToParent - true if events should be passed to the parent graphic, false if they should not.

isPassingEventsToParent

boolean isPassingEventsToParent()
Returns a boolean indicating whether mouse events on this Graphic will be passed to the parent Graphic in addition to being passed to any listeners on this object. The default is false, indicating that events will not be passed to the parent. If the boolean is true, then the event will be passed to the parent after having been passed to the listeners on this object.

Returns:
true if this graphic pass the events to the parent graphic.

setShowingEditHandles

void setShowingEditHandles(boolean showingHandles)
Sets a boolean flag specifying whether this object is to show its edit handles. Edit handles are the small boxes that appear on the end of a line segment or on the four corners of a box that a users selects to edit this object.

Parameters:
showingHandles - true if this object show its edit handles.

isShowingEditHandles

boolean isShowingEditHandles()
Returns the boolean flag that specifies whether this object is showing its edit handles.

Returns:
true means it is showing its handles.

setShowingAnchorHandles

void setShowingAnchorHandles(boolean showingHandles)
Sets a boolean flag indicating whether this object is to show anchor handles. Anchor handles allow the object to be moved in the display.


isShowingAnchorHandles

boolean isShowingAnchorHandles()
Returns the boolean flag that indicates whether this object is showing anchor handles. Anchor handles allow the object to be moved in the display.


cloneGraphic

Graphic cloneGraphic()
Creates a new Graphic of the same type as this object. The resulting object should be identical in all respects to the original.


REVISIT OPEN ISSUE (a GeoAPI comment)
Consider overriding Object.clone() instead.

addGraphicListener

void addGraphicListener(GraphicListener listener)
Adds the given listener to this Graphic's list of listeners. Listeners are notified of key, mouse, and change events that affect this Graphic.

Parameters:
listener - the GraphicListener to add.

removeGraphicListener

void removeGraphicListener(GraphicListener listener)
Removes the given listener from this Graphic's list of listeners.

Parameters:
listener - the GraphicListener to remove.

fireGraphicEvent

void fireGraphicEvent(GraphicEvent ge)
Calls the graphic event method of all listeners in this Graphic's list of listeners. The listeners need to determine which subclassed event is called and what event-specific action was taken.

Parameters:
ge - the GraphicEvent to give to the listeners.
See Also:
GraphicListener, GraphicEvent, GraphicChangeEvent, GraphicMouseEvent

REVISIT OPEN ISSUE (a GeoAPI comment)
Usually, this kind of method is a protected one in the implementation class, not a public method in the interface...

GeoAPI 1.0
Build 2004-05-18

Symbols, terms and definitions
Copyright OpenGIS® Consortium