some small fixes and tweaks regarding the property system

This commit is contained in:
jendave
2011-08-06 02:45:46 +00:00
parent 14445163a1
commit 5c6efdf625
8 changed files with 97 additions and 90 deletions

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<java version="1.6.0_11" class="java.beans.XMLDecoder"> <java version="1.6.0_16" class="java.beans.XMLDecoder">
<object id="MultiSplitLayout$Split0" class="org.jdesktop.swingx.MultiSplitLayout$Split"> <object id="MultiSplitLayout$Split0" class="org.jdesktop.swingx.MultiSplitLayout$Split">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>0</int> <int>0</int>
<int>1440</int> <int>1018</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void id="ArrayList0" property="children"> <void id="ArrayList0" property="children">
@@ -17,7 +17,7 @@
<int>0</int> <int>0</int>
<int>0</int> <int>0</int>
<int>242</int> <int>242</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void id="ArrayList1" property="children"> <void id="ArrayList1" property="children">
@@ -28,7 +28,7 @@
<int>0</int> <int>0</int>
<int>0</int> <int>0</int>
<int>242</int> <int>242</int>
<int>145</int> <int>118</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -47,7 +47,7 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>145</int> <int>118</int>
<int>242</int> <int>242</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -62,9 +62,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>155</int> <int>128</int>
<int>242</int> <int>242</int>
<int>171</int> <int>144</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -83,7 +83,7 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>326</int> <int>272</int>
<int>242</int> <int>242</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -98,9 +98,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>336</int> <int>282</int>
<int>242</int> <int>242</int>
<int>115</int> <int>88</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -119,7 +119,7 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>451</int> <int>370</int>
<int>242</int> <int>242</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -134,9 +134,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>461</int> <int>380</int>
<int>242</int> <int>242</int>
<int>107</int> <int>80</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -155,7 +155,7 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>568</int> <int>460</int>
<int>242</int> <int>242</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -170,9 +170,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>0</int> <int>0</int>
<int>578</int> <int>470</int>
<int>242</int> <int>242</int>
<int>249</int> <int>223</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -205,7 +205,7 @@
<int>242</int> <int>242</int>
<int>0</int> <int>0</int>
<int>10</int> <int>10</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void property="parent"> <void property="parent">
@@ -219,8 +219,8 @@
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>0</int> <int>0</int>
<int>906</int> <int>484</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void id="ArrayList2" property="children"> <void id="ArrayList2" property="children">
@@ -230,8 +230,8 @@
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>0</int> <int>0</int>
<int>906</int> <int>484</int>
<int>163</int> <int>136</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -250,8 +250,8 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>163</int> <int>136</int>
<int>906</int> <int>484</int>
<int>10</int> <int>10</int>
</object> </object>
</void> </void>
@@ -265,9 +265,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>173</int> <int>146</int>
<int>906</int> <int>484</int>
<int>166</int> <int>139</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -286,8 +286,8 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>339</int> <int>285</int>
<int>906</int> <int>484</int>
<int>10</int> <int>10</int>
</object> </object>
</void> </void>
@@ -301,9 +301,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>349</int> <int>295</int>
<int>906</int> <int>484</int>
<int>140</int> <int>113</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -322,8 +322,8 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>489</int> <int>408</int>
<int>906</int> <int>484</int>
<int>10</int> <int>10</int>
</object> </object>
</void> </void>
@@ -337,9 +337,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>499</int> <int>418</int>
<int>906</int> <int>484</int>
<int>145</int> <int>118</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -358,8 +358,8 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>644</int> <int>536</int>
<int>906</int> <int>484</int>
<int>10</int> <int>10</int>
</object> </object>
</void> </void>
@@ -373,9 +373,9 @@
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>252</int> <int>252</int>
<int>654</int> <int>546</int>
<int>906</int> <int>484</int>
<int>173</int> <int>147</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -408,10 +408,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider"> <object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>1158</int> <int>736</int>
<int>0</int> <int>0</int>
<int>10</int> <int>10</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void property="parent"> <void property="parent">
@@ -423,10 +423,10 @@
<object id="MultiSplitLayout$Split3" class="org.jdesktop.swingx.MultiSplitLayout$Split"> <object id="MultiSplitLayout$Split3" class="org.jdesktop.swingx.MultiSplitLayout$Split">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>1168</int> <int>746</int>
<int>0</int> <int>0</int>
<int>272</int> <int>272</int>
<int>827</int> <int>693</int>
</object> </object>
</void> </void>
<void id="ArrayList3" property="children"> <void id="ArrayList3" property="children">
@@ -434,10 +434,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf"> <object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>1168</int> <int>746</int>
<int>0</int> <int>0</int>
<int>272</int> <int>272</int>
<int>424</int> <int>357</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">
@@ -455,8 +455,8 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Divider"> <object class="org.jdesktop.swingx.MultiSplitLayout$Divider">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>1168</int> <int>746</int>
<int>424</int> <int>357</int>
<int>272</int> <int>272</int>
<int>10</int> <int>10</int>
</object> </object>
@@ -470,10 +470,10 @@
<object class="org.jdesktop.swingx.MultiSplitLayout$Leaf"> <object class="org.jdesktop.swingx.MultiSplitLayout$Leaf">
<void property="bounds"> <void property="bounds">
<object class="java.awt.Rectangle"> <object class="java.awt.Rectangle">
<int>1168</int> <int>746</int>
<int>434</int> <int>367</int>
<int>272</int> <int>272</int>
<int>393</int> <int>326</int>
</object> </object>
</void> </void>
<void property="name"> <void property="name">

