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 intGAPprotected InfoPanelinfoPanelThe info panel, showing current active unit et al.private static java.util.logging.Loggerloggerstatic intMINI_MAP_HEIGHTstatic intMINI_MAP_WIDTHprotected MiniMapminiMapThe mini map, showing the whole of map context.protected UnitButtonminiMapToggleBordersSpecial purpose buttons for the mini map.protected UnitButtonminiMapToggleFogOfWarButtonSpecial purpose buttons for the mini map.protected UnitButtonminiMapZoomInButtonSpecial purpose buttons for the mini map.protected UnitButtonminiMapZoomOutButtonSpecial purpose buttons for the mini map.protected java.util.List<UnitButton>unitButtonsThe buttons to control unit actions.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapControls(FreeColClient freeColClient, boolean useSkin)The basic constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanZoomInMapControls()booleancanZoomOutMapControls()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 booleaninitializeUnitButtons()Initialize the unit buttons.static MapControlsnewInstance(FreeColClient freeColClient)Create a new map controls instance for a FreeColClient.voidrepaint()voidupdate(GUI.ViewMode viewMode, Unit active, Tile tile)Updates thisMapControls.voidupdateLayoutIfNeeded()Updates the layout with possibly a new skin and/or size.voidzoomIn()voidzoomOut()-
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- TheFreeColClientfor 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- TheDimensionof the canvas.- Returns:
- A list of
Components 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
Components 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 activeUnitif any.tile- The selectedTileif 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- TheFreeColClientto query.- Returns:
- A new
MapControlsor null on error.
-
-