Class sgraphics.ViewerImpl
All Packages Class Hierarchy This Package Previous Next Index
Class sgraphics.ViewerImpl
java.lang.Object
|
+----sgraphics.GlyphImpl
|
+----sgraphics.MonoGlyph
|
+----sgraphics.ViewerImpl
- public class ViewerImpl
- extends MonoGlyph
- implements Viewer
A viewer that is used to view a tree glyphs or figures. Viewers are
chained by pick and processEvent(...) dispatches calls to handleEvent()
when there is a hit by glyphs under the viewer. Another viewer
qualifies as another glyph.
Note: The event MOUSE_DOWN calls grab() and the event MOUSE_UP calls
ungrab(), therefore, calling grab() between these events has
no effect. In other words, calling grab() in mouseDown(...),
or mouseDrag(...) is pointless and useless.
-
ViewerImpl(Glyph)
- Make a viewer of a glyph.
-
ViewerImpl(Glyph, ViewerCallback)
- Make a viewer of a glyph with a callback.
-
action(GraphicsEvent, Object)
- /**
Called when an action occurs in the Component.
-
getHitList()
- Gets an array of decendent glyphs that were hit after the last pick.
-
grabbing()
- Ask if this viewer is grabbing the events.
-
handleEvent(GraphicsEvent)
- Handles the event.
-
keyActionDown(GraphicsEvent, int)
- Called when an action character is pressed.
-
keyActionUp(GraphicsEvent, int)
- Called when an action character is released.
-
keyDown(GraphicsEvent, int)
- Called when a character is pressed.
-
keyUp(GraphicsEvent, int)
- Called when a character is released.
-
mouseDown(GraphicsEvent, float, float)
- Called when the mouse is pressed.
-
mouseDrag(GraphicsEvent, float, float)
- Called when the mouse is dragged (the mouse button is down).
-
mouseEnter(GraphicsEvent, float, float)
- Called when the mouse enters the component.
-
mouseExit(GraphicsEvent, float, float)
- Called when the mouse exits the component.
-
mouseMove(GraphicsEvent, float, float)
- Called when the mouse moves (the mouse button is up).
-
mouseUp(GraphicsEvent, float, float)
- Called when the mouse is released.
-
pick(Picker)
- Checks for hits.
-
processPick(Picker, GraphicsEvent)
- Process a pick.
-
removeCallback()
- Remove the callback.
-
setCallback(ViewerCallback)
- Set a callback.
-
setParent(Glyph)
-
ViewerImpl
public ViewerImpl(Glyph glyph)
- Make a viewer of a glyph.
- Parameters:
- glyph - the viewed glyph.
ViewerImpl
public ViewerImpl(Glyph glyph,
ViewerCallback callback)
- Make a viewer of a glyph with a callback. As a side effect the
ViewerCallback functions in Viewer will no longer be called.
- Parameters:
- glyph - the viewed glyph.
- callback - the callback object.
setCallback
public void setCallback(ViewerCallback callback)
- Set a callback. As a side effect the ViewerCallback functions in Viewer
will no longer be called.
- Parameters:
- callback - the callback object.
removeCallback
public void removeCallback()
- Remove the callback. The ViewerCallback methods in Viewer
will then be called.
setParent
public void setParent(Glyph parent)
- Overrides:
- setParent in class GlyphImpl
grabbing
public boolean grabbing()
- Ask if this viewer is grabbing the events.
- Returns:
- true if grabbing.
pick
public void pick(Picker pick)
- Checks for hits. Builds a chain of pickers.
- Parameters:
- pick - the picker.
- Overrides:
- pick in class MonoGlyph
getHitList
public Glyph[] getHitList()
- Gets an array of decendent glyphs that were hit after the last pick.
If no glyphs were hit, this returns null.
- Returns:
- the hit list.
processPick
public boolean processPick(Picker pick,
GraphicsEvent event)
- Process a pick. Calls processPick(...) on the next viewer first.
If processPick(...) on the next viewer returns false and this
viewer has a hit, process the event.
- Parameters:
- pick - a picker chain with a path to all the hits.
- event - the event.
- return - true if the event was processed.
handleEvent
public boolean handleEvent(GraphicsEvent evt)
- Handles the event. Returns true if the event is handled. The default
event handler calls some helper methods to make life easier
on the programmer. If a callback was registered, then the helper
methods of the callback object are called instead of the ones
in this object.
- Parameters:
- evt - the event
- Returns:
- true if the event was handled.
- See Also:
- mouseEnter, mouseExit, mouseMove, mouseDown, mouseDrag, mouseUp, keyDown, action
mouseDown
public boolean mouseDown(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse is pressed.
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
mouseDrag
public boolean mouseDrag(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse is dragged (the mouse button is down).
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
mouseUp
public boolean mouseUp(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse is released.
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
mouseMove
public boolean mouseMove(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse moves (the mouse button is up).
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
mouseEnter
public boolean mouseEnter(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse enters the component.
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
mouseExit
public boolean mouseExit(GraphicsEvent evt,
float X,
float Y)
- Called when the mouse exits the component.
- Parameters:
- evt - the event
- X - the x coordinate
- Y - the y coordinate
- See Also:
- handleEvent
keyDown
public boolean keyDown(GraphicsEvent evt,
int key)
- Called when a character is pressed.
- Parameters:
- evt - the event
- key - the key that's pressed
- See Also:
- handleEvent
keyUp
public boolean keyUp(GraphicsEvent evt,
int key)
- Called when a character is released.
- Parameters:
- evt - the event
- key - the key that's released
- See Also:
- handleEvent
keyActionDown
public boolean keyActionDown(GraphicsEvent evt,
int key)
- Called when an action character is pressed.
- Parameters:
- evt - the event
- key - the key that's pressed
- See Also:
- handleEvent
keyActionUp
public boolean keyActionUp(GraphicsEvent evt,
int key)
- Called when an action character is released.
- Parameters:
- evt - the event
- key - the key that's released
- See Also:
- handleEvent
action
public boolean action(GraphicsEvent evt,
Object what)
- /**
Called when an action occurs in the Component.
- Parameters:
- evt - the event
- what - the action that's occuring
- See Also:
- handleEvent
All Packages Class Hierarchy This Package Previous Next Index