diff --git a/pom.xml b/pom.xml index 1df143b..85d45c0 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ poker-calculator war poker-calculator - 1.0.0 + 1.1.0 diff --git a/src/main/java/ch/evolutionsoft/poker/calculator/model/Calculator.java b/src/main/java/ch/evolutionsoft/poker/calculator/model/Calculator.java index cb6391f..8f6e4ef 100644 --- a/src/main/java/ch/evolutionsoft/poker/calculator/model/Calculator.java +++ b/src/main/java/ch/evolutionsoft/poker/calculator/model/Calculator.java @@ -252,7 +252,7 @@ public void removeBoardCard() { public void addPlayer() { if (this.hands.size() < MAX_PLAYER_SIZE) { - this.hands.add(new PlayerHand(this.numberOfHoleCards)); + this.hands.add(new PlayerHand(this, this.numberOfHoleCards)); } } @@ -578,8 +578,8 @@ public boolean containsCard(String value) { void initPlayers() { this.hands = new LinkedList<>(); - this.hands.add(new PlayerHand(this.numberOfHoleCards)); - this.hands.add(new PlayerHand(this.numberOfHoleCards)); + this.hands.add(new PlayerHand(this, this.numberOfHoleCards)); + this.hands.add(new PlayerHand(this, this.numberOfHoleCards)); } void initBoard() { @@ -589,6 +589,7 @@ void initBoard() { for (Card card : this.board.getCards()) { card.setValue(null); + card.setCalculator(this); } } diff --git a/src/main/java/ch/evolutionsoft/poker/calculator/model/Card.java b/src/main/java/ch/evolutionsoft/poker/calculator/model/Card.java index f7dcac4..73f6f69 100644 --- a/src/main/java/ch/evolutionsoft/poker/calculator/model/Card.java +++ b/src/main/java/ch/evolutionsoft/poker/calculator/model/Card.java @@ -21,7 +21,7 @@ public class Card implements Serializable { private static final String[] ranks = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K" }; private static final String[] suits = { "s", "h", "d", "c" }; - + private static Map validCards; static { @@ -34,8 +34,11 @@ public class Card implements Serializable { } } } + public static final String EMPTY_IMAGE_PATH = "images/emptycard.png"; + private Calculator calculator; + private String value; private String imagePath = EMPTY_IMAGE_PATH; @@ -54,7 +57,10 @@ public String getLowerCaseValue() { public void valueChange(ValueChangeEvent valueChangeEvent) { - this.setValue(String.valueOf(valueChangeEvent.getNewValue())); + String cardValue = String.valueOf(valueChangeEvent.getNewValue()); + this.setValue(cardValue); + + calculator.updateCardPaths(); } public void setValue(String value) { @@ -183,4 +189,12 @@ public int hashCode() { return 0; } + + public Calculator getCalculator() { + return calculator; + } + + public void setCalculator(Calculator calculator) { + this.calculator = calculator; + } } diff --git a/src/main/java/ch/evolutionsoft/poker/calculator/model/PlayerHand.java b/src/main/java/ch/evolutionsoft/poker/calculator/model/PlayerHand.java index a106768..492c74a 100644 --- a/src/main/java/ch/evolutionsoft/poker/calculator/model/PlayerHand.java +++ b/src/main/java/ch/evolutionsoft/poker/calculator/model/PlayerHand.java @@ -10,11 +10,12 @@ public class PlayerHand implements Serializable{ private Card[] hand; - public PlayerHand(int numberOfHoleCards) { + public PlayerHand(Calculator calculator, int numberOfHoleCards) { this.hand = new Card[numberOfHoleCards]; for (int index = 0; index < this.hand.length; index++) { this.hand[index] = new Card(); + this.hand[index].setCalculator(calculator); } } diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties index 6e282b9..4a597c2 100644 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -1,12 +1,12 @@ name=poker-calculator module-group-id=poker-calculator -module-incremental-version=1 +module-incremental-version=2 tags=Poker,texas hold'em,omaha hi,omaha hi/lo,calculator short-description=Poker Calculator long-description=Poker Calculator supports calculating poker odds for Omaha Hi, Omaha Hi/Lo and Texas Hold'em. change-log= -page-url=http://evolution-soft.ch +page-url=https://evolution-soft.ch author=EvolutionSoft licenses=LGPL speed-filters-enabled=false -Bundle-Version=1.0.0 +Bundle-Version=1.1.0 diff --git a/src/main/webapp/WEB-INF/resources/css/portlet-override.css b/src/main/webapp/WEB-INF/resources/css/portlet-override.css index 1b0931e..c3b71bf 100644 --- a/src/main/webapp/WEB-INF/resources/css/portlet-override.css +++ b/src/main/webapp/WEB-INF/resources/css/portlet-override.css @@ -7,10 +7,16 @@ } .bigCardImage { - width: 90%; + width: 100%; } .smallCardImage { width: 40px; margin: 2px 2px; } + +@media screen and (max-width: 768px) { + + .content-desktop {display: none;} + +} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/input.xhtml b/src/main/webapp/WEB-INF/views/input.xhtml index 7198bc1..4f23573 100644 --- a/src/main/webapp/WEB-INF/views/input.xhtml +++ b/src/main/webapp/WEB-INF/views/input.xhtml @@ -9,6 +9,7 @@ + @@ -17,11 +18,11 @@ - + tabindex="#{(playerStatus.index + 1) * 4 + cardStatus.index}" + styleClass="content-desktop"> @@ -31,6 +32,7 @@ + @@ -38,11 +40,11 @@ - + tabindex="#{100 + boardStatus.index}" + styleClass="content-desktop">