|
|
@ -5,6 +5,7 @@ import com.example.application.data.entity.Player; |
|
|
|
import com.example.application.data.service.MatchdayService; |
|
|
|
import com.example.application.data.service.PlayerService; |
|
|
|
import com.example.application.data.service.SeasonService; |
|
|
|
import com.example.application.utils.StringUtils; |
|
|
|
import com.example.application.views.abstractnavigation.SeasonAndMatchdayNavigationView; |
|
|
|
import com.example.application.views.main.MainView; |
|
|
|
import com.vaadin.flow.component.dependency.CssImport; |
|
|
@ -116,21 +117,12 @@ public class TableView extends SeasonAndMatchdayNavigationView { |
|
|
|
.setTextAlign(ColumnTextAlign.CENTER) |
|
|
|
.setWidth("3em"); |
|
|
|
|
|
|
|
getGrid().addColumn((ValueProvider<PlayerForTable, String>) playerForTable -> { |
|
|
|
//noinspection CodeBlock2Expr |
|
|
|
return playerForTable.getGamePointsForSelf().toString().replace(".0", "") // TODO: make this reusable |
|
|
|
+ " : " |
|
|
|
+ playerForTable.getGamePointsForOpponents().toString().replace(".0", ""); |
|
|
|
}) |
|
|
|
getGrid().addColumn((ValueProvider<PlayerForTable, String>) this::getResultString) |
|
|
|
.setHeader(headerGames) |
|
|
|
.setTextAlign(ColumnTextAlign.CENTER) |
|
|
|
.setWidth("6em"); |
|
|
|
|
|
|
|
getGrid().addColumn((ValueProvider<PlayerForTable, String>) playerForTable -> { |
|
|
|
Double diff = playerForTable.getGamePointDiff(); |
|
|
|
String diffString = playerForTable.getGamePointDiff().toString().replace(".0", ""); |
|
|
|
return diff > 0 ? "+" + diffString : diffString; |
|
|
|
}) |
|
|
|
getGrid().addColumn((ValueProvider<PlayerForTable, String>) player -> StringUtils.getSignedString(player.getGamePointDiff())) |
|
|
|
.setHeader(headerDiff) |
|
|
|
.setTextAlign(ColumnTextAlign.CENTER) |
|
|
|
.setWidth("5em"); |
|
|
@ -140,6 +132,10 @@ public class TableView extends SeasonAndMatchdayNavigationView { |
|
|
|
getGrid().addClassName("my_grid"); |
|
|
|
} |
|
|
|
|
|
|
|
private String getResultString(PlayerForTable player) { |
|
|
|
return StringUtils.getResultString(player.getGamePointsForSelf(), player.getGamePointsForOpponents()); |
|
|
|
} |
|
|
|
|
|
|
|
///////////// |
|
|
|
// CONTENT // |
|
|
|
///////////// |
|
|
|