game.interfaces
Class Coordinator

java.lang.Object
  |
  +--game.interfaces.Coordinator

public class Coordinator
extends java.lang.Object

A static class to facilitate communication between frames. This is a stopgap - this class holds all the stuff I moved out of specific GUI classes so that each gui needed to know about a single coordinating class, rather than talking to each other in a promiscuous fashion. Most of the material here will wind up in the controller package. Gary Thomas, 28/6/01.


Constructor Summary
Coordinator()
           
 
Method Summary
static void addCivilization(Civilization value)
          Add a new civilization.
static void addToDesktop(javax.swing.JInternalFrame frame)
          Add frame to window.
static void assignColors()
          Assign colours, after the player has picked one.
static void carryOutMovementOrders()
          Carry out orders.
 void carryOutOrders()
          Issue orders.
static void centerView(Square value)
          Set the selected square.
static void checkEndOfGame()
          Check whether game has ended, announce it and finish game.
static java.util.Iterator civilizationIterator()
          Iterator over all the civilizations.
static void closeEvents()
          Close all frames with Events in their title.
static Unit createUnit(java.lang.String archetypeName, Civilization civilization, Square square)
          Build a unit with its own task force.
static Unit createUnit(java.lang.String archetypeName, TaskForce taskForce)
          Build a unit and add it to the specified task force.
static void drawRoads(java.awt.Graphics2D g2, MovementList roads)
          Refresh the map to show the proposed road.
static void drawWalls(java.awt.Graphics2D g2, javax.swing.JComponent parent)
          Refresh the map to show the walls to be built.
static boolean findFrame(java.lang.String title)
          If the specified frame is present, bring it to the front.
static void fortification()
          Fortification button.
static Civilization getCivilization(java.lang.String value)
          Get a civilization given its name.
static ClashWindow getClashWindow()
          Return the main Clash window.
static javax.swing.JDesktopPane getDesktop()
          Return the main clash window desktop.
static javax.swing.AbstractAction getExitListener()
          Return the exit listener.
static java.awt.event.WindowListener getExitWindowListener()
          Return the exit window listener.
static java.lang.String getFortification()
           
static int getMapHeight()
          Get map height.
static int getMapWidth()
          Get map width.
static Square getSelectedSquare()
          Return the selected square.
static Square getSquare(int x, int y)
          Return a main map square from its coordinates.
static Square getSquare(java.lang.String name)
          Return a main map square from its name.
static Square getSquareAt(java.awt.event.MouseEvent event)
          Get the square at the spot determined by the mouse position.
static TaskForce getTaskForce()
          Get the selected task force.
static int getTileHeight()
          Return the tile width.
static int getTileWidth()
          Return the tile width.
static int getTurn()
          Return the current turn.
static Unit getUnit()
          Get the selected unit.
static void hideRuler()
          Switch off ruler frame.
static void issueMovementOrders()
          Issue orders for all civilizations.
 void issueOrders()
          Issue orders.
static java.util.Iterator listAvailableWalls(Civilization civ)
           
static void listBulletins()
          Construct a list of the bulletins.
static void listBySquares(TaskForceList commandList)
          Crete UnitsBySquare lists.
static void listEconOptions()
          Constructs the econ frame popup menu.
static void listEventOptions()
          Constructs the event frame popup menu.
static void listFrames()
          Construct a list of the open frames in the clash window.
static void listTechnologies()
           
static java.util.Iterator mapIterator()
          Return an iterator over the main map squares.
static void move()
          Move button.
static void newGame()
          Empty the static list for a new game.
static void nextTF()
          Select the next task force.
static void normal()
          Move button.
static void oneTurn()
          The end of the turn.
static void refreshDetailFrame(Square square)
          Refresh the details box.
static void refreshMap()
          Refresh the map to show the moves.
static void refreshMap(MovementList roads)
          Set the roads list into the map panel.
static void refreshMap(Order moves)
          Refresh the map to show the moves.
static void refreshMapOnly()
          Refresh the map to show the moves.
static void refreshTaskForceFrame(Square square)
          Refresh the task force box.
static void removeSquare(int x, int y)
          Remove a main map square from its coordinates.
static void resetLayout()
          Reset all the windows to the base setting.
static void road()
          Road button.
static java.lang.Object selectCivilization()
          Select a civilization.
static void setFortification(java.lang.String fort)
           
static void setFortificationButton(FortificationButton value)
          Set the move button (so it can have its label switched).
static void setFortificationCursor()
          Set the map panel cursor to the special cursor for fortification.
static void setMapPartialRepaint(boolean repaint)
          Sets partial repaint mode: If partial repaint is set, then only modified squares will be repainted.
