use constants to show Tabber tabs instead of just using raw numbers everywhere.

This commit is contained in:
slapshot5
2012-01-01 02:18:03 +00:00
parent dac4d10ba4
commit 5151d222da
3 changed files with 23 additions and 12 deletions

View File

@@ -147,7 +147,7 @@ public class ControlMatchUI {
final Action actShowConsole = new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
ControlMatchUI.this.view.getTabberController().showPnlConsole();
ControlMatchUI.this.view.getTabberController().showPnlGameLog();
}
};

View File

@@ -40,6 +40,17 @@ public class ControlTabber extends MyObservable {
private Observer stackObserver, logObserver;
/** */
public static final int STACK_PANEL = 0;
/** */
public static final int COMBAT_PANEL = 1;
/** */
public static final int LOG_PANEL = 2;
/** */
public static final int PLAYERS_PANEL = 3;
/** */
public static final int DEV_PANEL = 4;
/**
* Controls the vertical tabber in sidebar used for viewing gameplay data:
* stack, combat, etc.
@@ -168,7 +179,7 @@ public class ControlTabber extends MyObservable {
* Programatically forces card layout of sidebar tabber to show "Dev" panel.
*/
public void showPnlDev() {
this.view.getVtpTabber().showTab(4);
this.view.getVtpTabber().showTab(DEV_PANEL);
}
/**
@@ -176,15 +187,15 @@ public class ControlTabber extends MyObservable {
* panel.
*/
public void showPnlPlayers() {
this.view.getVtpTabber().showTab(3);
this.view.getVtpTabber().showTab(PLAYERS_PANEL);
}
/**
* Programatically forces card layout of sidebar tabber to show "Console"
* Programatically forces card layout of sidebar tabber to show "Log"
* panel.
*/
public void showPnlConsole() {
this.view.getVtpTabber().showTab(2);
public void showPnlGameLog() {
this.view.getVtpTabber().showTab(LOG_PANEL);
}
/**
@@ -192,7 +203,7 @@ public class ControlTabber extends MyObservable {
* panel.
*/
public void showPnlCombat() {
this.view.getVtpTabber().showTab(1);
this.view.getVtpTabber().showTab(COMBAT_PANEL);
}
/**
@@ -200,7 +211,7 @@ public class ControlTabber extends MyObservable {
* panel.
*/
public void showPnlStack() {
this.view.getVtpTabber().showTab(0);
this.view.getVtpTabber().showTab(STACK_PANEL);
}
/** Simple method that inits the mouse adapters for listeners,

View File

@@ -228,9 +228,9 @@ public class ViewTabber extends FRoundedPanel {
String txt, isOptional;
this.pnlStack.removeAll();
this.vtpTabber.showTab(0);
this.control.showPnlStack();
this.vtpTabber.getAllVTabs().get(0).setText("Stack : " + stack.size());
this.vtpTabber.getAllVTabs().get(ControlTabber.STACK_PANEL).setText("Stack : " + stack.size());
//final Border border = new LineBorder(this.skin.getClrBorders(), 1);
final Border border = new EmptyBorder(5, 5, 5, 5);
@@ -342,11 +342,11 @@ public class ViewTabber extends FRoundedPanel {
// Doublestrike 06-11-11
public void updateCombat(final String s) {
this.pnlCombat.removeAll();
this.vtpTabber.showTab(1);
this.control.showPnlCombat();
final Border border = new MatteBorder(0, 0, 0, 0, skin.getColor("borders"));
this.vtpTabber.getAllVTabs().get(1).setText("Combat : " + AllZone.getCombat().getAttackers().length);
this.vtpTabber.getAllVTabs().get(ControlTabber.COMBAT_PANEL).setText("Combat : " + AllZone.getCombat().getAttackers().length);
final JTextArea tar = new JTextArea(s);
tar.setOpaque(false);