|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
megamek.client.ui.swing.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 javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| 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.swing.BoardView1.AttackSprite> |
attackSprites
|
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
|
protected BoardView1.RedrawWorker |
redrawWorker
|
(package private) float |
scale
|
(package private) TilesetManager |
tileManager
|
int |
zoomIndex
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| 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)
|
void |
addFlyOverPath(Entity e)
add a fly over path to the sprite list |
(package private) void |
addMovingUnit(Entity entity,
java.util.Vector<UnitLocation> movePath)
|
(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 |
clearAllAttacks()
Clears out all attacks that were being drawn |
void |
clearAllMoveVectors()
Clears out all movement vectors that were being drawn |
void |
clearC3Networks()
|
void |
clearFlyOverPaths()
|
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)
|
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()
|
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
java.awt.Dimension |
getPreferredSize()
|
(package private) java.awt.Image |
getScaledImage(java.awt.Image base)
Manages a cache of scaled images. |
int |
getScrollableBlockIncrement(java.awt.Rectangle arg0,
int arg1,
int arg2)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(java.awt.Rectangle arg0,
int arg1,
int arg2)
|
Coords |
getSelected()
|
TilesetManager |
getTilesetManager()
|
java.lang.String |
getToolTipText(java.awt.event.MouseEvent e)
The text to be displayed when the mouse is at a certain point TODO: just use a StringBuffer... |
void |
hideTooltip()
|
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 |
markDeploymentHexesFor(Entity ce)
Specifies that this should mark the deployment hexes for a player. |
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 |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
void |
paintComponent(java.awt.Graphics g)
Draw the screen! |
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()
refresh the IDisplayables |
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()
this should only be called once!! |
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 |
showPopup(java.lang.Object popup,
Coords c)
|
boolean |
toggleIsometric()
|
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 javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
| 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 |
|---|
public int zoomIndex
java.awt.Dimension hex_size
IGame game
java.util.ArrayList<megamek.client.ui.swing.BoardView1.AttackSprite> attackSprites
TilesetManager tileManager
java.awt.Polygon hexPoly
java.awt.Polygon[] facingPolys
java.awt.Polygon[] movementPolys
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 paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentpublic java.awt.Image getEntireBoardImage()
java.awt.Point getHexLocation(Coords c)
public void drawRuler(Coords s,
Coords e,
java.awt.Color sc,
java.awt.Color ec)
drawRuler in interface IBoardViewCoords getCoordsAt(java.awt.Point p)
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 addFlyOverPath(Entity e)
public 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 clearFlyOverPaths()
public void clearAllAttacks()
public void clearAllMoveVectors()
protected void firstLOSHex(Coords c)
protected void secondLOSHex(Coords c2,
Coords c1)
public void initPolys()
boolean doMoveUnits(long idleTime)
public 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 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 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 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.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle arg0,
int arg1,
int arg2)
getScrollableBlockIncrement in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
public int getScrollableUnitIncrement(java.awt.Rectangle arg0,
int arg1,
int arg2)
getScrollableUnitIncrement in interface javax.swing.Scrollablepublic java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic java.lang.String getToolTipText(java.awt.event.MouseEvent e)
getToolTipText in class javax.swing.JComponentpublic 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 void zoomIn()
zoomIn in interface IBoardViewpublic void zoomOut()
zoomOut in interface IBoardViewpublic void hideTooltip()
hideTooltip in interface IBoardViewjava.awt.Image getScaledImage(java.awt.Image base)
public boolean toggleIsometric()
toggleIsometric in interface IBoardView
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||