View File

@@ -77,10 +77,10 @@ ErrorViewer/message=Ein Fehler ist aufgetreten. Du kannst diese Nachricht kopier
Bitte melde diese Nachricht, und wie er aufgetreten ist, hier:\n\ Bitte melde diese Nachricht, und wie er aufgetreten ist, hier:\n\
\t%s\n\ \t%s\n\
Falls du keine Konto anlegen willst, schreibe eine Mail an\n\ Falls du keine Konto anlegen willst, schreibe eine Mail an\n\
\t%s\n\n\ \t%s\n\n\n\
%s\n\n\ %s\n\n\n\
Version:\n\ Version:\n\
%s\n\ %s\n\n\
Detaillierter Stapelverlauf:\n Detaillierter Stapelverlauf:\n
ErrorViewer/button/save=Speichern... ErrorViewer/button/save=Speichern...
ErrorViewer/button/close=Schlie<EFBFBD>en ErrorViewer/button/close=Schlie<EFBFBD>en

View File

@@ -77,10 +77,10 @@ ErrorViewer/message=An error has occured. You can copy/paste this message or sav
Please report this, plus what you tried to do, to:\n\ Please report this, plus what you tried to do, to:\n\
\t%s\n\ \t%s\n\
If you don't want to register an account, you can mail it directly to\n\ If you don't want to register an account, you can mail it directly to\n\
\t%s\n\n\ \t%s\n\n\n\
%s\n\n\ %s\n\n\n\
Version:\n\ Version:\n\
%s\n\ %s\n\n\
Detailed error trace:\n Detailed error trace:\n
ErrorViewer/button/save=Save... ErrorViewer/button/save=Save...
ErrorViewer/button/close=Close ErrorViewer/button/close=Close

View File