static void setMoveButton(javax.swing.JButton value)
          Set the move button (so it can have its label switched).
static void setMoveCursor()
          Set the map panel cursor to the special cursor for movement.
static void setNormalCursor()
          Set the map panel cursor to the normal.
static void setPowerCircle(float value)
          Set the size of the power circle.
static void setRoadButton(javax.swing.JButton value)
          Set the move button (so it can have its label switched).
static void setRoadCursor()
          Set the map panel cursor to the special cursor for movement.
static void setSelectedSquare(Square value)
          Set the selected square.
static void showEconCivilizationFrame()
          Show the economics data for the player's civilization.
static void showEconCivilizationFrame(Civilization civ)
          Show the economics data for a given civilization.
static void showEconProvinceFrame()
          Show the economics data for a province.
static void showEconSquareFrame()
          Show the economics data for a map square.
static void showRuler()
          Show ruler details.
static void startUpEconInfoFrame(Economy econ)
          Start up the economy info frame for the given economy.
static java.util.Iterator technologyNames()
          Return an iterator over technlogy names.
static void viewEvents()
          Construct a list of the open frames in the clash window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Coordinator

public Coordinator()
Method Detail

getClashWindow

public static ClashWindow getClashWindow()
Return the main Clash window.

Returns:
the main Clash window.

getDesktop

public static javax.swing.JDesktopPane getDesktop()
Return the main clash window desktop.

Returns:
the main clash window desktop.

getSquare

public static Square getSquare(int x,
                               int y)
Return a main map square from its coordinates.

Parameters:
x - the x-coordinate.
y - the y-coordinate.
Returns:
a main map square from its coordinates.

getSquare

public static Square getSquare(java.lang.String name)
Return a main map square from its name.

Parameters:
name - the name of the square.
Returns:
a main map square from its name.

removeSquare

public static void removeSquare(int x,
                                int y)
Remove a main map square from its coordinates.

Parameters:
x - the x-coordinate.
y - the y-coordinate.

mapIterator

public static java.util.Iterator mapIterator()
Return an iterator over the main map squares.

Returns:
an iterator over the main map squares.

getMapWidth

public static int getMapWidth()
Get map width.


getMapHeight

public static int getMapHeight()
Get map height.


resetLayout

public static void resetLayout()
Reset all the windows to the base setting.


setSelectedSquare

public static void setSelectedSquare(Square value)
Set the selected square.

Parameters:
value - the selected square.

centerView

public static void centerView(Square value)
Set the selected square.

Parameters:
value - the selected square.

getSelectedSquare

public static Square getSelectedSquare()
Return the selected square.

Returns:
the selected square.

setMapPartialRepaint

public static void setMapPartialRepaint(boolean repaint)
Sets partial repaint mode: If partial repaint is set, then only modified squares will be repainted. This is useful when the map must be redrawn after a user interaction like square selection.


getSquareAt

public static Square getSquareAt(java.awt.event.MouseEvent event)
Get the square at the spot determined by the mouse position.

Parameters:
event - the mouse event which tells where the mouse is.
Returns:
the resulting map square.

refreshTaskForceFrame

public static void refreshTaskForceFrame(Square square)
Refresh the task force box.


refreshDetailFrame

public static void refreshDetailFrame(Square square)
Refresh the details box.


getTileWidth

public static int getTileWidth()
Return the tile width.

Returns:
the tile width.

getTileHeight

public static int getTileHeight()
Return the tile width.

Returns:
the tile width.

setPowerCircle

public static void setPowerCircle(float value)
Set the size of the power circle.


getExitWindowListener

public static java.awt.event.WindowListener getExitWindowListener()
Return the exit window listener.


getExitListener

public static javax.swing.AbstractAction getExitListener()
Return the exit listener.


getTurn

public static int getTurn()
Return the current turn.


showEconSquareFrame

public static void showEconSquareFrame()
Show the economics data for a map square.


showEconProvinceFrame

public static void showEconProvinceFrame()
Show the economics data for a province.


showEconCivilizationFrame

public static void showEconCivilizationFrame()
Show the economics data for the player's civilization.


showEconCivilizationFrame

public static void showEconCivilizationFrame(Civilization civ)
Show the economics data for a given civilization.


startUpEconInfoFrame

public static void startUpEconInfoFrame(Economy econ)
Start up the economy info frame for the given economy.

Parameters:
econ - economy to use.

listEconOptions

public static void listEconOptions()
Constructs the econ frame popup menu.


listEventOptions

public static void listEventOptions()
Constructs the event frame popup menu.


getTaskForce

public static TaskForce getTaskForce()
Get the selected task force.

Returns:
the seleced task force.

getUnit

