jfreerails.client.view
Class DialogueBoxController

java.lang.Object
  extended by jfreerails.client.view.DialogueBoxController
All Implemented Interfaces:
WorldListListener

public class DialogueBoxController
extends java.lang.Object
implements WorldListListener

This class is responsible for displaying dialogue boxes, adding borders to them as appropriate, and returning focus to the last focus owner after a dialogue box has been closed. It is also responsible for adding components that need to update in response to moves to the MoveChainFork. Currently dialogue boxes are not separate windows. Instead, they are drawn on the modal layer of the main JFrames LayerPlane. This allows dialogue boxes with transparent regions to be used.

Author:
lindsal8, smackay

Field Summary
private  HtmlJPanel about
           
private  javax.swing.JButton closeButton
           
private  javax.swing.Action closeCurrentDialogue
          Use this Action to close a dialogue without performing any other action.
private  java.awt.Component defaultFocusOwner
           
private  javax.swing.JInternalFrame dialogueJInternalFrame
           
private  javax.swing.JFrame frame
           
private  MyGlassPanel glassPanel
           
private  HtmlJPanel how2play
           
private  HtmlJPanel javaProperties
           
private static java.util.logging.Logger logger
           
private  ModelRootImpl modelRoot
           
private  NewsPaperJPanel newspaper
           
private  SelectEngineJPanel selectEngine
           
private  javax.swing.Action selectEngineAction
           
private  SelectWagonsJPanel selectWagons
           
private  javax.swing.Action selectWagonsAction
           
private  HtmlJPanel showControls
           
private  StationInfoJPanel stationInfo
           
private  TerrainInfoJPanel terrainInfo
           
private  java.awt.event.ActionListener trainDetailsButtonActionListener
           
private  TrainDialogueJPanel trainDialogueJPanel
           
private  RenderersRoot vl
           
private  ReadOnlyWorld world
           
 
Constructor Summary
DialogueBoxController(javax.swing.JFrame frame, ModelRootImpl mr)
           
 
Method Summary
 void closeContent()
           
 void itemAdded(KEY key, int index, FreerailsPrincipal principal)
           
 void itemRemoved(KEY key, int index, FreerailsPrincipal principal)
           
 void listUpdated(KEY key, int index, FreerailsPrincipal principal)
           
 void setDefaultFocusOwner(java.awt.Component defaultFocusOwner)
           
 void setup(ModelRootImpl mr, RenderersRoot vl)
          Called when a new game is started or a game is loaded.
 void showAbout()
           
 void showBalanceSheet()
           
 void showBrokerScreen()
           
 void showContent(javax.swing.JComponent component)
           
 void showExitDialog()
           
 void showGameControls()
           
 void showHow2Play()
           
 void showIncomeStatement()
           
 void showJavaProperties()
           
 void showLeaderBoard()
           
 void showNetworthGraph()
           
 void showReportBug()
           
 void showSaveGame()
           
 void showSelectEngine()
           
 void showSelectSavedGame2Load()
           
 void showSelectWagons()
           
 void showStationInfo(int stationNumber)
           
 void showStationOrTerrainInfo(int x, int y)
           
 void showTerrainInfo(int terrainType)
           
 void showTerrainInfo(int x, int y)
           
 void showTrainList()
           
 void showTrainOrders()
           
 void showTrainOrders(int trainId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

closeButton

private final javax.swing.JButton closeButton

selectEngine

private SelectEngineJPanel selectEngine

glassPanel

private final MyGlassPanel glassPanel

newspaper

private NewsPaperJPanel newspaper

selectWagons

private SelectWagonsJPanel selectWagons

showControls

private HtmlJPanel showControls

about

private HtmlJPanel about

how2play

private HtmlJPanel how2play

javaProperties

private HtmlJPanel javaProperties

terrainInfo

private TerrainInfoJPanel terrainInfo

stationInfo

private StationInfoJPanel stationInfo

trainDialogueJPanel

private TrainDialogueJPanel trainDialogueJPanel

world

private ReadOnlyWorld world

modelRoot

private ModelRootImpl modelRoot

vl

private RenderersRoot vl

defaultFocusOwner

private java.awt.Component defaultFocusOwner

frame

private final javax.swing.JFrame frame

dialogueJInternalFrame

private javax.swing.JInternalFrame dialogueJInternalFrame

closeCurrentDialogue

private final javax.swing.Action closeCurrentDialogue
Use this Action to close a dialogue without performing any other action.


selectEngineAction

private final javax.swing.Action selectEngineAction

trainDetailsButtonActionListener

private final java.awt.event.ActionListener trainDetailsButtonActionListener

selectWagonsAction

private final javax.swing.Action selectWagonsAction
Constructor Detail

DialogueBoxController

public DialogueBoxController(javax.swing.JFrame frame,
                             ModelRootImpl mr)
Method Detail

setup

public void setup(ModelRootImpl mr,
                  RenderersRoot vl)
Called when a new game is started or a game is loaded.

Be extremely careful with the references of objects allocated in this method to avoid memory leaks - see bug 967677 (OutOfMemoryError after starting several new games).


showSaveGame

public void showSaveGame()

showSelectSavedGame2Load

public void showSelectSavedGame2Load()

showTrainOrders

public void showTrainOrders()

showSelectEngine

public void showSelectEngine()

showGameControls

public void showGameControls()

showIncomeStatement

public void showIncomeStatement()

showBalanceSheet

public void showBalanceSheet()

showReportBug

public void showReportBug()

showBrokerScreen

public void showBrokerScreen()

showExitDialog

public void showExitDialog()

showAbout

public void showAbout()

showHow2Play

public void showHow2Play()

showJavaProperties

public void showJavaProperties()

showSelectWagons

public void showSelectWagons()

showTerrainInfo

public void showTerrainInfo(int terrainType)

showTerrainInfo

public void showTerrainInfo(int x,
                            int y)

showStationInfo

public void showStationInfo(int stationNumber)

showTrainOrders

public void showTrainOrders(int trainId)

showTrainList

public void showTrainList()

showNetworthGraph

public void showNetworthGraph()

showLeaderBoard

public void showLeaderBoard()

showContent

public void showContent(javax.swing.JComponent component)

closeContent

public void closeContent()

setDefaultFocusOwner

public void setDefaultFocusOwner(java.awt.Component defaultFocusOwner)

showStationOrTerrainInfo

public void showStationOrTerrainInfo(int x,
                                     int y)

listUpdated

public void listUpdated(KEY key,
                        int index,
                        FreerailsPrincipal principal)
Specified by:
listUpdated in interface WorldListListener

itemAdded

public void itemAdded(KEY key,
                      int index,
                      FreerailsPrincipal principal)
Specified by:
itemAdded in interface WorldListListener

itemRemoved

public void itemRemoved(KEY key,
                        int index,
                        FreerailsPrincipal principal)
Specified by:
itemRemoved in interface WorldListListener