@@ -1,5 +1,7 @@
package forge; package forge;
import static org.jdesktop.swingx.MultiSplitLayout.*; import static org.jdesktop.swingx.MultiSplitLayout.*;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@@ -123,10 +125,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
HUMAN_GRAVEYARD_ACTION = new ZoneAction(AllZone.Human_Graveyard, HUMAN_GRAVEYARD); HUMAN_GRAVEYARD_ACTION = new ZoneAction(AllZone.Human_Graveyard, HUMAN_GRAVEYARD);
HUMAN_REMOVED_ACTION = new ZoneAction(AllZone.Human_Removed, HUMAN_REMOVED); HUMAN_REMOVED_ACTION = new ZoneAction(AllZone.Human_Removed, HUMAN_REMOVED);
HUMAN_FLASHBACK_ACTION = new ZoneAction(AllZone.Human_Removed, HUMAN_FLASHBACK) { HUMAN_FLASHBACK_ACTION = new ZoneAction(AllZone.Human_Removed, HUMAN_FLASHBACK) {
private static final long serialVersionUID = 8120331222693706164L; private static final long serialVersionUID = 8120331222693706164L;
@Override @Override
protected Card[] getCards() { protected Card[] getCards() {
return CardFactoryUtil.getFlashbackCards(Constant.Player.Human).toArray(); return CardFactoryUtil.getFlashbackCards(Constant.Player.Human).toArray();
} }
@@ -143,10 +145,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
} }
private void addMenu() { private void addMenu() {
Object[] obj = { Object[] obj = {
HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION, COMPUTER_GRAVEYARD_ACTION, HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION, COMPUTER_GRAVEYARD_ACTION,
COMPUTER_REMOVED_ACTION, GuiDisplay3.eotCheckboxForMenu, new JSeparator(), COMPUTER_REMOVED_ACTION, GuiDisplay3.eotCheckboxForMenu, new JSeparator(),
ErrorViewer.ALL_THREADS_ACTION, new JSeparator(), CONCEDE_ACTION}; ErrorViewer.ALL_THREADS_ACTION, new JSeparator(), CONCEDE_ACTION};
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE)); JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
for(Object o:obj) { for(Object o:obj) {
@@ -429,7 +431,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
if(c.getCounters(Counters.AGE) != 0) counterText = counterText + "Age counters: " if(c.getCounters(Counters.AGE) != 0) counterText = counterText + "Age counters: "
+ c.getCounters(Counters.AGE) + "\r\n"; + c.getCounters(Counters.AGE) + "\r\n";
if(c.getCounters(Counters.BLAZE) != 0) counterText = counterText + "Blaze counters: " if(c.getCounters(Counters.BLAZE) != 0) counterText = counterText + "Blaze counters: "
+ c.getCounters(Counters.BLAZE) + "\r\n"; + c.getCounters(Counters.BLAZE) + "\r\n";
if(c.getCounters(Counters.CHARGE) != 0) counterText = counterText + "Charge counters: " if(c.getCounters(Counters.CHARGE) != 0) counterText = counterText + "Charge counters: "
+ c.getCounters(Counters.CHARGE) + "\r\n"; + c.getCounters(Counters.CHARGE) + "\r\n";
if(c.getCounters(Counters.DIVINITY) != 0) counterText = counterText + "Divinity counters: " if(c.getCounters(Counters.DIVINITY) != 0) counterText = counterText + "Divinity counters: "
@@ -459,8 +461,8 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
if (c.getCounters(Counters.M1M1) != 0) if (c.getCounters(Counters.M1M1) != 0)
counterText = counterText + "-1/-1 counters: " + c.getCounters(Counters.M1M1) + "\r\n"; counterText = counterText + "-1/-1 counters: " + c.getCounters(Counters.M1M1) + "\r\n";
*/ */
if(c.getCounters(Counters.QUEST) != 0) if(c.getCounters(Counters.QUEST) != 0) counterText = counterText + "Quest counters: "
counterText = counterText + "Quest counters: " + c.getCounters(Counters.QUEST) + "\r\n"; + c.getCounters(Counters.QUEST) + "\r\n";
if(c.getCounters(Counters.SPORE) != 0) counterText = counterText + "Spore counters: " if(c.getCounters(Counters.SPORE) != 0) counterText = counterText + "Spore counters: "
+ c.getCounters(Counters.SPORE) + "\r\n"; + c.getCounters(Counters.SPORE) + "\r\n";
@@ -693,7 +695,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
private void initComponents() { private void initComponents() {
//Preparing the Frame //Preparing the Frame
setTitle(ForgeProps.getProperty(LANG.PROGRAM_NAME)); setTitle(ForgeProps.getLocalized(LANG.PROGRAM_NAME));
setFont(new Font("Times New Roman", 0, 16)); setFont(new Font("Times New Roman", 0, 16));
getContentPane().setLayout(new BorderLayout()); getContentPane().setLayout(new BorderLayout());
addWindowListener(new WindowAdapter() { addWindowListener(new WindowAdapter() {
@@ -1102,9 +1104,9 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
JLabel playerRemovedValue = new JLabel(); JLabel playerRemovedValue = new JLabel();
private class ZoneAction extends ForgeAction { private class ZoneAction extends ForgeAction {
private static final long serialVersionUID = -5822976087772388839L; private static final long serialVersionUID = -5822976087772388839L;
private PlayerZone zone; private PlayerZone zone;
private String title; private String title;
public ZoneAction(PlayerZone zone, String property) { public ZoneAction(PlayerZone zone, String property) {
super(property); super(property);
@@ -1123,6 +1125,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
if(choice != null) doAction(choice); if(choice != null) doAction(choice);
} }
} }
/* /*
protected PlayerZone getZone() { protected PlayerZone getZone() {
return zone; return zone;
@@ -1136,10 +1139,10 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
} }
private class ConcedeAction extends ForgeAction { private class ConcedeAction extends ForgeAction {
private static final long serialVersionUID = -6976695235601916762L; private static final long serialVersionUID = -6976695235601916762L;
public ConcedeAction() { public ConcedeAction() {
super(CONCEDE); super(CONCEDE);
} }

View File

@@ -106,7 +106,6 @@ public class Gui_NewGame extends JFrame implements NewConstants, NewConstants.LA
"ComboBox.background", "MenuItem.background", "JCheckBoxMenuItem.background", "ComboBox.background", "MenuItem.background", "JCheckBoxMenuItem.background",
"Dialog.background", "OptionPane.background", "ScrollBar.background"}; "Dialog.background", "OptionPane.background", "ScrollBar.background"};
for(int i = 0; i < properties.length; i++) { for(int i = 0; i < properties.length; i++) {
//UIManager.put(properties, background);
UIManager.put(properties[i], background); UIManager.put(properties[i], background);
} }
} }

View File

@@ -47,6 +47,7 @@ public class NewDeckIO implements DeckIO {
} }
public NewDeckIO(File dir) { public NewDeckIO(File dir) {
if(dir == null) throw new IllegalArgumentException("No deck directory specified");
try { try {
this.dir = dir; this.dir = dir;

View File

@@ -125,8 +125,8 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
if(message != null) System.err.println(message); if(message != null) System.err.println(message);
ex.printStackTrace(); ex.printStackTrace();
pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL), getProperty(VERSION), pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL),
message != null? message:ex.getMessage()); message != null? message:ex.getMessage(), getProperty(VERSION));
ex.printStackTrace(pw); ex.printStackTrace(pw);
} }
@@ -136,7 +136,7 @@ public class ErrorViewer implements NewConstants, NewConstants.LANG.ErrorViewer
private static void printError(PrintWriter pw, String message) { private static void printError(PrintWriter pw, String message) {
System.err.println(message); System.err.println(message);
pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL), getProperty(VERSION), message); pw.printf(getLocalized(MESSAGE), getProperty(FORUM), getProperty(MAIL), message, getProperty(VERSION));
Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces(); Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
for(Entry<Thread, StackTraceElement[]> e:traces.entrySet()) { for(Entry<Thread, StackTraceElement[]> e:traces.entrySet()) {
pw.println(); pw.println();

View File

@@ -260,7 +260,7 @@ public class TreeProperties implements Iterable<PropertyElement> {
* Returns a property of the given type. This does not work to retrieve tree properties. * Returns a property of the given type. This does not work to retrieve tree properties.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T getProperty(String key, Class<T> cls) { public <T> T getProperty(String key, Class<T> cls) {
String suffix; String suffix;
if(cls == String.class) suffix = ""; if(cls == String.class) suffix = "";
else { else {
@@ -303,6 +303,10 @@ public class TreeProperties implements Iterable<PropertyElement> {
return result; return result;
} }
} }
Exception ex=
new Exception("TreeProperties returns null for " + key + suffix);
// ex.printStackTrace();
System.err.println(ex);
return null; return null;
} }
@@ -330,7 +334,7 @@ public class TreeProperties implements Iterable<PropertyElement> {
} }
//After this call, the next element is determined, or the child iterator has next //After this call, the next element is determined, or the child iterator has next
public boolean hasNext() { public boolean hasNext() {
if(next != null) return true; if(next != null) return true;
else if(child != null && child.hasNext()) return true; else if(child != null && child.hasNext()) return true;
@@ -356,29 +360,29 @@ public class TreeProperties implements Iterable<PropertyElement> {
cls = t.getType(); cls = t.getType();
} }
next = new PropertyElement() { next = new PropertyElement() {
public String getKey() { public String getKey() {
return prefix + parts[0]; return prefix + parts[0];
} }
public Class<?> getType() { public Class<?> getType() {
return cls; return cls;
} }
public Object getValue() { public Object getValue() {
return value; return value;
} }
public void setValue(String value) {} public void setValue(String value) {}
}; };
return true; return true;
} else return false; } else return false;
} }
public PropertyElement next() { public PropertyElement next() {
if(!hasNext()) throw new NoSuchElementException(); if(!hasNext()) throw new NoSuchElementException();
else if(next != null) { else if(next != null) {
@@ -388,7 +392,7 @@ public class TreeProperties implements Iterable<PropertyElement> {
} else return child.next(); } else return child.next();
} }
public void remove() { public void remove() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }