|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuavsim.graphics.instruments.A_Instrument
public abstract class A_Instrument
Defines the shared elements of all instruments.
| Field Summary | |
|---|---|
protected CoordinateCartesianAbsolute |
_canvasAnchor
the center anchor within the canvas |
protected Size |
_canvasSize
the canvas size in pixels; instruments themselves decide how to scale based on this |
private java.util.List<A_Control> |
_controls
any registered controls |
protected java.awt.Graphics2D |
_graphics
the graphics context |
protected java.lang.String |
_id
the unique instrument identifier |
private javax.swing.JComponent |
_parentComponent
the graphical parent component that this instrument belongs to |
private static boolean |
DUMP_EVENTS
whether to dump events to standard output for debugging |
private static boolean |
RENDER_CANVAS_BOUNDS
whether to render a box around the canvas bounds for debugging |
| Constructor Summary | |
|---|---|
A_Instrument(java.lang.String id,
int canvasSize,
CoordinateCartesianAbsolute canvasAnchor)
Creates an abstract instrument. |
|
| Method Summary | |
|---|---|
CoordinateCartesianAbsolute |
getAnchor()
Gets the center anchor point. |
Size |
getCanvasSize()
Gets the size of the instrument. |
java.awt.Graphics2D |
getGraphics()
Gets the graphics context on which to render the instrument. |
java.lang.String |
getID()
Returns the unique instrument identifier. |
javax.swing.JComponent |
getParentComponent()
Gets the graphical parent component that this instrument belongs to. |
void |
handleControlCallback(ControlCallbackEvent event)
Handles an event from a registered control. |
boolean |
hasControls()
Returns whether this instrument has any registered controls. |
void |
mouseClicked(java.awt.event.MouseEvent event)
|
void |
mouseDragged(java.awt.event.MouseEvent event)
|
void |
mouseEntered(java.awt.event.MouseEvent event)
|
void |
mouseExited(java.awt.event.MouseEvent event)
|
void |
mouseMoved(java.awt.event.MouseEvent event)
|
void |
mousePressed(java.awt.event.MouseEvent event)
|
void |
mouseReleased(java.awt.event.MouseEvent event)
|
private void |
propagateEvent(java.awt.event.MouseEvent event)
Propagates any mouse event on a registered control to the control. |
void |
refresh()
Forces the parent component to perform a repaint. |
protected void |
registerControl(A_Control control)
Registers a control with this instrument. |
void |
render(java.awt.Graphics graphics)
Renders the current state of the instrument. |
void |
setCanvasAnchor(CoordinateCartesianAbsolute canvasAnchor)
Sets the center anchor point. |
void |
setCanvasSize(Size canvasSize)
Sets the size of canvas on which to render the instrument. |
void |
setParentComponent(javax.swing.JComponent parentComponent)
Sets the graphical parent component that this instrument belongs to. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CoordinateCartesianAbsolute _canvasAnchor
protected Size _canvasSize
private final java.util.List<A_Control> _controls
protected java.awt.Graphics2D _graphics
protected final java.lang.String _id
private javax.swing.JComponent _parentComponent
private static final boolean DUMP_EVENTS
private static final boolean RENDER_CANVAS_BOUNDS
| Constructor Detail |
|---|
public A_Instrument(java.lang.String id,
int canvasSize,
CoordinateCartesianAbsolute canvasAnchor)
id - - the unique instrument identifiercanvasSize - - the square size of the instrument footprint in pixelscanvasAnchor - - the anchor position for the center of the canvas in pixels| Method Detail |
|---|
public CoordinateCartesianAbsolute getAnchor()
public Size getCanvasSize()
public java.awt.Graphics2D getGraphics()
public java.lang.String getID()
public javax.swing.JComponent getParentComponent()
public void handleControlCallback(ControlCallbackEvent event)
event - - the callback eventpublic boolean hasControls()
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent event)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mousePressed(java.awt.event.MouseEvent event)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased in interface java.awt.event.MouseListenerprivate void propagateEvent(java.awt.event.MouseEvent event)
event - - the mouse eventpublic void refresh()
protected void registerControl(A_Control control)
control - - the controlpublic void render(java.awt.Graphics graphics)
graphics - - the graphics contextpublic void setCanvasAnchor(CoordinateCartesianAbsolute canvasAnchor)
canvasAnchor - - the anchorpublic void setCanvasSize(Size canvasSize)
canvasSize - - the size in pixelspublic void setParentComponent(javax.swing.JComponent parentComponent)
parentComponent - - the component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||