|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Canvas
megamek.client.ui.AWT.BoardView1
public class BoardView1
Displays the board; lets the user scroll around and select points on it.
| Nested Class Summary | |
|---|---|
protected class |
BoardView1.RedrawWorker
the old redrawworker converted to a runnable which is called now and then from the event thread |
(package private) class |
BoardView1.Sprite
Everything in the main map view is either the board or it's a sprite displayed on top of the board. |
| Nested classes/interfaces inherited from class java.awt.Canvas |
|---|
java.awt.Canvas.AccessibleAWTCanvas |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
(package private) java.util.ArrayList<megamek.client.ui.AWT.BoardView1.AttackSprite> |
attackSprites
|
(package private) java.awt.Dimension |
backSize
|
protected java.util.ArrayList<BoardViewListener> |
boardListeners
|
(package private) java.util.ArrayList<IDisplayable> |
displayables
|
(package private) java.awt.Polygon[] |
facingPolys
|
(package private) IGame |
game
|
(package private) java.awt.Dimension |
hex_size
|
(package private) java.awt.Polygon |
hexPoly
|
(package private) java.awt.Polygon[] |
movementPolys
|
(package private) java.awt.Point |
offset
|
protected BoardView1.RedrawWorker |
redrawWorker
|
(package private) float |
scale
|
(package private) TilesetManager |
tileManager
|
(package private) java.awt.Rectangle |
view
|
int |
zoomIndex
|
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
BoardView1(IGame game)
Construct a new board view for the specified game |
|
| Method Summary | |
|---|---|
void |
addAttack(AttackAction aa)
Adds an attack to the sprite list. |
void |
addBoardViewListener(BoardViewListener listener)
Adds the specified board listener to receive board events from this board. |
void |
addC3Link(Entity e)
Adds a c3 line to the sprite list. |
void |
addDisplayable(IDisplayable disp)
|
(package private) void |
addMovingUnit(Entity entity,
java.util.Vector<UnitLocation> movePath)
|
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
Update ourself when a scroll bar is adjusted. |
(package private) void |
boardChanged()
|
void |
boardChangedAllHexes(BoardEvent b)
Sent when all hexes on the board changed |
void |
boardChangedHex(BoardEvent b)
Sent when Hex on the Board changed |
void |
boardNewBoard(BoardEvent b)
Sent when Board completely changed |
void |
centerOnHex(Coords c)
|
void |
checkLOS(Coords c)
|
void |
checkScrollBounds()
Makes sure that the scroll dimensions stay in bounds |
(package private) void |
checkTooltip()
Checks if the mouse has been idling for a while and if so, shows the tooltip window |
void |
clearAllAttacks()
Clears out all attacks that were being drawn |
void |
clearAllMoveVectors()
Clears out all movement vectors that were being drawn |
void |
clearC3Networks()
|
void |
clearMovementData()
Clears current movement data from the screen |
(package private) void |
clearSprites()
|
void |
cursor(Coords coords)
Determines if this Board contains the Coords, and if so, "cursors" that Coords. |
void |
cursor(int x,
int y)
"Cursors" the specified Coords. |
(package private) boolean |
doMoveUnits(long idleTime)
|
boolean |
doScroll()
If the mouse is at the edges of the screen, this scrolls the board image on the canvas. |
void |
drawMovementData(Entity entity,
MovePath md)
Clears the old movement data and draws the new. |
void |
drawRuler(Coords s,
Coords e,
java.awt.Color sc,
java.awt.Color ec)
|
protected void |
firstLOSHex(Coords c)
|
java.awt.Component |
getComponent()
|
(package private) Coords |
getCoordsAt(java.awt.Point p)
Returns the coords at the specified point |
java.awt.Image |
getEntireBoardImage()
This method creates an image the size of the entire board (all mapsheets), draws the hexes onto it, and returns that image. |
Coords |
getFirstLOS()
|
(package private) java.awt.Point |
getHexLocation(Coords c)
|
Coords |
getHighlighted()
|
Coords |
getLastCursor()
|
Player |
getLocalPlayer()
|
(package private) java.awt.Image |
getScaledImage(java.awt.Image base)
Manages a cache of scaled images. |
Coords |
getSelected()
|
TilesetManager |
getTilesetManager()
|
int |
getZoomIndex()
|
void |
hideTooltip()
Hides the tooltip thinger |
void |
highlight(Coords coords)
Determines if this Board contains the Coords, and if so, highlights that Coords. |
void |
highlight(int x,
int y)
Highlights the specified Coords. |
void |
initPolys()
Initializes the various overlay polygons with their vertices. |
boolean |
isMovingUnits()
|
boolean |
isTileImagesLoaded()
Determine if the tile manager's images have been loaded. |
void |
keyPressed(java.awt.event.KeyEvent ke)
|
void |
keyReleased(java.awt.event.KeyEvent ke)
|
void |
keyTyped(java.awt.event.KeyEvent ke)
|
void |
markDeploymentHexesFor(Entity ce)
Specifies that this should mark the deployment hexes for a player. |
boolean |
mayDrawPopup()
Return, whether a popup may be drawn, this currently means, whether no scrolling took place. |
void |
mouseAction(Coords coords,
int mtype,
int modifiers)
Notifies listeners about the specified mouse action. |
void |
mouseAction(int x,
int y,
int mtype,
int modifiers)
Determines if this Board contains the (x, y) Coords, and if so, notifies listeners about the specified mouse action. |
void |
mouseClicked(java.awt.event.MouseEvent me)
|
void |
mouseDragged(java.awt.event.MouseEvent me)
|
void |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mouseMoved(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
void |
paint(java.awt.Graphics g)
|
void |
preferenceChange(PreferenceChangeEvent e)
|
void |
processBoardViewEvent(BoardViewEvent event)
Notifies attached board listeners of the event. |
(package private) void |
redrawAllEntities()
Clears all old entity sprites out of memory and sets up new ones. |
void |
redrawEntity(Entity entity)
Clears the sprite for an entity and prepares it to be re-drawn. |
void |
redrawMovingEntity(Entity entity,
Coords position,
int facing)
|
void |
refreshAttacks()
Clears out all attacks and re-adds the ones in the current game. |
void |
refreshDisplayables()
|
void |
refreshMinefields()
|
void |
refreshMoveVectors()
|
void |
refreshMoveVectors(Entity en,
MovePath md,
java.awt.Color col)
|
void |
removeAttacksFor(Entity e)
Removes all attack sprites from a certain entity |
void |
removeBoardViewListener(BoardViewListener listener)
Removes the specified board listener. |
void |
removeDisplayable(IDisplayable disp)
|
protected void |
scheduleRedraw()
|
protected void |
scheduleRedrawTimer()
|
protected void |
secondLOSHex(Coords c2,
Coords c1)
|
void |
select(Coords coords)
Determines if this Board contains the Coords, and if so, "selects" that Coords. |
void |
select(int x,
int y)
"Selects" the specified Coords. |
void |
setFirstLOS(Coords firstLOS)
|
void |
setHighlighted(Coords highlighted)
|
void |
setLastCursor(Coords lastCursor)
|
void |
setLocalPlayer(Player p)
|
void |
setSelected(Coords selected)
|
void |
setUseLOSTool(boolean use)
|
void |
setZoomIndex(int zoomIndex)
zoomIndex is a reference to a static array of scale factors. |
void |
showPopup(java.lang.Object popup,
Coords c)
|
protected void |
stopScrolling()
|
boolean |
toggleIsometric()
|
void |
update(java.awt.Graphics g)
Draw the screen! |
protected void |
updateBoard()
|
void |
updateEcmList()
|
void |
WeaponSelected(MechDisplayEvent b)
Sent when user selects a weapon in the weapon panel. |
void |
zoomIn()
Increases zoomIndex and refreshes the map. |
void |
zoomOut()
Decreases zoomIndex and refreshes the map. |
| Methods inherited from class java.awt.Canvas |
|---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface megamek.client.ui.IBoardView |
|---|
addKeyListener |
| Field Detail |
|---|
java.awt.Dimension hex_size
IGame game
java.awt.Rectangle view
java.awt.Point offset
java.awt.Dimension backSize
java.util.ArrayList<megamek.client.ui.AWT.BoardView1.AttackSprite> attackSprites
TilesetManager tileManager
java.awt.Polygon hexPoly
java.awt.Polygon[] facingPolys
java.awt.Polygon[] movementPolys
public int zoomIndex
float scale
java.util.ArrayList<IDisplayable> displayables
protected transient java.util.ArrayList<BoardViewListener> boardListeners
protected final BoardView1.RedrawWorker redrawWorker
| Constructor Detail |
|---|
public BoardView1(IGame game)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
protected void scheduleRedrawTimer()
protected void scheduleRedraw()
public void preferenceChange(PreferenceChangeEvent e)
preferenceChange in interface IPreferenceChangeListenerpublic void addBoardViewListener(BoardViewListener listener)
addBoardViewListener in interface IBoardViewlistener - the board listener.BoardViewListenerpublic void removeBoardViewListener(BoardViewListener listener)
removeBoardViewListener in interface IBoardViewlistener - the board listener.public void processBoardViewEvent(BoardViewEvent event)
processBoardViewEvent in interface IBoardViewevent - the board event.
void addMovingUnit(Entity entity,
java.util.Vector<UnitLocation> movePath)
public void addDisplayable(IDisplayable disp)
addDisplayable in interface IBoardViewpublic void removeDisplayable(IDisplayable disp)
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
adjustmentValueChanged in interface java.awt.event.AdjustmentListenerevent - - the AdjustmentEvent that caused this call.public void paint(java.awt.Graphics g)
paint in class java.awt.Canvaspublic void update(java.awt.Graphics g)
update in class java.awt.Canvasjava.awt.Image getScaledImage(java.awt.Image base)
public java.awt.Image getEntireBoardImage()
java.awt.Point getHexLocation(Coords c)
Coords getCoordsAt(java.awt.Point p)
public void hideTooltip()
hideTooltip in interface IBoardViewvoid checkTooltip()
public void redrawMovingEntity(Entity entity,
Coords position,
int facing)
public boolean isMovingUnits()
isMovingUnits in interface IBoardViewpublic void redrawEntity(Entity entity)
redrawEntity in interface IBoardViewvoid redrawAllEntities()
public void centerOnHex(Coords c)
centerOnHex in interface IBoardView
public void drawMovementData(Entity entity,
MovePath md)
drawMovementData in interface IBoardViewpublic void clearMovementData()
clearMovementData in interface IBoardViewpublic void setLocalPlayer(Player p)
setLocalPlayer in interface IBoardViewpublic Player getLocalPlayer()
getLocalPlayer in interface IBoardViewpublic void markDeploymentHexesFor(Entity ce)
markDeploymentHexesFor in interface IBoardViewpublic void addC3Link(Entity e)
public void addAttack(AttackAction aa)
addAttack in interface IBoardViewpublic void removeAttacksFor(Entity e)
removeAttacksFor in interface IBoardViewpublic void refreshAttacks()
refreshAttacks in interface IBoardViewpublic void refreshMoveVectors()
public void refreshMoveVectors(Entity en,
MovePath md,
java.awt.Color col)
public void clearC3Networks()
public void clearAllAttacks()
public void clearAllMoveVectors()
protected void firstLOSHex(Coords c)
protected void secondLOSHex(Coords c2,
Coords c1)
public boolean doScroll()
public void checkScrollBounds()
protected void stopScrolling()
public void initPolys()
boolean doMoveUnits(long idleTime)
public void keyPressed(java.awt.event.KeyEvent ke)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent ke)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent ke)
keyTyped in interface java.awt.event.KeyListenerpublic void mousePressed(java.awt.event.MouseEvent me)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent me)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent me)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void zoomIn()
zoomIn in interface IBoardViewpublic void zoomOut()
zoomOut in interface IBoardViewpublic void setZoomIndex(int zoomIndex)
zoomIndex - public int getZoomIndex()
public boolean isTileImagesLoaded()
true if all images have been loaded.
false if more need to be loaded.public void setUseLOSTool(boolean use)
public TilesetManager getTilesetManager()
getTilesetManager in interface IBoardView
public void drawRuler(Coords s,
Coords e,
java.awt.Color sc,
java.awt.Color ec)
drawRuler in interface IBoardViewpublic void setLastCursor(Coords lastCursor)
lastCursor - The lastCursor to set.public Coords getLastCursor()
getLastCursor in interface IBoardViewpublic void setHighlighted(Coords highlighted)
highlighted - The highlighted to set.public Coords getHighlighted()
public void setSelected(Coords selected)
selected - The selected to set.public Coords getSelected()
getSelected in interface IBoardViewpublic void setFirstLOS(Coords firstLOS)
setFirstLOS in interface IBoardViewfirstLOS - The firstLOS to set.public Coords getFirstLOS()
public void select(Coords coords)
select in interface IBoardViewcoords - the Coords.
public void select(int x,
int y)
x - the x coordinate.y - the y coordinate.public void highlight(Coords coords)
highlight in interface IBoardViewcoords - the Coords.
public void highlight(int x,
int y)
x - the x coordinate.y - the y coordinate.public void cursor(Coords coords)
cursor in interface IBoardViewcoords - the Coords.
public void cursor(int x,
int y)
x - the x coordinate.y - the y coordinate.public void checkLOS(Coords c)
checkLOS in interface IBoardView
public void mouseAction(int x,
int y,
int mtype,
int modifiers)
public void mouseAction(Coords coords,
int mtype,
int modifiers)
coords - the Coords.public boolean mayDrawPopup()
public void boardNewBoard(BoardEvent b)
BoardListener
boardNewBoard in interface BoardListenerb - an event containing information about the changepublic void boardChangedHex(BoardEvent b)
BoardListener
boardChangedHex in interface BoardListenerb - an event containing information about the changepublic void boardChangedAllHexes(BoardEvent b)
BoardListener
boardChangedAllHexes in interface BoardListenerb - an event containing information about the changevoid boardChanged()
void clearSprites()
protected void updateBoard()
public void WeaponSelected(MechDisplayEvent b)
MechDisplayListener
WeaponSelected in interface MechDisplayListenerb - an eventpublic void updateEcmList()
public java.awt.Component getComponent()
getComponent in interface IBoardViewpublic void refreshDisplayables()
refreshDisplayables in interface IBoardView
public void showPopup(java.lang.Object popup,
Coords c)
showPopup in interface IBoardViewpublic void refreshMinefields()
refreshMinefields in interface IBoardViewpublic boolean toggleIsometric()
toggleIsometric in interface IBoardView
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||