rails.ui.swing
Class GameStatus

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by rails.ui.swing.GridPanel
                      extended by rails.ui.swing.GameStatus
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
GameStatus_18EU

public class GameStatus
extends GridPanel
implements java.awt.event.ActionListener

This class is incorporated into StatusWindow and displays the bulk of rails.game status information.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class rails.ui.swing.GridPanel
GridPanel.RowVisibility
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int actorIndex
           
protected  Bank bank
           
protected  Field bankCash
           
protected  int bankCashXOffset
           
protected  int bankCashYOffset
           
protected static java.lang.String BUY_FROM_IPO_CMD
           
protected static java.lang.String BUY_FROM_POOL_CMD
           
protected  javax.swing.ButtonGroup buySellGroup
           
protected static java.lang.String CASH_CORRECT_CMD
           
protected  Field[] certInIPO
           
protected  ClickField[] certInIPOButton
           
protected  int certInIPOXOffset
           
protected  int certInIPOYOffset
           
protected  Field[] certInPool
           
protected  ClickField[] certInPoolButton
           
protected  int certInPoolXOffset
           
protected  int certInPoolYOffset
           
protected  Field[] certInTreasury
           
protected  ClickField[] certInTreasuryButton
           
protected  int certInTreasuryXOffset
           
protected  int certInTreasuryYOffset
           
protected  int certLimitXOffset
           
protected  int certLimitYOffset
           
protected  Field[][] certPerPlayer
           
protected  ClickField[][] certPerPlayerButton
           
protected  int certPerPlayerXOffset
           
protected  int certPerPlayerYOffset
           
protected  java.util.Map<PublicCompanyI,java.lang.Integer> companyIndex
           
protected  boolean compCanBuyPrivates
           
protected  boolean compCanHoldForeignShares
           
protected  boolean compCanHoldOwnShares
           
protected  Field[] compCash
           
protected  ClickField[] compCashButton
           
protected  int compCashXOffset
           
protected  int compCashYOffset
           
protected  Field[] compLoans
           
protected  int compLoansXOffset
           
protected  int compLoansYOffset
           
protected  Field[] compPrivates
           
protected  int compPrivatesXOffset
           
protected  int compPrivatesYOffset
           
protected  Field[] compRevenue
           
protected  int compRevenueXOffset
           
protected  int compRevenueYOffset
           
protected  Field[] compTokens
           
protected  int compTokensXOffset
           
protected  int compTokensYOffset
           
protected  Field[] compTrains
           
protected  int compTrainsXOffset
           
protected  int compTrainsYOffset
           
protected  Field[] currPrice
           
protected  int currPriceXOffset
           
protected  int currPriceYOffset
           
protected  ClickField dummyButton
           
protected  Field futureTrains
           
protected  int futureTrainsWidth
           
protected  int futureTrainsXOffset
           
protected  int futureTrainsYOffset
           
protected  GameUIManager gameUIManager
           
protected  boolean hasCompanyLoans
           
protected  boolean hasParPrices
           
protected  Portfolio ipo
           
protected static org.apache.log4j.Logger log
           
protected  Caption[] lowerPlayerCaption
           
protected  Field newTrains
           
protected  int newTrainsXOffset
           
protected  int newTrainsYOffset
           
protected  StatusWindow parent
           
protected  Field[] parPrice
           
protected  int parPriceXOffset
           
protected  int parPriceYOffset
           
protected  Field[] playerCash
           
protected  ClickField[] playerCashButton
           
protected  int playerCashXOffset
           
protected  int playerCashYOffset
           
protected  Field[] playerCertCount
           
protected  int playerCertCountXOffset
           
protected  int playerCertCountYOffset
           
protected  java.util.Map<Player,java.lang.Integer> playerIndex
           
protected  Field[] playerORWorthIncrease
           
protected  int playerORWorthIncreaseXOffset
           
protected  int playerORWorthIncreaseYOffset
           
protected  Field[] playerPrivates
           
protected  int playerPrivatesXOffset
           
protected  int playerPrivatesYOffset
           
protected  Field[] playerWorth
           
protected  int playerWorthXOffset
           
protected  int playerWorthYOffset
           
protected  Portfolio pool
           
protected  Field poolTrains
           
protected  int poolTrainsXOffset
           
protected  int poolTrainsYOffset
           
protected  PossibleActions possibleActions
           
protected  int rightCompCaptionXOffset
           
protected static java.lang.String SELL_CMD
           
protected  Caption treasurySharesCaption
           
protected  Caption[] upperPlayerCaption
           
 
Fields inherited from class rails.ui.swing.GridPanel
buttonHighlight, c, companies, f, fields, gb, gbc, gridPanel, menuItemsToReset, NARROW_GAP, nc, np, observers, parentFrame, players, round, rowVisibilityObservers, WIDE_BOTTOM, WIDE_GAP, WIDE_LEFT, WIDE_RIGHT, WIDE_TOP
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GameStatus()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actor)
           
 java.lang.String getSRPlayer()
           
 void highlightCurrentPlayer(int index)
           
 void highlightLocalPlayer(int index)
           
 void init(StatusWindow parent, GameUIManager gameUIManager)
           
 boolean initCashCorrectionActions()
          Initializes the CashCorrectionActions
