Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.awt.Marker

java.lang.Object
  |
  +--ncsa.horizon.awt.Marker
Subclasses:
MarkerChain.Node

public class Marker
extends java.lang.Object
implements java.lang.Cloneable, SelectionGraphics
A draggable, marking cursor for a Component.

This allows a distinction to be made between the cursor attached to a component and the cursor used by the windowing system. The cursor can be moved and placed by pressing the mouse button while the window system cursor is "inside" the component cursor, dragging it to a new location, and releasing the mouse button.

The Marker neither generates nor receives events. It can be thought of as a simple decorational widget than knows its location and state, can draw itself given a graphics context, and can be manipulated and queried through method calls. It is the responsibility of the parent component to ask the Marker to draw/redraw itself.


Field Summary
java.awt.Color color
           
java.awt.Component component
           
java.awt.Point grabLoc
           
int heightDec
           
int heightInc
           
int height
           
static int STATE_VISIBLE
           
int state
           
static int STYLE_BOX
          A box marker.
static int STYLE_BULLSEYE
          A box marker with central dot.
static int STYLE_CROSS
          A cross (plus-sign) marker.
static int STYLE_DOT
          A solid block marker.
static int STYLE_OPENCROSS
          A cross marker with open hotspot.
static int STYLE_SPANNINGCROSS
          An cross marker that spans the display.
static int STYLE_TERMINUS
           
static int STYLE_USER_ICON
          A monochrome user-supplied marker.
static int STYLE_USER_PIXMAP
          A fixed-color user-supplied marker.
static int STYLE_X
          An X-shaped marker.
int style
           
int thickness
           
int widthDec
           
int widthInc
           
int width
           
int x
          The x location of the marker.
int y
          The y location of the marker.
 
Constructor Summary
Marker()
          Create a Marker in the default style and size.
Marker(int _size, int _style)
          Create a Marker with a given size and style.
Marker(java.awt.Component _component)
          Create a Marker for a given component.
 
Method Summary
void calcDimensions()
          calculate convenience values for use by other methods.
java.lang.Object clone()
           
void drag(int x, int y)
          Drag this marker to a given location.
void draw(java.awt.Graphics g)
          Draw the marker at its current location.
void draw(java.awt.Graphics g, int x, int y)
          Draw the marker at a given location.
void drop(int _x, int _y)
          Drop this marker.
java.awt.Color getColor()
          Get the color of this Marker.
java.awt.Point getOrigin()
          get the location of the Marker.
java.awt.Dimension getSize()
          get the size of the Marker
int getStyle()
          Get the style of this Marker.
int getThickness()
          Get the current marker line thickness.
void grab()
          Grab this marker in preparation for dragging or placing.
void hide()
          Deprecated. Hide the marker from view.
boolean inside(int _x, int _y)
          Determines if the specified (x,y) location is inside this component.
boolean inside(int _x, int _y, int _pad)
          Determines if the specified (x,y) location is inside or close to this component.
boolean isGrabbed()
          Indicate whether the marker has been grabbed.
boolean isVisible()
          Indicate whether the marker is visible.
java.awt.Point location()
          The location of this Marker in its parent's coordinate space.
void move(int _x, int _y)
          Move this Marker to the coordinate (x,y) in the parent's coordinate space.
