VASSAL.build.module.map
Class LOS_Thread
java.lang.Object
|
+--VASSAL.build.AbstractBuildable
|
+--VASSAL.build.AbstractConfigurable
|
+--VASSAL.build.module.map.LOS_Thread
- All Implemented Interfaces:
- AutoConfigurable, Buildable, Configurable, Drawable, java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, ValidityChecker
- public class LOS_Thread
- extends AbstractConfigurable
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, Drawable, Configurable
A class that allows the user to draw a straight line on a Map (LOS
= Line Of Sight). No automatic detection of obstacles is
performed; the user must simply observe the thread against the
image of the map. However, if the user clicks on a board with a
Grid, the thread may snap to the grid and report the
distance between endpoints of the line
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SNAP_LOS
public static final java.lang.String SNAP_LOS
LOS_COLOR
public static final java.lang.String LOS_COLOR
HOTKEY
public static final java.lang.String HOTKEY
LABEL
public static final java.lang.String LABEL
DRAW_RANGE
public static final java.lang.String DRAW_RANGE
HIDE_COUNTERS
public static final java.lang.String HIDE_COUNTERS
RANGE_BACKGROUND
public static final java.lang.String RANGE_BACKGROUND
RANGE_FOREGROUND
public static final java.lang.String RANGE_FOREGROUND
RANGE_SCALE
public static final java.lang.String RANGE_SCALE
RANGE_ROUNDING
public static final java.lang.String RANGE_ROUNDING
ROUND_UP
public static final java.lang.String ROUND_UP
ROUND_DOWN
public static final java.lang.String ROUND_DOWN
ROUND_OFF
public static final java.lang.String ROUND_OFF
RANGE_FONT
public static java.awt.Font RANGE_FONT
retainAfterRelease
protected boolean retainAfterRelease
lastRelease
protected long lastRelease
map
protected Map map
launch
protected LaunchButton launch
hotkey
protected javax.swing.KeyStroke hotkey
anchor
protected java.awt.Point anchor
arrow
protected java.awt.Point arrow
visible
protected boolean visible
drawRange
protected boolean drawRange
rangeScale
protected int rangeScale
rangeRounding
protected double rangeRounding
hideCounters
protected boolean hideCounters
fixedColor
protected java.lang.String fixedColor
threadColor
protected java.awt.Color threadColor
rangeFg
protected java.awt.Color rangeFg
rangeBg
protected java.awt.Color rangeBg
LOS_Thread
public LOS_Thread()
isVisible
public boolean isVisible()
- Returns:
- whether the thread should be drawn
setVisible
public void setVisible(boolean state)
- If true, draw the thread on the map
addTo
public void addTo(Buildable b)
- Expects to be added to a
Map. Adds a button to the map
window's toolbar. Pushing the button pushes a MouseListener
onto the Map that draws the thread. Adds some entries to
preferences
- Specified by:
addTo in interface Buildable
- See Also:
Map.pushMouseListener(java.awt.event.MouseListener)
removeFrom
public void removeFrom(Buildable b)
- Description copied from interface:
Configurable
- Remove this component from its parent
- Specified by:
removeFrom in interface Configurable
getAttributeNames
public java.lang.String[] getAttributeNames()
- The attributes of an LOS_Thread are:
LABEL: the label of the button
HOTKEY: the hotkey equivalent of the button
DRAW_RANGE: If true, draw the distance between endpoints of the thread
RANGE_FOREGROUND: the color of the text when drawing the distance
RANGE_BACKGROUND: the color of the background rectangle when drawing the distance
HIDE_COUNTERS: If true, hide all GamePieces on the map when drawing the thread
- Overrides:
getAttributeNames in class AbstractBuildable
- Following copied from interface:
VASSAL.build.AutoConfigurable
- Returns:
- an array of Strings giving all attributes of this Buildable
component that will be written to/read from an XML element
setAttribute
public void setAttribute(java.lang.String key,
java.lang.Object value)
- Description copied from interface:
AutoConfigurable
- Called by the
Buildable.build(org.w3c.dom.Element) method, where value is the
String value read by the XML attribute.
Can also be called with Object value to set the attribute.
- Overrides:
setAttribute in class AbstractBuildable
- Following copied from class:
VASSAL.build.AbstractBuildable
- Parameters:
key - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()
getAttributeValueString
public java.lang.String getAttributeValueString(java.lang.String key)
- Description copied from interface:
AutoConfigurable
- Called by the
Buildable.getBuildElement(org.w3c.dom.Document) method to write the
attributes into an XML element
- Overrides:
getAttributeValueString in class AbstractBuildable
- Following copied from class:
VASSAL.build.AbstractBuildable
- Parameters:
key - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()
setup
public void setup(boolean show)
draw
public void draw(java.awt.Graphics g,
Map m)
- Specified by:
draw in interface Drawable
launch
protected void launch()
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Since we register ourselves as a MouseListener using
Map.pushMouseListener(java.awt.event.MouseListener), these mouse events are received in map
coordinates
- Specified by:
mouseEntered in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited in interface java.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Since we register ourselves as a MouseMotionListener directly,
these mouse events are received in component
coordinates
- Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
drawRange
public void drawRange(java.awt.Graphics g,
int range)
- Writes text showing the range
- Parameters:
range - the range to display, in whatever units returned
by the MapGrid containing the thread
getConfigureTypeName
public static java.lang.String getConfigureTypeName()
getConfigureName
public java.lang.String getConfigureName()
- Description copied from interface:
Configurable
- The name of this Configurable Object
- Specified by:
getConfigureName in interface Configurable- Overrides:
getConfigureName in class AbstractConfigurable
getHelpFile
public HelpFile getHelpFile()
- Specified by:
getHelpFile in interface Configurable
- Following copied from interface:
VASSAL.build.Configurable
- Returns:
- a HelpFilte describing how to use and configure
this component
getAttributeDescriptions
public java.lang.String[] getAttributeDescriptions()
- Description copied from class:
AbstractConfigurable
- Return an array of Strings describing the attributes
of this object. These strings are used as prompts in
the Properties window for this object. The order of
descriptions should be the same as the order of names
in
AbstractBuildable.getAttributeNames()
- Overrides:
getAttributeDescriptions in class AbstractConfigurable
getAttributeTypes
public java.lang.Class[] getAttributeTypes()
- Description copied from class:
AbstractConfigurable
- Return the Class for the attributes of this object.
Valid classes are: String, Integer, Double, Boolean, Image,
Color, and KeyStroke
The order of classes should be the same as the order of names
in
AbstractBuildable.getAttributeNames()
- Overrides:
getAttributeTypes in class AbstractConfigurable
getAttributeVisibility
public VisibilityCondition getAttributeVisibility(java.lang.String name)
- Description copied from class:
AbstractConfigurable
- By default, all attributes are visible
- Overrides:
getAttributeVisibility in class AbstractConfigurable
- Following copied from class:
VASSAL.build.AbstractConfigurable
- Parameters:
name - - Returns:
-
getConfigureComponents
public Configurable[] getConfigureComponents()
- Specified by:
getConfigureComponents in interface Configurable- Overrides:
getConfigureComponents in class AbstractConfigurable
- Following copied from interface:
VASSAL.build.Configurable
- Returns:
- an array of Configurer objects representing
the Configurable children of this Configurable object
getAllowableConfigureComponents
public java.lang.Class[] getAllowableConfigureComponents()
- Description copied from interface:
Configurable
- Return a list of valid sub-component Classes. If a Class
appears in this list, then instances of that class may be added
to this component from the Configuration Window.
- Specified by:
getAllowableConfigureComponents in interface Configurable