protected  void initGameSpecificActions()
          Stub, can be overridden by game-specific subclasses
 void initTurn(int actorIndex, boolean myTurn)
           
protected  PossibleAction processGameSpecificActions(java.awt.event.ActionEvent actor, PossibleAction chosenAction)
          Stub allowing game-specific extensions
protected  PossibleAction processGameSpecificFollowUpActions(java.awt.event.ActionEvent actor, PossibleAction chosenAction)
           
protected  void setCompanyCashButton(int i, boolean clickable, PossibleAction action)
           
protected  void setIPOCertButton(int i, boolean clickable)
           
protected  void setIPOCertButton(int i, boolean clickable, java.lang.Object o)
           
protected  void setPlayerCashButton(int i, boolean clickable, PossibleAction action)
           
protected  void setPlayerCertButton(int i, int j, boolean clickable)
           
protected  void setPlayerCertButton(int i, int j, boolean clickable, java.lang.Object o)
           
protected  void setPoolCertButton(int i, boolean clickable)
           
protected  void setPoolCertButton(int i, boolean clickable, java.lang.Object o)
           
 void setPriorityPlayer(int index)
           
protected  void setTreasuryCertButton(int i, boolean clickable)
           
protected  void setTreasuryCertButton(int i, boolean clickable, java.lang.Object o)
           
 
Methods inherited from class rails.ui.swing.GridPanel
addField, addField, deRegisterObservers, keyPressed, keyReleased, keyTyped, redisplay, setRowVisibility
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUY_FROM_IPO_CMD

protected static final java.lang.String BUY_FROM_IPO_CMD
See Also:
Constant Field Values

BUY_FROM_POOL_CMD

protected static final java.lang.String BUY_FROM_POOL_CMD
See Also:
Constant Field Values

SELL_CMD

protected static final java.lang.String SELL_CMD
See Also:
Constant Field Values

CASH_CORRECT_CMD

protected static final java.lang.String CASH_CORRECT_CMD
See Also:
Constant Field Values

parent

protected StatusWindow parent

certPerPlayer

protected Field[][] certPerPlayer

certPerPlayerButton

protected ClickField[][] certPerPlayerButton

certPerPlayerXOffset

protected int certPerPlayerXOffset

certPerPlayerYOffset

protected int certPerPlayerYOffset

certInIPO

protected Field[] certInIPO

certInIPOButton

protected ClickField[] certInIPOButton

certInIPOXOffset

protected int certInIPOXOffset

certInIPOYOffset

protected int certInIPOYOffset

certInPool

protected Field[] certInPool

certInPoolButton

protected ClickField[] certInPoolButton

certInPoolXOffset

protected int certInPoolXOffset

certInPoolYOffset

protected int certInPoolYOffset

certInTreasury

protected Field[] certInTreasury

certInTreasuryButton

protected ClickField[] certInTreasuryButton

certInTreasuryXOffset

protected int certInTreasuryXOffset

certInTreasuryYOffset

protected int certInTreasuryYOffset

parPrice

protected Field[] parPrice

parPriceXOffset

protected int parPriceXOffset

parPriceYOffset

protected int parPriceYOffset

currPrice

protected Field[] currPrice

currPriceXOffset

protected int currPriceXOffset

currPriceYOffset

protected int currPriceYOffset

compCash

protected Field[] compCash

compCashButton

protected ClickField[] compCashButton

compCashXOffset

protected int compCashXOffset

compCashYOffset

protected int compCashYOffset

compRevenue

protected Field[] compRevenue

compRevenueXOffset

protected int compRevenueXOffset

compRevenueYOffset

protected int compRevenueYOffset

compTrains

protected Field[] compTrains

compTrainsXOffset

protected int compTrainsXOffset

compTrainsYOffset

protected int compTrainsYOffset

compTokens

protected Field[] compTokens

compTokensXOffset

protected int compTokensXOffset

compTokensYOffset

protected int compTokensYOffset

compPrivates

protected Field[] compPrivates

compPrivatesXOffset

protected int compPrivatesXOffset

compPrivatesYOffset

protected int compPrivatesYOffset

compLoans

protected Field[] compLoans

compLoansXOffset

protected int compLoansXOffset

compLoansYOffset

protected int compLoansYOffset

playerCash

protected Field[] playerCash

playerCashButton

protected ClickField[] playerCashButton

playerCashXOffset

protected int playerCashXOffset

playerCashYOffset

protected int playerCashYOffset

playerPrivates

protected Field[] playerPrivates

playerPrivatesXOffset

protected int playerPrivatesXOffset