void redraw()
          Cause a redisplay of the marker (by calling the component's repaint() method).
void resize(java.awt.Dimension _dim)
          Deprecated. Resize the Marker to the width and height specified by the dimension argument.
void resize(int _width, int _height)
          Deprecated. Resize the Marker to the width and height specified.
void setColor(java.awt.Color _color)
          Set the color for this Marker.
void setComponent(java.awt.Component _component)
          Set the component to attach this Marker to.
void setOrigin(java.awt.Point p)
          set the location of the Marker.
void setSize(java.awt.Dimension d)
          set the size of the Marker
void setSize(int width, int height)
          set the size of the Marker
void setStyle(int _style)
          Set the style for this Marker.
void setThickness(int _thickness)
          Set the line thickness to use.
void setVisible(boolean b)
          set whether the marker is visible
void show()
          Deprecated. Show the marker.
void show(boolean cond)
          Deprecated. If the boolean argument is true, makes the Marker visible.
java.awt.Dimension size()
          Deprecated. Resize the Marker to the width and height specified by the dimension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

x

public int x
The x location of the marker.

y

public int y
The y location of the marker.

height

protected int height

width

protected int width

heightInc

protected int heightInc

widthInc

protected int widthInc

heightDec

protected int heightDec

widthDec

protected int widthDec

thickness

protected int thickness

style

protected int style

color

protected java.awt.Color color

state

protected int state

component

protected java.awt.Component component

grabLoc

protected java.awt.Point grabLoc

STYLE_CROSS

public static final int STYLE_CROSS
A cross (plus-sign) marker.

STYLE_DOT

public static final int STYLE_DOT
A solid block marker.

STYLE_BOX

public static final int STYLE_BOX
A box marker.

STYLE_BULLSEYE

public static final int STYLE_BULLSEYE
A box marker with central dot.

STYLE_OPENCROSS

public static final int STYLE_OPENCROSS
A cross marker with open hotspot.

STYLE_SPANNINGCROSS

public static final int STYLE_SPANNINGCROSS
An cross marker that spans the display.

STYLE_X

public static final int STYLE_X
An X-shaped marker. (Not yet implemented-- awaiting richer graphics API.)

STYLE_USER_ICON

public static final int STYLE_USER_ICON
A monochrome user-supplied marker. (Not yet implemented-- awaiting richer graphics API.)

STYLE_USER_PIXMAP

public static final int STYLE_USER_PIXMAP
A fixed-color user-supplied marker. (Not yet implemented-- awaiting richer graphics API.)

STYLE_TERMINUS

protected static final int STYLE_TERMINUS

STATE_VISIBLE

protected static final int STATE_VISIBLE
Constructor Detail

Marker

public Marker()
Create a Marker in the default style and size. The current default marker is a small cross.

Marker

public Marker(int _size,
              int _style)
Create a Marker with a given size and style.
Parameters:
_size - The size of the marker (height and width are equal)
_style - The style of the marker

Marker

public Marker(java.awt.Component _component)
Create a Marker for a given component.
Parameters:
_component - The component to attach the Marker to.
Method Detail

calcDimensions

protected void calcDimensions()
calculate convenience values for use by other methods.

draw

public void draw(java.awt.Graphics g)
Draw the marker at its current location. It is the responsibility of the applet/application to draw the marker at the appropriate times. This gives maximum flexibility for double buffering, etc.
Parameters:
g - The Graphics context on which to draw the Marker.

draw

public void draw(java.awt.Graphics g,
                 int x,
                 int y)
Draw the marker at a given location. It is the responsibility of the applet/application to draw the marker at the appropriate times. This gives maximum flexibility for double buffering, etc.
Parameters:
g - The Graphics context on which to draw the Marker.
x - the x location at which to draw the marker
y - the y location at which to draw the marker

grab

public void grab()
Grab this marker in preparation for dragging or placing.

drag

public void drag(int x,
                 int y)
Drag this marker to a given location.
Parameters:
_x - the x coordinate.
_y - the y coordinate.

drop

public void drop(int _x,
                 int _y)
Drop this marker.
Parameters:
_x - The x coordinate.
_y - The y coordinate.

move

public void move(int _x,
                 int _y)
Move this Marker to the coordinate (x,y) in the parent's coordinate space. This calls the repaint() method of the Marker's component, who is ultimately responsible for calling the Marker's draw() method.
Parameters:
_x - the x coordinate
_y - the y coordinate

redraw

protected void redraw()
Cause a redisplay of the marker (by calling the component's repaint() method).

getOrigin

public java.awt.Point getOrigin()
get the location of the Marker. This is equivalent to location().
Specified by:
getOrigin in interface SelectionGraphics

setOrigin

public void setOrigin(java.awt.Point p)
set the location of the Marker. This is equivalent to move().
Specified by:
setOrigin in interface SelectionGraphics

location

public java.awt.Point location()
The location of this Marker in its parent's coordinate space.
Returns:
The location of this Marker in its parent's coordinate space.
See Also:
move

setVisible

public void setVisible(boolean b)
set whether the marker is visible
Specified by:
setVisible in interface SelectionGraphics

hide

public void hide()
Deprecated. use setVisible()
Hide the marker from view.

show

public void show()
Deprecated. use setVisible()
Show the marker.

show

public void show(boolean cond)
Deprecated. use setVisible()
If the boolean argument is true, makes the Marker visible. If false, makes the Marker invisible.
Parameters:
cond - if true, show the Marker; if false, hide the Marker.

getSize

public java.awt.Dimension getSize()
get the size of the Marker
Specified by:
getSize in interface SelectionGraphics

setSize

public void setSize(java.awt.Dimension d)
set the size of the Marker
Specified by:
setSize in interface SelectionGraphics

setSize

public void setSize(int width,
                    int height)
set the size of the Marker

size

public java.awt.Dimension size()
Deprecated. use getSize() instead
Resize the Marker to the width and height specified by the dimension
Returns:
The current size of this Marker.

resize

public void resize(java.awt.Dimension _dim)
Deprecated. use setSize() instead
Resize the Marker to the width and height specified by the dimension argument.
Parameters:
_dim - The new dimension of this Marker.

resize

public void resize(int _width,
                   int _height)
Deprecated. use setSize() instead
Resize the Marker to the width and height specified.
Parameters:
_width - The new width of this Marker.
_height - The new height of this Marker.

inside

public boolean inside(int _x,
                      int _y)
Determines if the specified (x,y) location is inside this component.
Parameters:
_x - The x coordinate
_y - The y coordinate
Returns:
true if the specified (x,y) location lies within this component; false otherwise.
See Also:
locate

inside

public boolean inside(int _x,
                      int _y,
                      int _pad)
Determines if the specified (x,y) location is inside or close to this component.
Parameters:
_x - The x coordinate
_y - The y coordinate
_pad - The pad value. This amount is added to each side of the bounding box of the marker for determining insideness.
Returns:
true if the specified (x,y) location lies within this component; false otherwise.
See Also:
locate

isVisible

public boolean isVisible()
Indicate whether the marker is visible.
Specified by:
isVisible in interface SelectionGraphics
Returns:
boolean true if this Marker is showing; false if it is hidden.
See Also:
show

isGrabbed

public boolean isGrabbed()
Indicate whether the marker has been grabbed.
Returns:
boolean true if this Marker has been grabbed; otherwise false
See Also:
grab, drop

setComponent

public void setComponent(java.awt.Component _component)
Set the component to attach this Marker to.
Parameters:
_component - The component to attach the Marker to.

setStyle

public void setStyle(int _style)
Set the style for this Marker.
Parameters:
_style - The style to use for the marker.

getStyle

public int getStyle()
Get the style of this Marker.
Returns:
The style of the marker.

setColor

public void setColor(java.awt.Color _color)
Set the color for this Marker.
Specified by:
setColor in interface SelectionGraphics
Parameters:
_color - The Color to use to draw the marker.

getColor

public java.awt.Color getColor()
Get the color of this Marker.
Specified by:
getColor in interface SelectionGraphics
Returns:
The Color used to draw the marker.

setThickness

public void setThickness(int _thickness)
Set the line thickness to use. This controls the width of the lines that make up box- and cross-style markers, and the size of the center portion of open- and bullseye-style markers.
Specified by:
setThickness in interface SelectionGraphics
Parameters:
int - The thickness of the marker elements.

getThickness

public int getThickness()
Get the current marker line thickness.
Specified by:
getThickness in interface SelectionGraphics
Returns:
The thicknes of the marker elements.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD