[virtualcommons-svn] commit/foraging: alllee: cleaning up rule selection logic in the UI based on t
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-10-01 08:36:22
|
1 new changeset in foraging: http://bitbucket.org/virtualcommons/foraging/changeset/cc9462716257/ changeset: cc9462716257 user: alllee date: 2011-10-01 10:36:15 summary: cleaning up rule selection logic in the UI based on the enum. affected #: 4 files (-1 bytes) --- a/deploy.bat Fri Sep 30 23:03:42 2011 -0700 +++ b/deploy.bat Sat Oct 01 01:36:15 2011 -0700 @@ -3,6 +3,8 @@ REM executables and library dependencies. REM set JAVA_HOME to the location of the installed JDK (customize as necessary) set ANT_HOME=C:\tools\ant +set M2_HOME=C:\tools\maven set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_26 -set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH% +set PATH=%M2_HOME%\bin;%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH% +mvn clean compile ant clean deploy server --- a/ivysettings.xml Fri Sep 30 23:03:42 2011 -0700 +++ b/ivysettings.xml Sat Oct 01 01:36:15 2011 -0700 @@ -6,7 +6,7 @@ <settings defaultResolver="chain-resolver" /><property name='local-m2-pattern' value='${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision]'/><resolvers> - <chain name='chain-resolver' returnFirst='true'> + <chain name='chain-resolver'><filesystem name='m2' m2compatible='true'><ivy pattern='${local-m2-pattern}.pom' /><artifact pattern='${local-m2-pattern}.[ext]'/> --- a/src/main/java/edu/asu/commons/foraging/event/VoteRuleRequest.java Fri Sep 30 23:03:42 2011 -0700 +++ b/src/main/java/edu/asu/commons/foraging/event/VoteRuleRequest.java Sat Oct 01 01:36:15 2011 -0700 @@ -18,26 +18,20 @@ public class VoteRuleRequest extends AbstractPersistableEvent { private static final long serialVersionUID = 4360213814026474451L; - private int index; private ForagingRule rule; - public VoteRuleRequest(Identifier id, int index, ForagingRule rule) { + public VoteRuleRequest(Identifier id, ForagingRule rule) { super(id, rule.toString()); - this.index = index; this.rule = rule; } - public int getIndex() { - return index; - } - public ForagingRule getRule() { return rule; } @Override public String toString() { - return String.format("%s voted for rule # %s (%s)", id, index, rule); + return String.format("%s voted for rule [%s]", id, rule); } --- a/src/main/java/edu/asu/commons/foraging/ui/VotingForm.java Fri Sep 30 23:03:42 2011 -0700 +++ b/src/main/java/edu/asu/commons/foraging/ui/VotingForm.java Sat Oct 01 01:36:15 2011 -0700 @@ -13,7 +13,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import javax.swing.ButtonModel; @@ -76,7 +75,7 @@ for (ForagingRule rule: rules) { JRadioButton radioButton = new JRadioButton(); - radioButton.setActionCommand(String.valueOf(radioButtons.size())); + radioButton.setActionCommand(rule.name()); radioButtons.add(radioButton); horizontalButtonParallelGroup.addComponent(radioButton); JLabel ruleLabel = new JLabel(String.format("%d. %s", radioButtons.size(), rule)); @@ -102,9 +101,8 @@ JOptionPane.showMessageDialog(VotingForm.this, "Please select a rule."); return; } - String selectedRule = model.getActionCommand(); - int selectedRuleIndex = Integer.parseInt(selectedRule); - client.transmit(new VoteRuleRequest(client.getId(), selectedRuleIndex, ForagingRule.values()[selectedRuleIndex])); + ForagingRule selectedRule = ForagingRule.valueOf(model.getActionCommand()); + client.transmit(new VoteRuleRequest(client.getId(), selectedRule)); } }); return submitButton; Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |