Package net.sf.freecol.client.gui.panel
Class MapControls
- java.lang.Object
-
- net.sf.freecol.client.control.FreeColClientHolder
-
- net.sf.freecol.client.gui.panel.MapControls
-
- Direct Known Subclasses:
ClassicMapControls
,CornerMapControls
public abstract class MapControls extends FreeColClientHolder
A collection of panels and buttons that are used to provide the user with a more detailed view of certain elements on the map and also to provide a means of input in case the user can't use the keyboard.
-
-
Field Summary
Fields Modifier and Type Field Description static int
GAP
protected InfoPanel
infoPanel
The info panel, showing current active unit et al.private static java.util.logging.Logger
logger
static int
MINI_MAP_HEIGHT
static int
MINI_MAP_WIDTH
protected MiniMap
miniMap
The mini map, showing the whole of map context.protected UnitButton
miniMapToggleBorders
Special purpose buttons for the mini map.protected UnitButton
miniMapToggleFogOfWarButton
Special purpose buttons for the mini map.protected UnitButton
miniMapZoomInButton
Special purpose buttons for the mini map.protected UnitButton
miniMapZoomOutButton
Special purpose buttons for the mini map.protected java.util.List<UnitButton>
unitButtons
The buttons to control unit actions.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MapControls(FreeColClient freeColClient, boolean useSkin)
The basic constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canZoomInMapControls()
boolean
canZoomOutMapControls()
abstract java.util.List<java.awt.Component>
getComponentsPresent()
Prepare and return a list of map controls components to remove from the canvas.abstract java.util.List<java.awt.Component>
getComponentsToAdd(java.awt.Dimension size)
Prepare and return a list of map controls components to add to the canvas.protected boolean
initializeUnitButtons()
Initialize the unit buttons.static MapControls
newInstance(FreeColClient freeColClient)
Create a new map controls instance for a FreeColClient.void
repaint()
void
update(GUI.ViewMode viewMode, Unit active, Tile tile)
Updates thisMapControls
.void
updateLayoutIfNeeded()
Updates the layout with possibly a new skin and/or size.void
zoomIn()
void
zoomOut()
-
Methods inherited from class net.sf.freecol.client.control.FreeColClientHolder
askServer, currentPlayerIsMyPlayer, getClientOptions, getConnectController, getFreeColClient, getFreeColServer, getGame, getGUI, getMap, getMyPlayer, getSpecification, igc, pgc
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
MINI_MAP_WIDTH
public static final int MINI_MAP_WIDTH
- See Also:
- Constant Field Values
-
MINI_MAP_HEIGHT
public static final int MINI_MAP_HEIGHT
- See Also:
- Constant Field Values
-
GAP
public static final int GAP
- See Also:
- Constant Field Values
-
infoPanel
protected final InfoPanel infoPanel
The info panel, showing current active unit et al.
-
miniMap
protected final MiniMap miniMap
The mini map, showing the whole of map context.
-
miniMapToggleBorders
protected final UnitButton miniMapToggleBorders
Special purpose buttons for the mini map.
-
miniMapToggleFogOfWarButton
protected final UnitButton miniMapToggleFogOfWarButton
Special purpose buttons for the mini map.
-
miniMapZoomOutButton
protected final UnitButton miniMapZoomOutButton
Special purpose buttons for the mini map.
-
miniMapZoomInButton
protected final UnitButton miniMapZoomInButton
Special purpose buttons for the mini map.
-
unitButtons
protected final java.util.List<UnitButton> unitButtons
The buttons to control unit actions.
-
-
Constructor Detail
-
MapControls
protected MapControls(FreeColClient freeColClient, boolean useSkin)
The basic constructor.- Parameters:
freeColClient
- TheFreeColClient
for the game.useSkin
- Use a skin or not in the info panel.
-
-
Method Detail
-
updateLayoutIfNeeded
public void updateLayoutIfNeeded()
Updates the layout with possibly a new skin and/or size.
-
initializeUnitButtons
protected boolean initializeUnitButtons()
Initialize the unit buttons. Initialization is deferred until in-game and the action manager is available.- Returns:
- True if initialization occurs.
-
getComponentsToAdd
public abstract java.util.List<java.awt.Component> getComponentsToAdd(java.awt.Dimension size)
Prepare and return a list of map controls components to add to the canvas.- Parameters:
size
- TheDimension
of the canvas.- Returns:
- A list of
Component
s to add to the canvas.
-
getComponentsPresent
public abstract java.util.List<java.awt.Component> getComponentsPresent()
Prepare and return a list of map controls components to remove from the canvas.- Returns:
- A list of
Component
s to remove from the canvas.
-
canZoomInMapControls
public boolean canZoomInMapControls()
-
canZoomOutMapControls
public boolean canZoomOutMapControls()
-
repaint
public void repaint()
-
update
public void update(GUI.ViewMode viewMode, Unit active, Tile tile)
Updates thisMapControls
.- Parameters:
viewMode
- The guiViewMode
.active
- The activeUnit
if any.tile
- The selectedTile
if any.
-
zoomIn
public void zoomIn()
-
zoomOut
public void zoomOut()
-
newInstance
public static MapControls newInstance(FreeColClient freeColClient)
Create a new map controls instance for a FreeColClient.- Parameters:
freeColClient
- TheFreeColClient
to query.- Returns:
- A new
MapControls
or null on error.
-
-