1.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Fri Sep 04 23:02:23 2009 +0200
1.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Sat Sep 05 15:40:39 2009 +0200
1.3 @@ -10,6 +10,7 @@
1.4
1.5 <p>
1.6 <a href="/games/${doc.game.id.@id}">${bundle.RELOAD}</a>
1.7 + <a href="/">${bundle.ROOT}</a>
1.8 </p>
1.9
1.10 <#if message?? >
1.11 @@ -18,6 +19,7 @@
1.12 </p>
1.13 </#if>
1.14
1.15 + ${bundle.MOVE_WHO} ${doc.game.@currentPlayer}
1.16 <#if user = doc.game.@currentPlayer >
1.17 <form action="/games/${doc.game.id.@id}/move">
1.18 <input type="hidden" name="type" value="fence" readonly="readonly"/>
1.19 @@ -66,5 +68,26 @@
1.20 </form>
1.21 </#if>
1.22 <pre>${doc.game.board}</pre>
1.23 +
1.24 + <h3>${bundle.MOVES}</h3>
1.25 +
1.26 + <table border="0">
1.27 + <thead>
1.28 + <tr>
1.29 + <th>${bundle.MOVENUMBER}</th>
1.30 + <th>${doc.game.id.@white}</th>
1.31 + <th>${doc.game.id.@black}</th>
1.32 + </tr>
1.33 + </thead>
1.34 + <tbody>
1.35 + <#list doc.game.moves.* as item>
1.36 + <#if item.@index?number % 2 = 1>
1.37 + <tr><td>${item.@index}</td><td>${item.@move}</td>
1.38 + <#else>
1.39 + <td>${item.@move}</td></tr>
1.40 + </#if>
1.41 + </#list>
1.42 + </tbody>
1.43 + </table>
1.44 </body>
1.45 </html>
1.46 \ No newline at end of file
2.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties Fri Sep 04 23:02:23 2009 +0200
2.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties Sat Sep 05 15:40:39 2009 +0200
2.3 @@ -5,3 +5,7 @@
2.4 V=Vertical
2.5 RELOAD=Reload
2.6 GAME=Game
2.7 +MOVENUMBER=#
2.8 +MOVES=Moves
2.9 +ROOT=Home
2.10 +MOVE_WHO=Who's turn
3.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties Fri Sep 04 23:02:23 2009 +0200
3.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties Sat Sep 05 15:40:39 2009 +0200
3.3 @@ -5,3 +5,7 @@
3.4 V=Vertik\u00E1ln\u011B
3.5 RELOAD=Obnovit
3.6 GAME=Hra
3.7 +MOVENUMBER=Tah
3.8 +MOVES=Z\u00E1pis
3.9 +ROOT=Dom\u016F
3.10 +MOVE_WHO=Na tahu je
3.11 \ No newline at end of file
4.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Fri Sep 04 23:02:23 2009 +0200
4.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Sat Sep 05 15:40:39 2009 +0200
4.3 @@ -36,6 +36,7 @@
4.4 import javax.xml.bind.annotation.XmlAccessorType;
4.5 import javax.xml.bind.annotation.XmlAttribute;
4.6 import javax.xml.bind.annotation.XmlElement;
4.7 +import javax.xml.bind.annotation.XmlElements;
4.8 import javax.xml.bind.annotation.XmlRootElement;
4.9 import javax.xml.bind.annotation.adapters.XmlAdapter;
4.10 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
4.11 @@ -114,27 +115,44 @@
4.12 return moves;
4.13 }
4.14
4.15 - private static final class MoveAdapter extends XmlAdapter<String[],List<Move>> {
4.16 + @XmlAccessorType(XmlAccessType.FIELD)
4.17 + private static final class MoveTmp {
4.18 + @XmlAttribute
4.19 + String move;
4.20 + @XmlAttribute
4.21 + int index;
4.22 +
4.23 + private MoveTmp() {
4.24 + }
4.25 +
4.26 + public MoveTmp(String move, int index) {
4.27 + this.move = move;
4.28 + this.index = index;
4.29 + }
4.30 + }
4.31 +
4.32 + private static final class MoveAdapter extends XmlAdapter<MoveTmp[],List<Move>> {
4.33 @Override
4.34 - public List<Move> unmarshal(String[] arr) throws Exception {
4.35 + public List<Move> unmarshal(MoveTmp[] arr) throws Exception {
4.36 List<Move> res = new ArrayList<Move>();
4.37 if (arr != null) {
4.38 - for (String v : arr) {
4.39 - res.add(Move.valueOf(v));
4.40 + for (MoveTmp v : arr) {
4.41 + res.add(Move.valueOf(v.move));
4.42 }
4.43 }
4.44 return res;
4.45 }
4.46
4.47 @Override
4.48 - public String[] marshal(List<Move> arr) throws Exception {
4.49 - List<String> res = new ArrayList<String>();
4.50 + public MoveTmp[] marshal(List<Move> arr) throws Exception {
4.51 + List<MoveTmp> res = new ArrayList<MoveTmp>();
4.52 if (arr != null) {
4.53 + int index = 0;
4.54 for (Move m : arr) {
4.55 - res.add(m.toString());
4.56 + res.add(new MoveTmp(m.toString(), ++index));
4.57 }
4.58 }
4.59 - return res.toArray(new String[0]);
4.60 + return res.toArray(new MoveTmp[0]);
4.61 }
4.62 } // end of MoveAdapter
4.63