Fixed errors due to Game rewrite

* Added a `resources` target to the build to seperate copying needed resources
  to the build folder from actually building the jar.
* Fixed a bug in PlayerListCellRenderer (property access on the wrong object).
* Fixed several bugs in ProfessionalPickup related to team references. The old
  system used integers, 1 or 2, to represent teams. New system uses Game.Team
  enums.
* Fixed a bug in the config loading code. Was trying to wrap an InputStream in a
  `withInputStream` method. Method is actually called `withStrem`
This commit is contained in:
Jonathan Bernard 2012-10-11 22:34:59 -05:00
parent b3e09493f4
commit 4c915b33f5
4 changed files with 18 additions and 15 deletions

View File

@ -45,11 +45,14 @@
</propertyfile>
</target>
<target name="build" depends="compile,increment-build-number">
<target name="resources" depends="init">
<copy todir="${build.dir}/classes">
<fileset dir="${resources.dir}"/>
</copy>
</target>
<target name="build" depends="compile,resources,increment-build-number">
<unjar dest="${build.dir}/classes">
<fileset dir="${env.GROOVY_HOME}/embeddable">
<include name="*.jar"/>

View File

@ -1,7 +1,7 @@
#Sun, 29 Aug 2010 22:59:56 -0500
#Thu, 11 Oct 2012 22:22:39 -0500
#Mon Jul 05 23:10:39 CDT 2010
app.version=0.4.0
build.number=36
build.number=45
src.dir=src
lib.dir=lib
build.dir=build

View File

@ -58,7 +58,7 @@ public class PlayerListCellRenderer extends JPanel implements ListCellRenderer {
else setBorder(emptyBorder)
if (showStats) {
def odds = teamMaker.oddsCalculator.odds[(value)]
def odds = teamMaker.model.oddsCalculator.odds[(value)]
odds = odds ? Math.round(odds * 100) : "?"
statsLabel.text = "${value.gamesSat} (${odds}%)"
}

View File

@ -161,7 +161,7 @@ public class ProfessionalPickup {
constraints: gbc(gridx: 0, gridy: 2, anchor:
GBC.CENTER, insets: [5, 5, 5, 0]),
enabled: bind { model.inGame },
actionPerformed: { declareLoser(2)})
actionPerformed: { declareLoser(TEAM2)})
view.team2List = list(cellRenderer: teamListRenderer,
constraints: gbc(gridx: 1, gridy: 1, fill: GBC.BOTH,
@ -176,7 +176,7 @@ public class ProfessionalPickup {
constraints: gbc(gridx: 1, gridy: 2,
anchor: GBC.CENTER, insets: [5, 5, 5, 5]),
enabled: bind { model.inGame },
actionPerformed: { declareLoser(1)} )
actionPerformed: { declareLoser(TEAM1)} )
}
@ -193,7 +193,8 @@ public class ProfessionalPickup {
})
}
button('Next Game', constraints: gbc(gridx: 0, gridy: 1,
view.newGameButton = button('Next Game',
constraints: gbc(gridx: 0, gridy: 1,
anchor: GBC.CENTER, insets: [5, 5, 5, 0]),
enabled: bind { !model.inGame},
actionPerformed: { newGame() })
@ -202,13 +203,12 @@ public class ProfessionalPickup {
anchor: GBC.CENTER, insets: [5, 5, 5, 0]),
actionPerformed: { addPlayer() })
view.newGameButton = button('Delete Player',
button('Delete Player',
constraints: gbc(gridx: 2, gridy: 1, anchor: GBC.CENTER,
insets: [5, 5, 5, 5]),
actionPerformed: {
model.sittingPlayers.remove(view.sittingList.selectedValues)
refreshGUI() })
}
}
@ -232,7 +232,7 @@ public class ProfessionalPickup {
'.teammakerrc')
if (!teammakerrc.exists())
getClass().getResourceAsStream('/default-teammakerrc')
.withInputStream { is -> teammakerrc.text = is.text }
.withStream { is -> teammakerrc.text = is.text }
// load config
teammakerrc.withInputStream { model.config.load(it) }
@ -282,10 +282,10 @@ public class ProfessionalPickup {
private void newGame() {
if (model.team1Players.size() < model.teamSize)
populate(1)
populate(TEAM1)
if (model.team2Players.size() < model.teamSize)
populate(2)
populate(TEAM2)
recalculateOdds()
@ -418,12 +418,12 @@ public class ProfessionalPickup {
}
private List playersForTeam(Game.Team team) {
if (team == Game.Team.TEAM1) return model.team1Players
if (team == TEAM1) return model.team1Players
else return model.team2Players
}
private List listForTeam(Game.Team team) {
if (team == Game.Team.TEAM11) return view.team1List
if (team == TEAM1) return view.team1List
else return view.team2List
}
}