public class MouseModule extends java.lang.Object implements Editable, Displayable, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener
Modifier and Type | Class and Description |
---|---|
protected static class |
MouseModule.Pos
used by subclasses to describe positions.
|
Modifier and Type | Field and Description |
---|---|
protected DragRenderer |
dragRenderer |
protected static java.util.logging.Logger |
logger |
protected DasCanvasComponent |
parent |
Modifier | Constructor and Description |
---|---|
protected |
MouseModule() |
|
MouseModule(DasCanvasComponent parent)
create the mouse module for the parent component.
|
|
MouseModule(DasCanvasComponent parent,
DragRenderer dragRenderer,
java.lang.String label)
create the mouse module for the parent component using the dragRenderer to
paint graphic feedback to the human operator.
|
Modifier and Type | Method and Description |
---|---|
protected static boolean |
axisIsAdjustable(DasAxis axis)
return true if the axis is not an axis with enumeration units.
|
void |
drawListIcon(java.awt.Graphics2D g,
int x,
int y)
implement this to provide nice drawing of icon on printing graphics context.
|
java.awt.Cursor |
getCursor()
return a cursor that indicates the selected module.
|
java.lang.String |
getDirections()
allow one-line directions to be added to the mouse module.
|
DragRenderer |
getDragRenderer()
return the current drag renderer.
|
java.lang.String |
getLabel()
returns a human-readable string that identifies the module
|
javax.swing.Icon |
getListIcon()
return the list icon.
|
java.lang.String |
getListLabel()
return a
String that will help the user
identify this item when choosing from a list. |
DasCanvasComponent |
getParent()
return the canvas component (for example, a DasPlot) where this
MouseModule is listening.
|
void |
keyPressed(java.awt.event.KeyEvent keyEvent) |
void |
keyReleased(java.awt.event.KeyEvent keyEvent) |
void |
keyTyped(java.awt.event.KeyEvent keyEvent) |
protected static DatumRange |
maybeRound(DasAxis xAxis,
DatumRange dr)
round to the nearest nice interval by looking for a DomainDivider in the axis.
|
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePointSelected(MousePointSelectionEvent e)
Action to take when a point (click or drag) is selected.
|
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseRangeSelected(MouseDragEvent e)
Action to take when a mouse range (click, drag, release) has been
selected.
|
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e) |
MouseModule.Pos |
position(DasDevicePosition ddp,
int pos,
int threshold)
indicate if the position (pixels) is near the ends of the DasRow or
DasColumn.
|
void |
setDirections(java.lang.String directions)
set the human-readable directions string, so clients like Autoplot can display
them.
|
void |
setDragRenderer(DragRenderer d)
set the drag renderer.
|
void |
setLabel(java.lang.String label)
set the human-readable label.
|
protected static final java.util.logging.Logger logger
protected DragRenderer dragRenderer
protected DasCanvasComponent parent
protected MouseModule()
public MouseModule(DasCanvasComponent parent)
parent
- the component, such as a DasPlot for the crosshair digitizer or the DasAxis for zoom.public MouseModule(DasCanvasComponent parent, DragRenderer dragRenderer, java.lang.String label)
parent
- the component, such as a DasPlot for the crosshair digitizer or the DasAxis for zoom.dragRenderer
- the drag renderer to provide feedbacklabel
- label for the mouse module.public java.lang.String getLabel()
public java.awt.Cursor getCursor()
public DragRenderer getDragRenderer()
public void setDragRenderer(DragRenderer d)
d
- set the drag renderer.public void mouseRangeSelected(MouseDragEvent e)
e
- the drag event.public void mousePointSelected(MousePointSelectionEvent e)
e
- the event.public final void setLabel(java.lang.String label)
label
- the human-readable label.public DasCanvasComponent getParent()
protected static DatumRange maybeRound(DasAxis xAxis, DatumRange dr)
xAxis
- the axisdr
- a datum range.protected static boolean axisIsAdjustable(DasAxis axis)
axis
- the axis, which might have enumeration units.public java.lang.String getDirections()
public void setDirections(java.lang.String directions)
directions
- human-readable directions.public javax.swing.Icon getListIcon()
getListIcon
in interface Displayable
public void drawListIcon(java.awt.Graphics2D g, int x, int y)
Displayable
drawListIcon
in interface Displayable
g
- the graphics context.x
- the x position, typically 0.y
- the y position, typically 0.public java.lang.String getListLabel()
Displayable
String
that will help the user
identify this item when choosing from a list.getListLabel
in interface Displayable
public void keyPressed(java.awt.event.KeyEvent keyEvent)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent keyEvent)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent keyEvent)
keyTyped
in interface java.awt.event.KeyListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public MouseModule.Pos position(DasDevicePosition ddp, int pos, int threshold)
ddp
- the row or columnpos
- the position to describe.threshold
- pixel distance to the boundary, 20 is often used.