public static Unit getUnit()
Get the selected unit.

Returns:
the seleced unit.

showRuler

public static void showRuler()
Show ruler details.


hideRuler

public static void hideRuler()
Switch off ruler frame.


oneTurn

public static void oneTurn()
The end of the turn.


nextTF

public static void nextTF()
Select the next task force.


listFrames

public static void listFrames()
Construct a list of the open frames in the clash window.


addToDesktop

public static void addToDesktop(javax.swing.JInternalFrame frame)
Add frame to window.


listBulletins

public static void listBulletins()
Construct a list of the bulletins.


viewEvents

public static void viewEvents()
Construct a list of the open frames in the clash window.


findFrame

public static boolean findFrame(java.lang.String title)
If the specified frame is present, bring it to the front.

Parameters:
title - the title of the required frame.
Returns:
false if the frame is not present.

closeEvents

public static void closeEvents()
Close all frames with Events in their title.


setMoveButton

public static void setMoveButton(javax.swing.JButton value)
Set the move button (so it can have its label switched).

Parameters:
value - the move button from Start.

setMoveCursor

public static void setMoveCursor()
Set the map panel cursor to the special cursor for movement.


setNormalCursor

public static void setNormalCursor()
Set the map panel cursor to the normal.


move

public static void move()
Move button.


refreshMap

public static void refreshMap()
Refresh the map to show the moves.


refreshMapOnly

public static void refreshMapOnly()
Refresh the map to show the moves.


refreshMap

public static void refreshMap(Order moves)
Refresh the map to show the moves.

Parameters:
moves - an order to show on the map.

createUnit

public static Unit createUnit(java.lang.String archetypeName,
                              Civilization civilization,
                              Square square)
Build a unit with its own task force.

Parameters:
civilization - the civilization for the unit.
square - the square to placve the unit in.
Returns:
a new unit.

createUnit

public static Unit createUnit(java.lang.String archetypeName,
                              TaskForce taskForce)
Build a unit and add it to the specified task force.

Parameters:
taskForce - the task force to add the unit to.
Returns:
a new unit.

issueOrders

public void issueOrders()
Issue orders.


carryOutOrders

public void carryOutOrders()
Issue orders.


setRoadButton

public static void setRoadButton(javax.swing.JButton value)
Set the move button (so it can have its label switched).

Parameters:
value - the road button from Start.

setRoadCursor

public static void setRoadCursor()
Set the map panel cursor to the special cursor for movement.


road

public static void road()
Road button.


drawRoads

public static void drawRoads(java.awt.Graphics2D g2,
                             MovementList roads)
Refresh the map to show the proposed road.


drawWalls

public static void drawWalls(java.awt.Graphics2D g2,
                             javax.swing.JComponent parent)
Refresh the map to show the walls to be built.

Parameters:
parent - The component in which walls must be drawn

refreshMap

public static void refreshMap(MovementList roads)
Set the roads list into the map panel.


setFortificationButton

public static void setFortificationButton(FortificationButton value)
Set the move button (so it can have its label switched).

Parameters:
value - the road button from Start.

setFortificationCursor

public static void setFortificationCursor()
Set the map panel cursor to the special cursor for fortification.


fortification

public static void fortification()
Fortification button.


setFortification

public static void setFortification(java.lang.String fort)

getFortification

public static java.lang.String getFortification()

listAvailableWalls

public static java.util.Iterator listAvailableWalls(Civilization civ)

normal

public static void normal()
Move button.


technologyNames

public static java.util.Iterator technologyNames()
Return an iterator over technlogy names.

Returns:
an iterator over technlogy names.

listTechnologies

public static void listTechnologies()

civilizationIterator

public static java.util.Iterator civilizationIterator()
Iterator over all the civilizations.

Returns:
an iterator over all the cvilizations.

getCivilization

public static Civilization getCivilization(java.lang.String value)
Get a civilization given its name.

Parameters:
value - the name of a civilization.
Returns:
the cvilization matching the name, null if none fits.

issueMovementOrders

public static void issueMovementOrders()
Issue orders for all civilizations.


carryOutMovementOrders

public static void carryOutMovementOrders()
Carry out orders.


checkEndOfGame

public static void checkEndOfGame()
Check whether game has ended, announce it and finish game.


listBySquares

public static void listBySquares(TaskForceList commandList)
Crete UnitsBySquare lists.

Parameters:
commandList - the list to add all the task forces to.

selectCivilization

public static java.lang.Object selectCivilization()
Select a civilization.


addCivilization

public static void addCivilization(Civilization value)
Add a new civilization.


newGame

public static void newGame()
Empty the static list for a new game.


assignColors

public static void assignColors()
Assign colours, after the player has picked one.