playerPrivatesYOffset

protected int playerPrivatesYOffset

playerWorth

protected Field[] playerWorth

playerWorthXOffset

protected int playerWorthXOffset

playerWorthYOffset

protected int playerWorthYOffset

playerORWorthIncrease

protected Field[] playerORWorthIncrease

playerORWorthIncreaseXOffset

protected int playerORWorthIncreaseXOffset

playerORWorthIncreaseYOffset

protected int playerORWorthIncreaseYOffset

playerCertCount

protected Field[] playerCertCount

playerCertCountXOffset

protected int playerCertCountXOffset

playerCertCountYOffset

protected int playerCertCountYOffset

certLimitXOffset

protected int certLimitXOffset

certLimitYOffset

protected int certLimitYOffset

bankCash

protected Field bankCash

bankCashXOffset

protected int bankCashXOffset

bankCashYOffset

protected int bankCashYOffset

poolTrains

protected Field poolTrains

poolTrainsXOffset

protected int poolTrainsXOffset

poolTrainsYOffset

protected int poolTrainsYOffset

newTrains

protected Field newTrains

newTrainsXOffset

protected int newTrainsXOffset

newTrainsYOffset

protected int newTrainsYOffset

futureTrains

protected Field futureTrains

futureTrainsXOffset

protected int futureTrainsXOffset

futureTrainsYOffset

protected int futureTrainsYOffset

futureTrainsWidth

protected int futureTrainsWidth

rightCompCaptionXOffset

protected int rightCompCaptionXOffset

upperPlayerCaption

protected Caption[] upperPlayerCaption

lowerPlayerCaption

protected Caption[] lowerPlayerCaption

treasurySharesCaption

protected Caption treasurySharesCaption

ipo

protected Portfolio ipo

pool

protected Portfolio pool

gameUIManager

protected GameUIManager gameUIManager

bank

protected Bank bank

possibleActions

protected PossibleActions possibleActions

hasParPrices

protected boolean hasParPrices

compCanBuyPrivates

protected boolean compCanBuyPrivates

compCanHoldOwnShares

protected boolean compCanHoldOwnShares

compCanHoldForeignShares

protected boolean compCanHoldForeignShares

hasCompanyLoans

protected boolean hasCompanyLoans

actorIndex

protected int actorIndex

buySellGroup

protected javax.swing.ButtonGroup buySellGroup

dummyButton

protected ClickField dummyButton

companyIndex

protected java.util.Map<PublicCompanyI,java.lang.Integer> companyIndex

playerIndex

protected java.util.Map<Player,java.lang.Integer> playerIndex

log

protected static org.apache.log4j.Logger log
Constructor Detail

GameStatus

public GameStatus()
Method Detail

init

public void init(StatusWindow parent,
                 GameUIManager gameUIManager)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actor)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

processGameSpecificActions

protected PossibleAction processGameSpecificActions(java.awt.event.ActionEvent actor,
                                                    PossibleAction chosenAction)
Stub allowing game-specific extensions


processGameSpecificFollowUpActions

protected PossibleAction processGameSpecificFollowUpActions(java.awt.event.ActionEvent actor,
                                                            PossibleAction chosenAction)

initTurn

public void initTurn(int actorIndex,
                     boolean myTurn)

initGameSpecificActions

protected void initGameSpecificActions()
Stub, can be overridden by game-specific subclasses


initCashCorrectionActions

public boolean initCashCorrectionActions()
Initializes the CashCorrectionActions


setPriorityPlayer

public void setPriorityPlayer(int index)

highlightCurrentPlayer

public void highlightCurrentPlayer(int index)

highlightLocalPlayer

public void highlightLocalPlayer(int index)

getSRPlayer

public java.lang.String getSRPlayer()

setPlayerCertButton

protected void setPlayerCertButton(int i,
                                   int j,
                                   boolean clickable,
                                   java.lang.Object o)

setPlayerCertButton

protected void setPlayerCertButton(int i,
                                   int j,
                                   boolean clickable)

setIPOCertButton

protected void setIPOCertButton(int i,
                                boolean clickable,
                                java.lang.Object o)

setIPOCertButton

protected void setIPOCertButton(int i,
                                boolean clickable)

setPoolCertButton

protected void setPoolCertButton(int i,
                                 boolean clickable,
                                 java.lang.Object o)

setPoolCertButton

protected void setPoolCertButton(int i,
                                 boolean clickable)

setTreasuryCertButton

protected void setTreasuryCertButton(int i,
                                     boolean clickable,
                                     java.lang.Object o)

setTreasuryCertButton

protected void setTreasuryCertButton(int i,
                                     boolean clickable)

setCompanyCashButton

protected void setCompanyCashButton(int i,
                                    boolean clickable,
                                    PossibleAction action)

setPlayerCashButton

protected void setPlayerCashButton(int i,
                                   boolean clickable,
                                   PossibleAction action)