# HG changeset patch # User Jaroslav Tulach # Date 1252158039 -7200 # Node ID 74d333da17254fe9435fc8db035f0ff5abb26fc6 # Parent fd7e8e705b753fc1b213090aad70a77c9066b533 Displaying list of moves diff -r fd7e8e705b75 -r 74d333da1725 freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Fri Sep 04 23:02:23 2009 +0200 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Sat Sep 05 15:40:39 2009 +0200 @@ -10,6 +10,7 @@

${bundle.RELOAD} + ${bundle.ROOT}

<#if message?? > @@ -18,6 +19,7 @@

+ ${bundle.MOVE_WHO} ${doc.game.@currentPlayer} <#if user = doc.game.@currentPlayer >
@@ -66,5 +68,26 @@
${doc.game.board}
+ +

${bundle.MOVES}

+ + + + + + + + + + + <#list doc.game.moves.* as item> + <#if item.@index?number % 2 = 1> + + <#else> + + + + +
${bundle.MOVENUMBER}${doc.game.id.@white}${doc.game.id.@black}
${item.@index}${item.@move}${item.@move}
\ No newline at end of file diff -r fd7e8e705b75 -r 74d333da1725 freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties Fri Sep 04 23:02:23 2009 +0200 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.properties Sat Sep 05 15:40:39 2009 +0200 @@ -5,3 +5,7 @@ V=Vertical RELOAD=Reload GAME=Game +MOVENUMBER=# +MOVES=Moves +ROOT=Home +MOVE_WHO=Who's turn diff -r fd7e8e705b75 -r 74d333da1725 freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties Fri Sep 04 23:02:23 2009 +0200 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game_cs.properties Sat Sep 05 15:40:39 2009 +0200 @@ -5,3 +5,7 @@ V=Vertik\u00E1ln\u011B RELOAD=Obnovit GAME=Hra +MOVENUMBER=Tah +MOVES=Z\u00E1pis +ROOT=Dom\u016F +MOVE_WHO=Na tahu je \ No newline at end of file diff -r fd7e8e705b75 -r 74d333da1725 webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Fri Sep 04 23:02:23 2009 +0200 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/Game.java Sat Sep 05 15:40:39 2009 +0200 @@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -114,27 +115,44 @@ return moves; } - private static final class MoveAdapter extends XmlAdapter> { + @XmlAccessorType(XmlAccessType.FIELD) + private static final class MoveTmp { + @XmlAttribute + String move; + @XmlAttribute + int index; + + private MoveTmp() { + } + + public MoveTmp(String move, int index) { + this.move = move; + this.index = index; + } + } + + private static final class MoveAdapter extends XmlAdapter> { @Override - public List unmarshal(String[] arr) throws Exception { + public List unmarshal(MoveTmp[] arr) throws Exception { List res = new ArrayList(); if (arr != null) { - for (String v : arr) { - res.add(Move.valueOf(v)); + for (MoveTmp v : arr) { + res.add(Move.valueOf(v.move)); } } return res; } @Override - public String[] marshal(List arr) throws Exception { - List res = new ArrayList(); + public MoveTmp[] marshal(List arr) throws Exception { + List res = new ArrayList(); if (arr != null) { + int index = 0; for (Move m : arr) { - res.add(m.toString()); + res.add(new MoveTmp(m.toString(), ++index)); } } - return res.toArray(new String[0]); + return res.toArray(new MoveTmp[0]); } } // end of MoveAdapter