Class AbstractBoardViewOverlay
java.lang.Object
megamek.client.ui.clientGUI.boardview.overlay.AbstractBoardViewOverlay
- All Implemented Interfaces:
IDisplayable,IPreferenceChangeListener
- Direct Known Subclasses:
KeyBindingsOverlay,PlanetaryConditionsOverlay,TurnDetailsOverlay
public abstract class AbstractBoardViewOverlay
extends Object
implements IDisplayable, IPreferenceChangeListener
This is a framework for boardview overlays that can show a list of data, conditions etc.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidOverride to return a List of all text lines to be shown.static StringcolorToHex(Color color) static StringcolorToHex(Color color, float brightnessMultiplier) voidDraw this IDisplayable to the Graphics graph, which is theBoardViewgraphics.protected voidprotected abstract intgetDistSide(Rectangle clipBounds, int overlayWidth) protected abstract intgetDistTop(Rectangle clipBounds, int overlayHeight) protected abstract StringOverride to return the localized header text, possibly including the current keyboard shortcut to toggle it.static Colorprotected abstract booleanbooleanReturn true while sliding.booleanvoidprotected voidMakes the BoardView redraw, updating the overlay in the process.protected voidsetDirty()voidsetVisible(boolean vis) Activates or deactivates the overlay, fading it in or out.booleanslide()Conducts a frame update when sliding.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.client.ui.IDisplayable
isBeingDragged, isDragged, isHit, isMouseOver, isReleased, setIdleTime
-
Field Details
-
clientGui
The ClientGUI of the boardview. May be null! -
GUIP
-
boardView
-
currentPhase
The current game phase. -
currentGame
-
font
-
-
Constructor Details
-
AbstractBoardViewOverlay
-
-
Method Details
-
addHeader
-
getHeaderText
Override to return the localized header text, possibly including the current keyboard shortcut to toggle it. -
draw
Description copied from interface:IDisplayableDraw this IDisplayable to the Graphics graph, which is theBoardViewgraphics. The currently visible part of theBoardViewis given by the Rectangle rect, so the upper left corner of the visibleBoardViewis rect.x, rect.y.- Specified by:
drawin interfaceIDisplayable
-
assembleTextLines
Override to return a List of all text lines to be shown. UseaddHeader(List). -
setVisible
public void setVisible(boolean vis) Activates or deactivates the overlay, fading it in or out. Also saves the visibility to the GUIPreferences so MegaMek remembers it. -
isVisible
public boolean isVisible() -
isSliding
public boolean isSliding()Description copied from interface:IDisplayableReturn true while sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. TheBoardViewwill repaint at some fps while an IDisplayable is sliding. The default for this method will always return false.- Specified by:
isSlidingin interfaceIDisplayable
-
slide
public boolean slide()Description copied from interface:IDisplayableConducts a frame update when sliding. "Sliding" means that this IDisplayable is in the process of opening, closing moving or fading. TheBoardViewwill repaint at some fps while an IDisplayable is sliding. Return true as long as the slide process is not finished. See ChatterBox2 and KeyBindingsOverlay for examples. The default for this method will always return false.- Specified by:
slidein interfaceIDisplayable
-
setDirty
protected void setDirty() -
gameTurnOrPhaseChange
protected void gameTurnOrPhaseChange() -
getTextColor
-
getVisibilityGUIPreference
protected abstract boolean getVisibilityGUIPreference() -
getDistTop
-
getDistSide
-
colorToHex
-
colorToHex
-
preferenceChange
- Specified by:
preferenceChangein interfaceIPreferenceChangeListener
-
scheduleBoardViewRepaint
protected void scheduleBoardViewRepaint()Makes the BoardView redraw, updating the overlay in the process.
-