|
From: Erik V. <ev...@us...> - 2012-01-12 15:07:15
|
rails/ui/swing/GameStatus.java | 1
rails/ui/swing/ORPanel.java | 193 ++++----
rails/ui/swing/ORUIManager.java | 325 +++++++-------
rails/ui/swing/StartRoundWindow.java | 7
rails/ui/swing/StatusWindow.java | 86 +--
rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java | 25 -
rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java | 18
rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java | 8
rails/ui/swing/gamespecific/_18EU/GameUIManager_18EU.java | 110 ++--
9 files changed, 397 insertions(+), 376 deletions(-)
New commits:
commit 80327b9fd861613e417dbdbe76aec32703ec16cf
Author: Erik Vos <eri...@xs...>
Date: Thu Jan 12 16:05:58 2012 +0100
Disable buttons on non-modal popups.
diff --git a/rails/ui/swing/GameStatus.java b/rails/ui/swing/GameStatus.java
index bab6fb0..6cc5c2e 100644
--- a/rails/ui/swing/GameStatus.java
+++ b/rails/ui/swing/GameStatus.java
@@ -746,6 +746,7 @@ public class GameStatus extends GridPanel implements ActionListener {
companyName),
options.toArray(new String[0]), -1);
gameUIManager.setCurrentDialog(dialog, actions.get(0));
+ parent.disableButtons();
return;
} else {
String sp =
diff --git a/rails/ui/swing/ORPanel.java b/rails/ui/swing/ORPanel.java
index e8f8254..b2251c3 100644
--- a/rails/ui/swing/ORPanel.java
+++ b/rails/ui/swing/ORPanel.java
@@ -9,7 +9,6 @@ import java.util.List;
import javax.swing.*;
import org.apache.log4j.Logger;
-
import org.jgrapht.graph.SimpleGraph;
import rails.algorithms.*;
@@ -61,7 +60,7 @@ implements ActionListener, KeyListener, RevenueListener {
private JMenuItem zoomIn, zoomOut, fitToWindow, fitToWidth, fitToHeight, calibrateMap;
private ActionMenuItem takeLoans;
private ActionMenuItem repayLoans;
-
+
// Grid elements per function
private Caption leftCompName[];
private int leftCompNameXOffset, leftCompNameYOffset;
@@ -102,7 +101,7 @@ implements ActionListener, KeyListener, RevenueListener {
private boolean hasRights;
private Caption tileCaption, tokenCaption, revenueCaption, trainCaption,
- privatesCaption, loansCaption;
+ privatesCaption, loansCaption;
private ActionButton buttonOC; // sfy: button for operating costs
private ActionButton button1;
@@ -116,13 +115,13 @@ implements ActionListener, KeyListener, RevenueListener {
private int orCompIndex = -1;
private PublicCompanyI orComp = null;
-
+
private boolean isRevenueValueToBeSet = false;
private RevenueAdapter revenueAdapter = null;
private Thread revenueThread = null;
protected static Logger log =
- Logger.getLogger(ORPanel.class.getPackage().getName());
+ Logger.getLogger(ORPanel.class.getPackage().getName());
public ORPanel(ORWindow parent, ORUIManager orUIManager) {
super();
@@ -141,7 +140,7 @@ implements ActionListener, KeyListener, RevenueListener {
parentFrame = parent;
round = gameUIManager.getCurrentRound();
-// noMapMode = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.NO_MAP_MODE);
+ // noMapMode = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.NO_MAP_MODE);
privatesCanBeBought = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES);
bonusTokensExist = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.DO_BONUS_TOKENS_EXIST);
hasCompanyLoans = gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.HAS_ANY_COMPANY_LOANS);
@@ -168,7 +167,7 @@ implements ActionListener, KeyListener, RevenueListener {
infoMenu = new JMenu(LocalText.getText("Info"));
infoMenu.setEnabled(true);
remainingTilesMenuItem =
- new JMenuItem(LocalText.getText("RemainingTiles"));
+ new JMenuItem(LocalText.getText("RemainingTiles"));
remainingTilesMenuItem.addActionListener(this);
remainingTilesMenuItem.setActionCommand(REM_TILES_CMD);
infoMenu.add(remainingTilesMenuItem);
@@ -240,14 +239,14 @@ implements ActionListener, KeyListener, RevenueListener {
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(name);
menuItem.addActionListener(this);
menuItem.setEnabled(true);
-
+
//check whether this is the default fit to option
if (name.equalsIgnoreCase(Config.get("map.defaultZoomFitOption"))) {
menuItem.setSelected(true);
}
return menuItem;
}
-
+
public void recreate(OperatingRound or) {
log.debug("ORPanel.recreate() called");
@@ -260,11 +259,11 @@ implements ActionListener, KeyListener, RevenueListener {
// Create new fields
initFields();
-
+
// update the networkInfo menu
// TODO: This relies on a recreate as soon as companies have changed
addNetworkInfo();
-
+
repaint();
}
@@ -333,7 +332,7 @@ implements ActionListener, KeyListener, RevenueListener {
public void mouseReleased(MouseEvent e) {}
};
}
-
+
private void initFields() {
leftCompName = new Caption[nc];
rightCompName = new Caption[nc];
@@ -360,7 +359,7 @@ implements ActionListener, KeyListener, RevenueListener {
leftCompNameYOffset = 2;
int currentXOffset = leftCompNameXOffset;
int lastXWidth = 0;
-
+
MouseListener companyCaptionMouseClickListener = getCompanyCaptionMouseClickListener();
/* Top titles */
@@ -399,7 +398,7 @@ implements ActionListener, KeyListener, RevenueListener {
addField (loansCaption = new Caption(LocalText.getText("LOANS")),
loansXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT);
}
-
+
if (hasRights) {
rightsXOffset = currentXOffset += lastXWidth;
rightsYOffset = leftCompNameYOffset;
@@ -413,7 +412,7 @@ implements ActionListener, KeyListener, RevenueListener {
lastXWidth = 2, 1, WIDE_RIGHT);
addField(new Caption("laid"), tilesXOffset, 1, 1, 1, WIDE_BOTTOM);
addField(new Caption("cost"), tilesXOffset + 1, 1, 1, 1, WIDE_BOTTOM
- + WIDE_RIGHT);
+ + WIDE_RIGHT);
tokensXOffset = currentXOffset += lastXWidth;
tokensYOffset = leftCompNameYOffset;
@@ -435,7 +434,7 @@ implements ActionListener, KeyListener, RevenueListener {
lastXWidth = 2, 1, WIDE_RIGHT);
addField(new Caption("earned"), revXOffset, 1, 1, 1, WIDE_BOTTOM);
addField(new Caption("payout"), revXOffset + 1, 1, 1, 1, WIDE_BOTTOM
- + WIDE_RIGHT);
+ + WIDE_RIGHT);
trainsXOffset = currentXOffset += lastXWidth;
trainsYOffset = leftCompNameYOffset;
@@ -443,7 +442,7 @@ implements ActionListener, KeyListener, RevenueListener {
lastXWidth = 2, 1, WIDE_RIGHT);
addField(new Caption("owned"), trainsXOffset, 1, 1, 1, WIDE_BOTTOM);
addField(new Caption("cost"), trainsXOffset + 1, 1, 1, 1, WIDE_BOTTOM
- + WIDE_RIGHT);
+ + WIDE_RIGHT);
rightCompNameXOffset = currentXOffset += lastXWidth;
rightCompNameYOffset = leftCompNameYOffset;
@@ -456,7 +455,7 @@ implements ActionListener, KeyListener, RevenueListener {
for (int i = 0; i < nc; i++) {
c = companies[i];
rowVisibilityObservers[i]
- = new RowVisibility (this, leftCompNameYOffset + i, c.getInGameModel(), true);
+ = new RowVisibility (this, leftCompNameYOffset + i, c.getInGameModel(), true);
observers.add(rowVisibilityObservers[i]);
boolean visible = !c.isClosed();
@@ -465,17 +464,17 @@ implements ActionListener, KeyListener, RevenueListener {
f.setBackground(c.getBgColour());
f.setForeground(c.getFgColour());
HexHighlightMouseListener.addMouseListener(f,
- orUIManager,(PublicCompanyI)c,false);
+ orUIManager,c,false);
f.addMouseListener(companyCaptionMouseClickListener);
f.setToolTipText(LocalText.getText("NetworkInfoDialogTitle",c.getName()));
addField(f, leftCompNameXOffset, leftCompNameYOffset + i, 1, 1,
WIDE_RIGHT, visible);
f =
- president[i] =
-// new Field(c.hasStarted() && !c.isClosed()
-// ? c.getPresident().getNameAndPriority() : "");
- new Field(c.getPresidentModel());
+ president[i] =
+ // new Field(c.hasStarted() && !c.isClosed()
+ // ? c.getPresident().getNameAndPriority() : "");
+ new Field(c.getPresidentModel());
addField(f, presidentXOffset, presidentYOffset + i, 1, 1, 0, visible);
f = sharePrice[i] = new Field(c.getCurrentPriceModel());
@@ -486,17 +485,17 @@ implements ActionListener, KeyListener, RevenueListener {
if (privatesCanBeBought) {
f =
- privates[i] =
- new Field(
- c.getPortfolio().getPrivatesOwnedModel());
+ privates[i] =
+ new Field(
+ c.getPortfolio().getPrivatesOwnedModel());
HexHighlightMouseListener.addMouseListener(f,
orUIManager,c.getPortfolio());
addField(f, privatesXOffset, privatesYOffset + i, 1, 1,
WIDE_RIGHT, visible);
f =
- newPrivatesCost[i] =
- new Field(c.getPrivatesSpentThisTurnModel());
+ newPrivatesCost[i] =
+ new Field(c.getPrivatesSpentThisTurnModel());
addField(f, privatesXOffset + 1, privatesYOffset + i, 1, 1,
WIDE_RIGHT, visible);
}
@@ -510,7 +509,7 @@ implements ActionListener, KeyListener, RevenueListener {
}
addField (f, loansXOffset, loansYOffset + i, 1, 1, WIDE_RIGHT, visible);
}
-
+
if (hasRights) {
f = rights[i] = new Field (c.getRightsModel());
addField (f, rightsXOffset, rightsYOffset + i, 1, 1, WIDE_RIGHT, visible);
@@ -560,7 +559,7 @@ implements ActionListener, KeyListener, RevenueListener {
f.setBackground(companies[i].getBgColour());
f.setForeground(companies[i].getFgColour());
HexHighlightMouseListener.addMouseListener(f,
- orUIManager,(PublicCompanyI)c,false);
+ orUIManager,c,false);
f.addMouseListener(companyCaptionMouseClickListener);
f.setToolTipText(LocalText.getText("NetworkInfoDialogTitle",c.getName()));
addField(f, rightCompNameXOffset, rightCompNameYOffset + i, 1, 1, 0, visible);
@@ -571,30 +570,30 @@ implements ActionListener, KeyListener, RevenueListener {
protected void addCompanyInfo() {
- CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager();
- List<CompanyTypeI> comps = cm.getCompanyTypes();
- JMenu compMenu, menu, item;
+ CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager();
+ List<CompanyTypeI> comps = cm.getCompanyTypes();
+ JMenu compMenu, menu, item;
compMenu = new JMenu(LocalText.getText("Companies"));
compMenu.setEnabled(true);
infoMenu.add(compMenu);
- for (CompanyTypeI type : comps) {
- menu = new JMenu (LocalText.getText(type.getName()));
- menu.setEnabled(true);
+ for (CompanyTypeI type : comps) {
+ menu = new JMenu (LocalText.getText(type.getName()));
+ menu.setEnabled(true);
compMenu.add(menu);
- for (CompanyI comp : type.getCompanies()) {
- item = new JMenu(comp.getName());
- item.setEnabled(true);
- JMenuItem menuItem = new JMenuItem(comp.getInfoText());
- if (comp instanceof PrivateCompanyI) {
- //highlighting on menu items always enabled irrespective of config
+ for (CompanyI comp : type.getCompanies()) {
+ item = new JMenu(comp.getName());
+ item.setEnabled(true);
+ JMenuItem menuItem = new JMenuItem(comp.getInfoText());
+ if (comp instanceof PrivateCompanyI) {
+ //highlighting on menu items always enabled irrespective of config
HexHighlightMouseListener.addMouseListener(menuItem,
orUIManager,(PrivateCompanyI)comp,true);
HexHighlightMouseListener.addMouseListener(item,
orUIManager,(PrivateCompanyI)comp,true);
- }
+ }
if (comp instanceof PublicCompanyI) {
//highlighting on menu items always enabled irrespective of config
HexHighlightMouseListener.addMouseListener(menuItem,
@@ -603,9 +602,9 @@ implements ActionListener, KeyListener, RevenueListener {
orUIManager,(PublicCompanyI)comp,true);
}
item.add(menuItem);
- menu.add(item);
- }
- }
+ menu.add(item);
+ }
+ }
}
protected void addTrainsInfo() {
@@ -670,16 +669,16 @@ implements ActionListener, KeyListener, RevenueListener {
networkInfoMenu.setEnabled(true);
infoMenu.add(networkInfoMenu);
}
-
+
protected JMenu createNetworkInfo() {
boolean route_highlight = orUIManager.gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.ROUTE_HIGHLIGHT);
- boolean revenue_suggest = orUIManager.gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.REVENUE_SUGGEST);
-
- if (!route_highlight && !revenue_suggest) return null;
-
+ boolean revenue_suggest = orUIManager.gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.REVENUE_SUGGEST);
+
+ if (!route_highlight && !revenue_suggest) return null;
+
JMenu networkMenu = new JMenu(LocalText.getText("NetworkInfo"));
-
+
//network graphs only for developers
if (route_highlight && Game.getDevelop()) {
JMenuItem item = new JMenuItem("Network");
@@ -687,7 +686,7 @@ implements ActionListener, KeyListener, RevenueListener {
item.setActionCommand(NETWORK_INFO_CMD);
networkMenu.add(item);
}
-
+
if (revenue_suggest) {
CompanyManagerI cm = orUIManager.getGameUIManager().getGameManager().getCompanyManager();
for (PublicCompanyI comp : cm.getAllPublicCompanies()) {
@@ -698,35 +697,35 @@ implements ActionListener, KeyListener, RevenueListener {
networkMenu.add(item);
}
}
-
+
return networkMenu;
}
-
+
protected void executeNetworkInfo(String companyName) {
GameManagerI gm = orUIManager.getGameUIManager().getGameManager();
-
+
if (companyName.equals("Network")) {
NetworkGraphBuilder nwGraph = NetworkGraphBuilder.create(gm);
SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph();
-
-// NetworkGraphBuilder.visualize(mapGraph, "Map Network");
+
+ // NetworkGraphBuilder.visualize(mapGraph, "Map Network");
mapGraph = NetworkGraphBuilder.optimizeGraph(mapGraph);
NetworkGraphBuilder.visualize(mapGraph, "Optimized Map Network");
} else {
CompanyManagerI cm = gm.getCompanyManager();
PublicCompanyI company = cm.getPublicCompany(companyName);
//handle the case of invalid parameters
- //could occur if the method is not invoked by the menu (but by the click listener)
+ //could occur if the method is not invoked by the menu (but by the click listener)
if (company == null) return;
-//
-// NetworkGraphBuilder nwGraph = NetworkGraphBuilder.create(gm);
-// NetworkCompanyGraph companyGraph = NetworkCompanyGraph.create(nwGraph, company);
-// companyGraph.createRouteGraph(false);
-// companyGraph.createRevenueGraph(new ArrayList<NetworkVertex>());
-// Multigraph<NetworkVertex, NetworkEdge> graph= companyGraph.createPhaseTwoGraph();
-// NetworkGraphBuilder.visualize(graph, "Phase Two Company Network");
-// JOptionPane.showMessageDialog(orWindow,
-// "Vertices = " + graph.vertexSet().size() + ", Edges = " + graph.edgeSet().size());
+ //
+ // NetworkGraphBuilder nwGraph = NetworkGraphBuilder.create(gm);
+ // NetworkCompanyGraph companyGraph = NetworkCompanyGraph.create(nwGraph, company);
+ // companyGraph.createRouteGraph(false);
+ // companyGraph.createRevenueGraph(new ArrayList<NetworkVertex>());
+ // Multigraph<NetworkVertex, NetworkEdge> graph= companyGraph.createPhaseTwoGraph();
+ // NetworkGraphBuilder.visualize(graph, "Phase Two Company Network");
+ // JOptionPane.showMessageDialog(orWindow,
+ // "Vertices = " + graph.vertexSet().size() + ", Edges = " + graph.edgeSet().size());
List<String> addTrainList = new ArrayList<String>();
boolean anotherTrain = true;
RevenueAdapter ra = null;
@@ -742,24 +741,24 @@ implements ActionListener, KeyListener, RevenueListener {
log.debug("Revenue Value:" + revenueValue);
log.debug("Revenue Run:" + ra.getOptimalRunPrettyPrint(true));
ra.drawOptimalRunAsPath(orUIManager.getMap());
-
+
if (!Game.getDevelop()) {
//parent component is ORPanel so that dialog won't hide the routes painted on the map
- JOptionPane.showMessageDialog(this,
+ JOptionPane.showMessageDialog(this,
LocalText.getText("NetworkInfoDialogMessage",company.getName(),Bank.format(revenueValue)) ,
LocalText.getText("NetworkInfoDialogTitle",company.getName()),
JOptionPane.INFORMATION_MESSAGE);
//train simulation only for developers
break;
}
-
+
JOptionPane.showMessageDialog(orWindow, "RevenueValue = " + revenueValue +
"\nRevenueRun = \n" + ra.getOptimalRunPrettyPrint(true));
-
+
String trainString =
JOptionPane.showInputDialog(null, "Enter train string (Examples: 5, 3+3, 4D, 6E, D)",
- "Add another train to run?",
- JOptionPane.QUESTION_MESSAGE);
+ "Add another train to run?",
+ JOptionPane.QUESTION_MESSAGE);
if (trainString == null || trainString.equals("")) {
anotherTrain = false;
} else {
@@ -773,7 +772,7 @@ implements ActionListener, KeyListener, RevenueListener {
if (revenueAdapter != null) revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap());
}
}
-
+
private void appendInfoText (StringBuffer b, String text) {
if (text == null || text.length() == 0) return;
if (b.length() > 6) b.append("<br>");
@@ -797,7 +796,7 @@ implements ActionListener, KeyListener, RevenueListener {
revenueAdapter.drawOptimalRunAsPath(orUIManager.getMap());
}
}
-
+
public void actionPerformed(ActionEvent actor) {
// What kind action has been taken?
@@ -904,7 +903,7 @@ implements ActionListener, KeyListener, RevenueListener {
if (hasCompanyLoans) {
loansCaption.setHighlight(false);
}
-
+
for (JMenuItem item : menuItemsToReset) {
item.setEnabled(false);
if (item instanceof ActionMenuItem) {
@@ -912,7 +911,7 @@ implements ActionListener, KeyListener, RevenueListener {
}
}
undoButton.setEnabled(false);
-
+
}
public void resetORCompanyTurn(int orCompIndex) {
@@ -925,7 +924,7 @@ implements ActionListener, KeyListener, RevenueListener {
public void resetCurrentRevenueDisplay() {
setSelect(revenue[orCompIndex], revenueSelect[orCompIndex], false);
}
-
+
/**
*
* @return True if route should be displayed (at least for the set revenue step)
@@ -933,11 +932,11 @@ implements ActionListener, KeyListener, RevenueListener {
private boolean isDisplayRoutes() {
return (orUIManager.gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.ROUTE_HIGHLIGHT));
}
-
+
private boolean isSuggestRevenue() {
return (orUIManager.gameUIManager.getGameParameterAsBoolean(GuiDef.Parm.REVENUE_SUGGEST));
}
-
+
/**
*
* @return True if the routes of the currently active company should be displayed.
@@ -947,7 +946,7 @@ implements ActionListener, KeyListener, RevenueListener {
return (isDisplayRoutes()
&& "yes".equalsIgnoreCase(Config.get("map.displayCurrentRoutes")));
}
-
+
/**
* any routes currently displayed on the map are removed
* In addition, revenue adapter and its thread are interrupted / removed.
@@ -956,7 +955,7 @@ implements ActionListener, KeyListener, RevenueListener {
clearRevenueAdapter();
orUIManager.getMap().setTrainPaths(null);
}
-
+
private void clearRevenueAdapter() {
if (revenueThread != null) {
revenueThread.interrupt();
@@ -967,9 +966,9 @@ implements ActionListener, KeyListener, RevenueListener {
revenueAdapter = null;
}
}
-
+
private void updateCurrentRoutes(boolean isSetRevenueStep) {
-
+
// initialize and start the revenue adapter if routes to be displayed
// or revenue to be suggested in the revenue step
if (isDisplayCurrentRoutes() || (isSuggestRevenue() && isSetRevenueStep)) {
@@ -993,7 +992,7 @@ implements ActionListener, KeyListener, RevenueListener {
}
}
-
+
public void initORCompanyTurn(PublicCompanyI orComp, int orCompIndex) {
this.orComp = orComp;
@@ -1009,7 +1008,7 @@ implements ActionListener, KeyListener, RevenueListener {
button1.setEnabled(false);
button2.setEnabled(false);
button3.setEnabled(false);
-
+
updateCurrentRoutes(false);
}
@@ -1018,7 +1017,7 @@ implements ActionListener, KeyListener, RevenueListener {
tileCaption.setHighlight(true);
button1.setVisible(false);
-
+
}
public void initTokenLayingStep() {
@@ -1034,7 +1033,7 @@ implements ActionListener, KeyListener, RevenueListener {
revenueCaption.setHighlight(true);
revenueSelect[orCompIndex].setValue(action.getPresetRevenue());
-
+
setSelect(revenue[orCompIndex], revenueSelect[orCompIndex], true);
button1.setText(LocalText.getText("SET_REVENUE"));
@@ -1043,7 +1042,7 @@ implements ActionListener, KeyListener, RevenueListener {
button1.setMnemonic(KeyEvent.VK_R);
button1.setEnabled(true);
button1.setVisible(true);
-
+
//indicate interest in setting revenue values (and not only displaying routes)
updateCurrentRoutes(true);
}
@@ -1062,12 +1061,12 @@ implements ActionListener, KeyListener, RevenueListener {
}
}
}
-
+
public void stopRevenueUpdate() {
isRevenueValueToBeSet = false;
}
-
-
+
+
public void initPayoutStep(int orCompIndex, SetDividend action,
boolean withhold, boolean split, boolean payout) {
@@ -1207,6 +1206,14 @@ implements ActionListener, KeyListener, RevenueListener {
button1.setVisible(true);
}
+ public void disableButtons () {
+ button1.setEnabled(false);
+ button2.setEnabled(false);
+ button3.setEnabled(false);
+ undoButton.setEnabled(false);
+ redoButton.setEnabled(false);
+ }
+
public void finishORCompanyTurn(int orCompIndex) {
for (Field field : president) {
diff --git a/rails/ui/swing/ORUIManager.java b/rails/ui/swing/ORUIManager.java
index 40da760..a097bf7 100644
--- a/rails/ui/swing/ORUIManager.java
+++ b/rails/ui/swing/ORUIManager.java
@@ -20,7 +20,7 @@ import rails.game.special.*;
import rails.ui.swing.elements.*;
import rails.ui.swing.hexmap.GUIHex;
import rails.ui.swing.hexmap.HexMap;
-import rails.util.*;
+import rails.util.Util;
public class ORUIManager implements DialogOwner {
@@ -46,7 +46,7 @@ public class ORUIManager implements DialogOwner {
protected PossibleActions possibleActions = PossibleActions.getInstance();
private boolean privatesCanBeBoughtNow;
public List<PossibleAction> mapRelatedActions =
- new ArrayList<PossibleAction>();
+ new ArrayList<PossibleAction>();
private boolean tileLayingEnabled = false;
public List<LayTile> allowedTileLays = new ArrayList<LayTile>();
@@ -84,13 +84,13 @@ public class ORUIManager implements DialogOwner {
/* Message key per substep */
protected static final String[] messageKey =
- new String[] { "Inactive", "SelectAHexForTile", "SelectATile",
- "RotateTile", "SelectAHexForToken", "SelectAToken",
- "ConfirmToken", "SetRevenue", "SelectPayout",
- "CorrectMap" };
+ new String[] { "Inactive", "SelectAHexForTile", "SelectATile",
+ "RotateTile", "SelectAHexForToken", "SelectAToken",
+ "ConfirmToken", "SetRevenue", "SelectPayout",
+ "CorrectMap" };
protected static Logger log =
- Logger.getLogger(ORUIManager.class.getPackage().getName());
+ Logger.getLogger(ORUIManager.class.getPackage().getName());
public ORUIManager() {
@@ -296,9 +296,9 @@ public class ORUIManager implements DialogOwner {
// For now, this only has an effect during tile and token laying.
// Perhaps we need to centralise message updating here in a later stage.
log.debug("Calling updateMessage, subStep=" + localStep/*
- * , new
- * Exception("TRACE")
- */);
+ * , new
+ * Exception("TRACE")
+ */);
if (localStep == ORUIManager.INACTIVE) return;
String message = LocalText.getText(ORUIManager.messageKey[localStep]);
@@ -349,9 +349,9 @@ public class ORUIManager implements DialogOwner {
}
if (normalTileMessage.length() > 1) {
message +=
- " "
- + LocalText.getText("TileColours",
- normalTileMessage);
+ " "
+ + LocalText.getText("TileColours",
+ normalTileMessage);
}
} else if (localStep == ORUIManager.SELECT_HEX_FOR_TOKEN) {
@@ -361,7 +361,7 @@ public class ORUIManager implements DialogOwner {
StringBuffer normalTokenMessage = new StringBuffer(" ");
List<LayBaseToken> tokenLays =
- possibleActions.getType(LayBaseToken.class);
+ possibleActions.getType(LayBaseToken.class);
log.debug("There are " + tokenLays.size() + " TokenLay objects");
int ii = 0;
for (LayBaseToken tokenLay : tokenLays) {
@@ -380,7 +380,7 @@ public class ORUIManager implements DialogOwner {
}
if (normalTokenMessage.length() > 1) {
message += " " + LocalText.getText("NormalToken",
- normalTokenMessage);
+ normalTokenMessage);
}
}
if (extraMessage.length() > 0) {
@@ -400,10 +400,10 @@ public class ORUIManager implements DialogOwner {
public void processAction(String command, List<PossibleAction> actions) {
if (actions != null && actions.size() > 0
- && !processGameSpecificActions(actions)) {
+ && !processGameSpecificActions(actions)) {
Class<? extends PossibleAction> actionType =
- actions.get(0).getClass();
+ actions.get(0).getClass();
if (actionType == SetDividend.class) {
@@ -426,7 +426,7 @@ public class ORUIManager implements DialogOwner {
buyBonusToken ((BuyBonusToken)actions.get(0));
} else if (actionType == NullAction.class
- || actionType == GameAction.class ) {
+ || actionType == GameAction.class ) {
orWindow.process(actions.get(0));
@@ -495,7 +495,7 @@ public class ORUIManager implements DialogOwner {
action.setActualRevenue(amount);
if (amount == 0 || action.getRevenueAllocation() != SetDividend.UNKNOWN) {
log.debug("Allocation is known: "
- + action.getRevenueAllocation());
+ + action.getRevenueAllocation());
orWindow.process(action);
} else {
log.debug("Allocation is unknown, asking for it");
@@ -597,6 +597,7 @@ public class ORUIManager implements DialogOwner {
public void setCurrentDialog (JDialog dialog, PossibleAction action) {
gameUIManager.setCurrentDialog(dialog, action);
+ if (!(dialog instanceof MessageDialog)) orPanel.disableButtons();
}
public void hexClicked(GUIHex clickedHex, GUIHex selectedHex) {
@@ -628,10 +629,10 @@ public class ORUIManager implements DialogOwner {
return;
}
List<LayToken> allowances =
- map.getTokenAllowanceForHex(clickedHex.getHexModel());
+ map.getTokenAllowanceForHex(clickedHex.getHexModel());
if (allowances.size() > 0) {
log.debug("Hex " + clickedHex.getName()
- + " clicked, allowances:");
+ + " clicked, allowances:");
for (LayToken allowance : allowances) {
log.debug(allowance.toString());
}
@@ -645,7 +646,7 @@ public class ORUIManager implements DialogOwner {
} else if (tileLayingEnabled) {
if (localStep == ROTATE_OR_CONFIRM_TILE
- && clickedHex == selectedHex) {
+ && clickedHex == selectedHex) {
selectedHex.rotateTile();
return;
@@ -660,16 +661,16 @@ public class ORUIManager implements DialogOwner {
setLocalStep(SELECT_HEX_FOR_TILE);
} else {
if (clickedHex.getHexModel().isUpgradeableNow())
- /*
- * Direct call to Model to be replaced later by use of
- * allowedTilesPerHex. Would not work yet.
- */
+ /*
+ * Direct call to Model to be replaced later by use of
+ * allowedTilesPerHex. Would not work yet.
+ */
{
map.selectHex(clickedHex);
setLocalStep(SELECT_TILE);
} else {
JOptionPane.showMessageDialog(mapPanel,
- "This hex cannot be upgraded now");
+ "This hex cannot be upgraded now");
}
}
}
@@ -695,11 +696,11 @@ public class ORUIManager implements DialogOwner {
// Check if the new tile must be connected to some other track
boolean mustConnect =
- tile.getColourName().equalsIgnoreCase(Tile.YELLOW_COLOUR_NAME)
- // Does not apply to the current company's home hex(es)
- && !hex.getHexModel().isHomeFor(orComp)
- // Does not apply to special tile lays
- && !isUnconnectedTileLayTarget(hex);
+ tile.getColourName().equalsIgnoreCase(Tile.YELLOW_COLOUR_NAME)
+ // Does not apply to the current company's home hex(es)
+ && !hex.getHexModel().isHomeFor(orComp)
+ // Does not apply to special tile lays
+ && !isUnconnectedTileLayTarget(hex);
if (hex.dropTile(tileId, mustConnect)) {
/* Lay tile */
@@ -707,7 +708,7 @@ public class ORUIManager implements DialogOwner {
} else {
/* Tile cannot be laid in a valid orientation: refuse it */
JOptionPane.showMessageDialog(mapPanel,
- "This tile cannot be laid in a valid orientation.");
+ "This tile cannot be laid in a valid orientation.");
tileUpgrades.remove(tile);
setLocalStep(ORUIManager.SELECT_TILE);
upgradePanel.showUpgrades();
@@ -719,7 +720,7 @@ public class ORUIManager implements DialogOwner {
MapHex mapHex = hex.getHexModel();
for (LayTile action : possibleActions.getType(LayTile.class)) {
if (action.getType() == LayTile.SPECIAL_PROPERTY
- && action.getSpecialProperty().getLocations().contains(mapHex)) {
+ && action.getSpecialProperty().getLocations().contains(mapHex)) {
// log.debug(hex.getName()+" is a special property target");
return true;
}
@@ -746,7 +747,7 @@ public class ORUIManager implements DialogOwner {
if (selectedHex != null && selectedHex.canFixTile()) {
List<LayTile> allowances =
- map.getTileAllowancesForHex(selectedHex.getHexModel());
+ map.getTileAllowancesForHex(selectedHex.getHexModel());
LayTile allowance = null;
TileI tile = selectedHex.getProvisionalTile();
if (allowances.size() == 1) {
@@ -769,7 +770,7 @@ public class ORUIManager implements DialogOwner {
&& !sp_tiles.contains(tile)) continue;
// 2. SP refers to specified hexes, (one of) which is chosen:
// (example: 1830 hex B20)
- if ((sp_hexes = lt.getLocations()) != null
+ if ((sp_hexes = lt.getLocations()) != null
&& !sp_hexes.contains(selectedHex.getModel())) continue;
spec_lt = lt;
} else {
@@ -777,12 +778,12 @@ public class ORUIManager implements DialogOwner {
gen_lt = lt;
}
}
-
+
allowance = spec_lt == null ? gen_lt :
- gen_lt == null ? spec_lt :
- spec_lt.getSpecialProperty().getPriority()
- == SpecialPropertyI.Priority.FIRST ? spec_lt : gen_lt;
-
+ gen_lt == null ? spec_lt :
+ spec_lt.getSpecialProperty().getPriority()
+ == SpecialPropertyI.Priority.FIRST ? spec_lt : gen_lt;
+
}
allowance.setChosenHex(selectedHex.getHexModel());
allowance.setOrientation(selectedHex.getProvisionalTileRotation());
@@ -835,11 +836,11 @@ public class ORUIManager implements DialogOwner {
if (city.hasTokenSlotsLeft()) {
prompt = LocalText.getText(
"SelectStationForTokenOption",
- city.getNumber(),
- ((MapHex) selectedHex.getModel()).getConnectionString(
- selectedHex.getCurrentTile(),
- ((MapHex) selectedHex.getModel()).getCurrentTileRotation(),
- city.getRelatedStation().getNumber())) ;
+ city.getNumber(),
+ ((MapHex) selectedHex.getModel()).getConnectionString(
+ selectedHex.getCurrentTile(),
+ ((MapHex) selectedHex.getModel()).getCurrentTileRotation(),
+ city.getRelatedStation().getNumber())) ;
prompts.add(prompt);
promptToCityMap.put(prompt, city);
}
@@ -847,17 +848,17 @@ public class ORUIManager implements DialogOwner {
if (prompts.isEmpty()) {
return;
}
- // If more than one City to choose from, ask the player. Otherwise use Element zero (first) for the station.
+ // If more than one City to choose from, ask the player. Otherwise use Element zero (first) for the station.
if (prompts.size() > 1) {
String selected =
- (String) JOptionPane.showInputDialog(orWindow,
- LocalText.getText("SelectStationForToken",
- action.getPlayerName(),
- selectedHex.getName(),
- action.getCompanyName()),
- LocalText.getText("WhichStation"),
- JOptionPane.PLAIN_MESSAGE, null,
- prompts.toArray(), prompts.get(0));
+ (String) JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("SelectStationForToken",
+ action.getPlayerName(),
+ selectedHex.getName(),
+ action.getCompanyName()),
+ LocalText.getText("WhichStation"),
+ JOptionPane.PLAIN_MESSAGE, null,
+ prompts.toArray(), prompts.get(0));
if (selected == null) return;
station = promptToCityMap.get(selected).getNumber();
} else {
@@ -891,7 +892,7 @@ public class ORUIManager implements DialogOwner {
MapHex hex = action.getChosenHex();
TileI newTile = action.getLaidTile();
TileI oldTile = hex.getCurrentTile();
- if (!action.isRelayBaseTokens()
+ if (!action.isRelayBaseTokens()
&& !oldTile.relayBaseTokensOnUpgrade()) return;
for (Stop oldStop : hex.getStops()) {
if (oldStop.hasTokens()) {
@@ -906,9 +907,9 @@ public class ORUIManager implements DialogOwner {
prompt = LocalText.getText("SelectStationForTokenOption",
newStation.getNumber(),
hex.getConnectionString(
- newTile,
- action.getOrientation(),
- newStation.getNumber()) );
+ newTile,
+ action.getOrientation(),
+ newStation.getNumber()) );
prompts.add(prompt);
promptToCityMap.put(prompt, newStation.getNumber());
}
@@ -918,21 +919,21 @@ public class ORUIManager implements DialogOwner {
}
if (prompts.size () > 1) {
String selected =
- (String) JOptionPane.showInputDialog(orWindow,
- LocalText.getText("SelectStationForToken",
- action.getPlayerName(),
- hex.getName(),
- company.getName()
- ),
- LocalText.getText("WhichStation"),
- JOptionPane.PLAIN_MESSAGE, null,
- prompts.toArray(), prompts.get(0));
+ (String) JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("SelectStationForToken",
+ action.getPlayerName(),
+ hex.getName(),
+ company.getName()
+ ),
+ LocalText.getText("WhichStation"),
+ JOptionPane.PLAIN_MESSAGE, null,
+ prompts.toArray(), prompts.get(0));
if (selected == null) return;
action.addRelayBaseToken(company.getName(), promptToCityMap.get(selected));
} else {
action.addRelayBaseToken(company.getName(), promptToCityMap.get(prompts.toArray() [0]));
}
- }
+ }
}
}
@@ -945,15 +946,15 @@ public class ORUIManager implements DialogOwner {
Map<String, Station> promptToStationMap = new HashMap<String, Station>();
String prompt;
for (Station station:possibleStations) {
- prompt = LocalText.getText(
- "SelectStationForTokenOption",
- station.getNumber(),
- ((MapHex) selectedHex.getModel()).getConnectionString(
- selectedHex.getProvisionalTile(),
- selectedHex.getProvisionalTileRotation(),
- station.getNumber())) ;
- prompts.add(prompt);
- promptToStationMap.put(prompt, station);
+ prompt = LocalText.getText(
+ "SelectStationForTokenOption",
+ station.getNumber(),
+ ((MapHex) selectedHex.getModel()).getConnectionString(
+ selectedHex.getProvisionalTile(),
+ selectedHex.getProvisionalTileRotation(),
+ station.getNumber())) ;
+ prompts.add(prompt);
+ promptToStationMap.put(prompt, station);
}
String selected =
(String) JOptionPane.showInputDialog(orWindow,
@@ -1012,11 +1013,11 @@ public class ORUIManager implements DialogOwner {
OperatingCost.OCType t = ac.getOCType();
if (t == OperatingCost.OCType.LAY_TILE)
textOC.add(LocalText.getText("OCLayTile",
- suggestedCostText ));
+ suggestedCostText ));
if (t == OperatingCost.OCType.LAY_BASE_TOKEN)
textOC.add(LocalText.getText("OCLayBaseToken",
- suggestedCostText ));
+ suggestedCostText ));
}
if (!textOC.isEmpty()) {
@@ -1056,7 +1057,7 @@ public class ORUIManager implements DialogOwner {
List<String> prompts = new ArrayList<String>();
Map<String, PossibleAction> promptToTrain =
- new HashMap<String, PossibleAction>();
+ new HashMap<String, PossibleAction>();
TrainI train;
String usingPrivates = "";
@@ -1082,7 +1083,7 @@ public class ORUIManager implements DialogOwner {
from.getName() ));
if (bTrain.isForExchange()) {
b.append(" (").append(LocalText.getText("EXCHANGED")).append(
- ")");
+ ")");
}
if (cost > 0) {
b.append(" ").append(
@@ -1090,7 +1091,7 @@ public class ORUIManager implements DialogOwner {
}
if (bTrain.hasSpecialProperty()) {
String priv =
- (bTrain.getSpecialProperty()).getOriginalCompany().getName();
+ (bTrain.getSpecialProperty()).getOriginalCompany().getName();
b.append(" ").append(LocalText.getText("USING_SP", priv));
usingPrivates += ", " + priv;
}
@@ -1119,7 +1120,7 @@ public class ORUIManager implements DialogOwner {
}
StringBuffer msgbuf =
- new StringBuffer(LocalText.getText("SelectTrain"));
+ new StringBuffer(LocalText.getText("SelectTrain"));
if (usingPrivates.length() > 0) {
msgbuf.append("<br><font color=\"red\">");
msgbuf.append(LocalText.getText("SelectCheapTrain",
@@ -1129,11 +1130,11 @@ public class ORUIManager implements DialogOwner {
setMessage(msgbuf.toString());
String selectedActionText =
- (String) JOptionPane.showInputDialog(orWindow,
- LocalText.getText("BUY_WHICH_TRAIN"),
- LocalText.getText("WHICH_TRAIN"),
- JOptionPane.QUESTION_MESSAGE, null, prompts.toArray(),
- prompts.get(0));
+ (String) JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("BUY_WHICH_TRAIN"),
+ LocalText.getText("WHICH_TRAIN"),
+ JOptionPane.QUESTION_MESSAGE, null, prompts.toArray(),
+ prompts.get(0));
if (!Util.hasValue(selectedActionText)) return;
selectedAction = promptToTrain.get(selectedActionText);
@@ -1146,15 +1147,15 @@ public class ORUIManager implements DialogOwner {
if (price == 0 && seller.getOwner() instanceof PublicCompanyI) {
prompt = LocalText.getText("WHICH_TRAIN_PRICE",
- orComp.getName(),
- train.getName(),
- seller.getName() );
+ orComp.getName(),
+ train.getName(),
+ seller.getName() );
String response;
for (;;) {
response =
- JOptionPane.showInputDialog(orWindow, prompt,
- LocalText.getText("WHICH_PRICE"),
- JOptionPane.QUESTION_MESSAGE);
+ JOptionPane.showInputDialog(orWindow, prompt,
+ LocalText.getText("WHICH_PRICE"),
+ JOptionPane.QUESTION_MESSAGE);
if (response == null) return; // Cancel
try {
price = Integer.parseInt(response);
@@ -1165,8 +1166,8 @@ public class ORUIManager implements DialogOwner {
if (!prompt.startsWith("Please")) {
prompt =
- LocalText.getText("ENTER_PRICE_OR_CANCEL") + "\n"
- + prompt;
+ LocalText.getText("ENTER_PRICE_OR_CANCEL") + "\n"
+ + prompt;
}
}
}
@@ -1178,21 +1179,21 @@ public class ORUIManager implements DialogOwner {
exchangedTrain = oldTrains.get(0);
} else {
List<String> oldTrainOptions =
- new ArrayList<String>(oldTrains.size());
+ new ArrayList<String>(oldTrains.size());
String[] options = new String[oldTrains.size()];
int jj = 0;
for (int j = 0; j < oldTrains.size(); j++) {
options[jj + j] =
- LocalText.getText("N_Train", oldTrains.get(j).getName());
+ LocalText.getText("N_Train", oldTrains.get(j).getName());
oldTrainOptions.add(options[jj + j]);
}
String exchangedTrainName =
- (String) JOptionPane.showInputDialog(orWindow,
- LocalText.getText("WHICH_TRAIN_EXCHANGE_FOR",
- Bank.format(price)),
- LocalText.getText("WHICH_TRAIN_TO_EXCHANGE"),
- JOptionPane.QUESTION_MESSAGE, null, options,
- options[0]);
+ (String) JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("WHICH_TRAIN_EXCHANGE_FOR",
+ Bank.format(price)),
+ LocalText.getText("WHICH_TRAIN_TO_EXCHANGE"),
+ JOptionPane.QUESTION_MESSAGE, null, options,
+ options[0]);
if (exchangedTrainName != null) {
int index = oldTrainOptions.indexOf(exchangedTrainName);
if (index >= 0) {
@@ -1209,7 +1210,7 @@ public class ORUIManager implements DialogOwner {
if (train != null) {
// Remember the old off-board revenue step
int oldOffBoardRevenueStep =
- gameUIManager.getCurrentPhase().getOffBoardRevenueStep();
+ gameUIManager.getCurrentPhase().getOffBoardRevenueStep();
buyAction.setPricePaid(price);
buyAction.setExchangedTrain(exchangedTrain);
@@ -1231,11 +1232,11 @@ public class ORUIManager implements DialogOwner {
gameUIManager.discardTrains(dt);
}
- */
+ */
}
int newOffBoardRevenueStep =
- gameUIManager.getCurrentPhase().getOffBoardRevenueStep();
+ gameUIManager.getCurrentPhase().getOffBoardRevenueStep();
if (newOffBoardRevenueStep != oldOffBoardRevenueStep) {
map.updateOffBoardToolTips();
}
@@ -1262,7 +1263,7 @@ public class ORUIManager implements DialogOwner {
} else {
priceRange = Bank.format(maxPrice);
}
-
+
privatesForSale.add(LocalText.getText("BuyPrivatePrompt",
action.getPrivateCompany().getName(),
action.getPrivateCompany().getPortfolio().getName(),
@@ -1271,11 +1272,11 @@ public class ORUIManager implements DialogOwner {
if (privatesForSale.size() > 0) {
chosenOption =
- (String) JOptionPane.showInputDialog(orWindow,
- LocalText.getText("BUY_WHICH_PRIVATE"),
- LocalText.getText("WHICH_PRIVATE"),
- JOptionPane.QUESTION_MESSAGE, null,
- privatesForSale.toArray(), privatesForSale.get(0));
+ (String) JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("BUY_WHICH_PRIVATE"),
+ LocalText.getText("WHICH_PRIVATE"),
+ JOptionPane.QUESTION_MESSAGE, null,
+ privatesForSale.toArray(), privatesForSale.get(0));
if (chosenOption != null) {
index = privatesForSale.indexOf(chosenOption);
chosenAction = privates.get(index);
@@ -1283,13 +1284,13 @@ public class ORUIManager implements DialogOwner {
maxPrice = chosenAction.getMaximumPrice();
if (minPrice < maxPrice) {
String price =
- JOptionPane.showInputDialog(orWindow,
- LocalText.getText("WHICH_PRIVATE_PRICE",
- chosenOption,
- Bank.format(minPrice),
- Bank.format(maxPrice) ),
- LocalText.getText("WHICH_PRICE"),
- JOptionPane.QUESTION_MESSAGE);
+ JOptionPane.showInputDialog(orWindow,
+ LocalText.getText("WHICH_PRIVATE_PRICE",
+ chosenOption,
+ Bank.format(minPrice),
+ Bank.format(maxPrice) ),
+ LocalText.getText("WHICH_PRICE"),
+ JOptionPane.QUESTION_MESSAGE);
try {
amount = Integer.parseInt(price);
} catch (NumberFormatException e) {
@@ -1386,8 +1387,8 @@ public class ORUIManager implements DialogOwner {
action.getCompanyName(),
Bank.format(action.getPrice()));
if (JOptionPane.showConfirmDialog(orWindow, prompt,
- message, JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE)
+ message, JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE)
== JOptionPane.OK_OPTION) {
action.setNumberTaken(1);
orWindow.process(action);
@@ -1433,9 +1434,9 @@ public class ORUIManager implements DialogOwner {
orWindow,
LocalText.getText("Select"),
LocalText.getText("SelectLoansToRepay", action.getCompanyName()),
- options,
+ options,
0);
- gameUIManager.setCurrentDialog (currentDialog, action);
+ setCurrentDialog (currentDialog, action);
}
}
@@ -1490,7 +1491,7 @@ public class ORUIManager implements DialogOwner {
orPanel.initORCompanyTurn(orComp, orCompIndex);
if (!myTurn) return;
-
+
privatesCanBeBoughtNow = possibleActions.contains(BuyPrivate.class);
orPanel.initPrivateBuying(privatesCanBeBoughtNow);
@@ -1526,14 +1527,14 @@ public class ORUIManager implements DialogOwner {
log.debug("Tiles can be laid");
mapRelatedActions.addAll(possibleActions.getType(LayTile.class));
- //} else if (possibleActions.contains(LayBaseToken.class)) {
+ //} else if (possibleActions.contains(LayBaseToken.class)) {
} else if (orStep == GameDef.OrStep.LAY_TOKEN) {
orWindow.requestFocus();
// Include bonus tokens
List<LayToken> possibleTokenLays =
- possibleActions.getType(LayToken.class);
+ possibleActions.getType(LayToken.class);
mapRelatedActions.addAll(possibleTokenLays);
allowedTokenLays = possibleTokenLays;
@@ -1542,7 +1543,7 @@ public class ORUIManager implements DialogOwner {
log.debug("BaseTokens can be laid");
} else if (possibleActions.contains(SetDividend.class)
- && localStep == SELECT_PAYOUT) {
+ && localStep == SELECT_PAYOUT) {
SetDividend action;
if (actionToComplete != null) {
@@ -1563,7 +1564,7 @@ public class ORUIManager implements DialogOwner {
} else if (possibleActions.contains(SetDividend.class)) {
SetDividend action =
- possibleActions.getType(SetDividend.class).get(0);
+ possibleActions.getType(SetDividend.class).get(0);
orPanel.initRevenueEntryStep(orCompIndex, action);
@@ -1572,13 +1573,13 @@ public class ORUIManager implements DialogOwner {
message += "<br><font color=\"red\">"
+ LocalText.getText("WarningNeedCash",
Bank.format(action.getRequiredCash()))
- + "</font>";
+ + "</font>";
}
setMessage(message);
} else if (orStep == GameDef.OrStep.BUY_TRAIN) {
- boolean canBuyTrain = possibleActions.contains(BuyTrain.class);
+ boolean canBuyTrain = possibleActions.contains(BuyTrain.class);
orPanel.initTrainBuying(canBuyTrain);
StringBuffer b = new StringBuffer(LocalText.getText("BuyTrain"));
@@ -1621,7 +1622,7 @@ public class ORUIManager implements DialogOwner {
if (possibleActions.contains(NullAction.class)) {
List<NullAction> actions =
- possibleActions.getType(NullAction.class);
+ possibleActions.getType(NullAction.class);
for (NullAction action : actions) {
switch (action.getMode()) {
case NullAction.DONE:
@@ -1634,7 +1635,7 @@ public class ORUIManager implements DialogOwner {
if (possibleActions.contains(GameAction.class)) {
List<GameAction> actions =
- possibleActions.getType(GameAction.class);
+ possibleActions.getType(GameAction.class);
for (GameAction action : actions) {
switch (action.getMode()) {
case GameAction.UNDO:
@@ -1657,7 +1658,7 @@ public class ORUIManager implements DialogOwner {
&& orStep != GameDef.OrStep.LAY_TOKEN) {
List<LayToken> tokenActions =
- possibleActions.getType(LayToken.class);
+ possibleActions.getType(LayToken.class);
for (LayToken tAction : tokenActions) {
if (tAction instanceof LayBaseToken
@@ -1678,14 +1679,14 @@ public class ORUIManager implements DialogOwner {
if (possibleActions.contains(BuyBonusToken.class)) {
List<BuyBonusToken> bonusTokenActions =
- possibleActions.getType(BuyBonusToken.class);
+ possibleActions.getType(BuyBonusToken.class);
for (BuyBonusToken bbt : bonusTokenActions) {
String text =
- LocalText.getText("BuyBonusToken",
- bbt.getName(),
- Bank.format(bbt.getValue()),
- bbt.getSellerName(),
- Bank.format(bbt.getPrice()) );
+ LocalText.getText("BuyBonusToken",
+ bbt.getName(),
+ Bank.format(bbt.getValue()),
+ bbt.getSellerName(),
+ Bank.format(bbt.getPrice()) );
orPanel.addSpecialAction(bbt, text);
}
}
@@ -1747,7 +1748,7 @@ public class ORUIManager implements DialogOwner {
public void setLocalStep(int localStep) {
log.debug("Setting upgrade step to " + localStep + " "
- + ORUIManager.messageKey[localStep]);
+ + ORUIManager.messageKey[localStep]);
this.localStep = localStep;
updateMessage();
@@ -1758,7 +1759,7 @@ public class ORUIManager implements DialogOwner {
if (upgradePanel != null) {
log.debug("Initial localStep is " + localStep + " "
- + ORUIManager.messageKey[localStep]);
+ + ORUIManager.messageKey[localStep]);
...
[truncated message content] |