-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update UI for usability improvements and preparing for swiss (#15)
Signed-off-by: John Burns <[email protected]>
- Loading branch information
1 parent
4f477fa
commit 8a6567e
Showing
25 changed files
with
683 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/github/wakingrufus/eloleague/data/SwissData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.wakingrufus.eloleague.data | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
|
||
data class SwissTeamData( | ||
val id: String, | ||
val name: String, | ||
val playerIds: Set<String>) | ||
|
||
data class SwissGameData(val id: String, | ||
val gameId: String, | ||
val winningTeam: String) | ||
|
||
data class SwissRound(val results: List<SwissResultData>) | ||
|
||
data class SwissResultData(val pairing: SwissPairing, val games: List<SwissGameData>) | ||
|
||
data class SwissPairing(val id: String, | ||
val teamIds: Pair<String, String>) | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class SwissTournamentData(val id: String, | ||
val startTime: Long, | ||
val name: String, | ||
val teams: List<SwissTeamData>, | ||
val rounds: Map<Int, SwissRound>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/kotlin/com/github/wakingrufus/eloleague/game/GameListView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.github.wakingrufus.eloleague.game | ||
|
||
import com.github.wakingrufus.eloleague.league.LeagueModel | ||
import javafx.beans.property.ReadOnlyStringWrapper | ||
import javafx.stage.StageStyle | ||
import mu.KLogging | ||
import tornadofx.* | ||
import java.util.* | ||
|
||
class GameListView : Fragment("Games") { | ||
companion object : KLogging() | ||
|
||
val gameModel: GameModel by inject() | ||
val leagueModel: LeagueModel by inject() | ||
|
||
override val root = fieldset("Games") { | ||
tableview(leagueModel.games) { | ||
column("Time", GameItem::timestamp) | ||
column<GameItem, String>("Team 1") { | ||
ReadOnlyStringWrapper(it.value.team1Players.joinToString(transform = { player -> player.name })) | ||
} | ||
column("Team 1 score", GameItem::team1ScoreProperty) | ||
column<GameItem, String>("Team 2") { | ||
ReadOnlyStringWrapper(it.value.team2Players.joinToString(transform = { player -> player.name })) | ||
} | ||
column("Team 2 score", GameItem::team2ScoreProperty) | ||
bindSelected(gameModel) | ||
columnResizePolicy = SmartResize.POLICY | ||
} | ||
buttonbar { | ||
button("Add Game").setOnAction { | ||
gameModel.rebind { item = GameItem(id = UUID.randomUUID().toString()) } | ||
editGame() | ||
} | ||
button("Edit Game").setOnAction { | ||
editGame() | ||
} | ||
} | ||
} | ||
|
||
private fun editGame() { | ||
find<GameView>().apply { | ||
openModal(stageStyle = StageStyle.UTILITY, block = true) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.