diff --git a/launch/owlcms h2 no reset.launch b/launch/owlcms h2 no reset.launch index 3f1b44248..8f9bf9cb7 100644 --- a/launch/owlcms h2 no reset.launch +++ b/launch/owlcms h2 no reset.launch @@ -41,5 +41,5 @@ - + diff --git a/owlcms/frontend/components/Results.js b/owlcms/frontend/components/Results.js index 4cf1e1519..98e4533d1 100644 --- a/owlcms/frontend/components/Results.js +++ b/owlcms/frontend/components/Results.js @@ -114,7 +114,8 @@ class Results extends LitElement {
-
${item?.teamName} +
+
${item?.teamName}
@@ -189,7 +190,9 @@ class Results extends LitElement {
${item?.custom2}
-
${item?.teamName}
+
+
${item?.teamName}
+
${(item?.sattempts ?? []).map( diff --git a/owlcms/frontend/components/ResultsLeadersRanks.js b/owlcms/frontend/components/ResultsLeadersRanks.js index 17588bd8f..7be6e72d6 100644 --- a/owlcms/frontend/components/ResultsLeadersRanks.js +++ b/owlcms/frontend/components/ResultsLeadersRanks.js @@ -154,7 +154,8 @@ class ResultsFull extends LitElement {
-
${item?.teamName} +
+
${item?.teamName}
@@ -238,7 +239,9 @@ class ResultsFull extends LitElement {
${item?.custom2}
-
${item?.teamName}
+
+
${item?.teamName}
+
${(item?.sattempts ?? []).map( diff --git a/owlcms/frontend/components/ResultsMedals.js b/owlcms/frontend/components/ResultsMedals.js index 27416ac26..2d7f56fb7 100644 --- a/owlcms/frontend/components/ResultsMedals.js +++ b/owlcms/frontend/components/ResultsMedals.js @@ -51,12 +51,13 @@ class ResultsMedals extends LitElement { ${this.medalCategories ? html` - + > --> +
${(this.medalCategories ?? []).map( (mc) => html` @@ -111,7 +112,9 @@ class ResultsMedals extends LitElement { ${(leader.sattempts ?? []).map( @@ -266,17 +269,14 @@ class ResultsMedals extends LitElement { athleteClasses() { //return "results " + (this.noLiftRanks ?? "") + " " + (this.noBest ?? "") - return "results " + return "results medals " + (this.showLiftRanks ? "" : " noranks") + (this.showBest ? "" : " nobest") + (this.showSinclair ? " sinclair" : " nosinclair"); } athleteStyles() { - return (this.mode === "WAIT" ? "display: none" : "display:grid") - + "; --top: calc(" + (this.resultLines ?? "") + " + 1)" - + "; --bottom: " + (this.leaderLines ?? "") - + "; --nbRanks: " + (this.nbRanks ?? "") + return "display:grid" + "; " + (this.leadersLineHeight ?? "") + "; " + (this.twOverride ?? ""); } diff --git a/owlcms/src/main/java/app/owlcms/components/GroupSelectionMenu.java b/owlcms/src/main/java/app/owlcms/components/GroupSelectionMenu.java index e22a38d6a..67ca0ec8d 100644 --- a/owlcms/src/main/java/app/owlcms/components/GroupSelectionMenu.java +++ b/owlcms/src/main/java/app/owlcms/components/GroupSelectionMenu.java @@ -27,7 +27,7 @@ public class GroupSelectionMenu extends MenuBar { static Icon xIcon; Logger logger = (Logger) LoggerFactory.getLogger(GroupSelectionMenu.class); { - xIcon = new Icon(VaadinIcon.CLOSE); + xIcon = new Icon(VaadinIcon.CLOSE_SMALL); xIcon.getElement().setAttribute("style", "margin: 0px; padding: 0px"); } diff --git a/owlcms/src/main/java/app/owlcms/displays/scoreboard/Results.java b/owlcms/src/main/java/app/owlcms/displays/scoreboard/Results.java index c4a3f3db7..537df4f43 100644 --- a/owlcms/src/main/java/app/owlcms/displays/scoreboard/Results.java +++ b/owlcms/src/main/java/app/owlcms/displays/scoreboard/Results.java @@ -396,6 +396,7 @@ public void setRecordsDisplay(boolean b) { @Override public final void setRouteParameter(String routeParameter) { + logger.warn("setting routeParameter = {}",routeParameter); this.routeParameter = routeParameter; } @@ -446,8 +447,12 @@ final public void setUrlParameterMap(Map> parametersMap) { this.urlParameterMap = parametersMap; } + /** + * @see app.owlcms.apputils.queryparameters.DisplayParameters#setVideo(boolean) + */ @Override public void setVideo(boolean b) { + logger.warn("setVideo {} from {}", b, LoggerUtils.whereFrom()); this.video = b; } diff --git a/owlcms/src/main/java/app/owlcms/displays/scoreboard/ResultsMedals.java b/owlcms/src/main/java/app/owlcms/displays/scoreboard/ResultsMedals.java index 0a8ca0ada..8a8ca9cea 100644 --- a/owlcms/src/main/java/app/owlcms/displays/scoreboard/ResultsMedals.java +++ b/owlcms/src/main/java/app/owlcms/displays/scoreboard/ResultsMedals.java @@ -21,9 +21,7 @@ import com.google.common.eventbus.Subscribe; import com.vaadin.flow.component.AttachEvent; import com.vaadin.flow.component.Tag; -import com.vaadin.flow.component.UI; import com.vaadin.flow.component.dependency.JsModule; -import com.vaadin.flow.function.SerializableConsumer; import app.owlcms.apputils.SoundUtils; import app.owlcms.apputils.queryparameters.DisplayParameters; @@ -45,7 +43,6 @@ import app.owlcms.nui.lifting.UIEventProcessor; import app.owlcms.uievents.CeremonyType; import app.owlcms.uievents.UIEvent; -import app.owlcms.uievents.UIEvent.LiftingOrderUpdated; import app.owlcms.utils.URLUtils; import ch.qos.logback.classic.Logger; import elemental.json.Json; @@ -162,14 +159,6 @@ public void setCategory(Category category) { public void setSilenced(boolean silent) { } - /** - * @see app.owlcms.apputils.queryparameters.DisplayParameters#setTeamWidth(java.lang.Double) - */ - @Override - public void setTeamWidth(Double teamWidth) { - pushTeamWidth(); - } - @Override public void setVideo(boolean video) { } @@ -253,13 +242,13 @@ public void slaveStartLifting(UIEvent.StartLifting e) { setDisplay(); // If this page was opened in replacement of a display, go back to the display. unregister(this, uiEventBus); - retrieveFromSessionStorage("pageURL", result -> { - if (result != null && !result.isBlank()) { - UI.getCurrent().getPage().setLocation(result); - } else { - this.getElement().callJsFunction("reset"); - } - }); +// retrieveFromSessionStorage("pageURL", result -> { +// if (result != null && !result.isBlank()) { +// UI.getCurrent().getPage().setLocation(result); +// } else { +// this.getElement().callJsFunction("reset"); +// } +// }); }); } @@ -291,20 +280,20 @@ protected void doEmpty() { protected void doUpdate(UIEvent e) { // logger.trace("---------- doUpdate {} {} {}", e != null ? // e.getClass().getSimpleName() : "no event"); - boolean leaveTopAlone = false; - if (e instanceof UIEvent.LiftingOrderUpdated) { - LiftingOrderUpdated e2 = (UIEvent.LiftingOrderUpdated) e; - if (e2.isInBreak()) { - leaveTopAlone = !e2.isDisplayToggle(); - } else { - leaveTopAlone = !e2.isCurrentDisplayAffected(); - } - } + //boolean leaveTopAlone = false; +// if (e instanceof UIEvent.LiftingOrderUpdated) { +// LiftingOrderUpdated e2 = (UIEvent.LiftingOrderUpdated) e; +// if (e2.isInBreak()) { +// leaveTopAlone = !e2.isDisplayToggle(); +// } else { +// leaveTopAlone = !e2.isCurrentDisplayAffected(); +// } +// } FieldOfPlay fop = OwlcmsSession.getFop(); - if (!leaveTopAlone) { - this.getElement().callJsFunction("reset"); - } +// if (!leaveTopAlone) { +// this.getElement().callJsFunction("reset"); +// } logger.debug("updating bottom"); updateBottom(null, fop); } @@ -668,10 +657,10 @@ private boolean isMedalist(Athlete a) { return false; } - private void retrieveFromSessionStorage(String key, SerializableConsumer resultHandler) { - getElement().executeJs("return window.sessionStorage.getItem($0);", key) - .then(String.class, resultHandler); - } +// private void retrieveFromSessionStorage(String key, SerializableConsumer resultHandler) { +// getElement().executeJs("return window.sessionStorage.getItem($0);", key) +// .then(String.class, resultHandler); +// } private void setDisplay() { OwlcmsSession.withFop(fop -> { diff --git a/owlcms/src/main/java/app/owlcms/displays/video/VideoCSSOverride.java b/owlcms/src/main/java/app/owlcms/displays/video/VideoCSSOverride.java index 790842248..b9af47298 100644 --- a/owlcms/src/main/java/app/owlcms/displays/video/VideoCSSOverride.java +++ b/owlcms/src/main/java/app/owlcms/displays/video/VideoCSSOverride.java @@ -2,11 +2,14 @@ import java.io.FileNotFoundException; +import org.slf4j.LoggerFactory; + import com.vaadin.flow.component.Component; import com.vaadin.flow.dom.Element; import app.owlcms.data.config.Config; import app.owlcms.utils.ResourceWalker; +import ch.qos.logback.classic.Logger; public interface VideoCSSOverride { @@ -15,14 +18,18 @@ public interface VideoCSSOverride { public boolean isVideo(); public default void checkVideo(String cssPath, String routeParameter, Component component) { + Logger logger = (Logger)LoggerFactory.getLogger(VideoCSSOverride.class); try { - setVideo(routeParameter != null && routeParameter.contentEquals("video")); + boolean b = routeParameter != null && routeParameter.contentEquals("video"); + setVideo(b); + logger.warn("checking video {} {}", routeParameter, b); // use video override if /video is in the URL and the override stylesheet exists. ResourceWalker.getFileOrResourcePath(cssPath); Element element = component.getElement(); element.setProperty("stylesDir", Config.getCurrent().getParamStylesDir()); element.setProperty("video", routeParameter != null ? routeParameter + "/" : ""); } catch (FileNotFoundException e) { + logger.warn("not video!"); } } } diff --git a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicNoLeadersPage.java b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicNoLeadersPage.java index 4fc6faf53..71e8f4d43 100644 --- a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicNoLeadersPage.java +++ b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicNoLeadersPage.java @@ -4,14 +4,12 @@ import org.slf4j.LoggerFactory; -import com.vaadin.flow.component.UI; import com.vaadin.flow.router.QueryParameters; import com.vaadin.flow.router.Route; import app.owlcms.apputils.queryparameters.DisplayParameters; import app.owlcms.apputils.queryparameters.SoundParameters; import app.owlcms.data.config.Config; -import app.owlcms.displays.scoreboard.Results; import app.owlcms.init.OwlcmsSession; import ch.qos.logback.classic.Logger; @@ -22,6 +20,12 @@ public class PublicNoLeadersPage extends PublicScoreboardPage { Logger logger = (Logger) LoggerFactory.getLogger(PublicNoLeadersPage.class); + /** + * To avoid components being injected more than once, the initialization work + * is done in an init() method that is overridden as required. + * + * @see PublicScoreboardPage#init() + */ public PublicNoLeadersPage() { // intentionally empty. superclass will call init() as required. } @@ -32,13 +36,7 @@ public String getPageTitle() { } @Override - protected void init() { - // only difference is the default values - var board = new Results(); - this.setBoard(board); - this.addComponent(board); - this.ui = UI.getCurrent(); - + public void setDefaultParameters() { // when navigating to the page, Vaadin will call setParameter+readParameters // these parameters will be applied. setDefaultParameters(QueryParameters.simple(Map.of( diff --git a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicRankingOrderPage.java b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicRankingOrderPage.java index b7781b879..b49709709 100644 --- a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicRankingOrderPage.java +++ b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicRankingOrderPage.java @@ -1,17 +1,9 @@ package app.owlcms.nui.displays.scoreboards; -import java.util.Map; - import org.slf4j.LoggerFactory; -import com.vaadin.flow.component.UI; -import com.vaadin.flow.router.QueryParameters; import com.vaadin.flow.router.Route; -import app.owlcms.apputils.queryparameters.DisplayParameters; -import app.owlcms.apputils.queryparameters.SoundParameters; -import app.owlcms.data.config.Config; -import app.owlcms.displays.scoreboard.ResultsRankingOrder; import app.owlcms.init.OwlcmsSession; import ch.qos.logback.classic.Logger; @@ -32,20 +24,7 @@ public String getPageTitle() { } @Override - protected void init() { - var board = new ResultsRankingOrder(); - this.setBoard(board); - this.addComponent(board); - this.ui = UI.getCurrent(); - - setDefaultParameters(QueryParameters.simple(Map.of( - SoundParameters.SILENT, "true", - SoundParameters.DOWNSILENT, "true", - DisplayParameters.DARK, "true", - DisplayParameters.LEADERS, "true", - DisplayParameters.RECORDS, "true", - DisplayParameters.ABBREVIATED, - Boolean.toString(Config.getCurrent().featureSwitch("shortScoreboardNames"))))); + public void setDefaultParameters() { + super.setDefaultParameters(); } - } diff --git a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicScoreboardPage.java b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicScoreboardPage.java index e77938cca..b3e1532c2 100644 --- a/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicScoreboardPage.java +++ b/owlcms/src/main/java/app/owlcms/nui/displays/scoreboards/PublicScoreboardPage.java @@ -41,6 +41,10 @@ public String getPageTitle() { return getTranslation("DisplayParameters.PublicDisplay") + OwlcmsSession.getFopNameIfMultiple(); } + public final Results getResultsBoard() { + return this.resultsBoard; + } + @Subscribe public void slaveCeremonyDone(UIEvent.CeremonyDone e) { this.ui.access(() -> { @@ -60,23 +64,21 @@ public void slaveCeremonyStarted(UIEvent.CeremonyStarted e) { }); } + /** + * We make this method final because we want to force the {@link #createComponents()} method + * to be called so the assumptions made by switching from scoreboard to medals are met. + * + * @see app.owlcms.nui.displays.scoreboards.AbstractResultsDisplayPage#init() + */ @Override - protected void init() { - logger = (Logger) LoggerFactory.getLogger(PublicScoreboardPage.class); - uiEventLogger = (Logger) LoggerFactory.getLogger("UI" + this.logger.getName()); - - // each superclass must this routine. - // otherwise we end up with multiple instances of the Results board. - var board = new Results(); - var medalsBoard = new ResultsMedals(); - this.setBoard(board); - this.setResultsBoard(board); - this.setMedalsBoard(medalsBoard); - this.addComponent(board); - this.addComponent(medalsBoard); - medalsBoard.setVisible(false); - this.ui = UI.getCurrent(); + protected final void init() { + @SuppressWarnings("unused") + Logger logger = (Logger) LoggerFactory.getLogger(this.getClass()); + createComponents(); + setDefaultParameters(); + } + protected void setDefaultParameters() { // when navigating to the page, Vaadin will call setParameter+readParameters // these parameters will be applied. setDefaultParameters(QueryParameters.simple(Map.of( @@ -92,20 +94,32 @@ protected void init() { Boolean.toString(Config.getCurrent().featureSwitch("shortScoreboardNames"))))); } - private void setMedalsBoard(ResultsMedals medalsBoard) { - this.medalsBoard = medalsBoard; - } + protected void createComponents() { + this.logger = (Logger) LoggerFactory.getLogger(PublicScoreboardPage.class); + this.uiEventLogger = (Logger) LoggerFactory.getLogger("UI" + this.logger.getName()); - private void setResultsBoard(Results board) { - this.resultsBoard = board; + // each superclass must this routine. + // otherwise we end up with multiple instances of the Results board. + var board = new Results(); + var medalsBoard = new ResultsMedals(); + this.setBoard(board); + this.setResultsBoard(board); + this.setMedalsBoard(medalsBoard); + this.addComponent(board); + this.addComponent(medalsBoard); + medalsBoard.setVisible(false); + this.ui = UI.getCurrent(); } - public final Results getResultsBoard() { - return resultsBoard; + private final ResultsMedals getMedalsBoard() { + return this.medalsBoard; } - private final ResultsMedals getMedalsBoard() { - return medalsBoard; + private void setMedalsBoard(ResultsMedals medalsBoard) { + this.medalsBoard = medalsBoard; } + private void setResultsBoard(Results board) { + this.resultsBoard = board; + } } diff --git a/owlcms/src/main/java/app/owlcms/nui/shared/NavigationPage.java b/owlcms/src/main/java/app/owlcms/nui/shared/NavigationPage.java index c07abccb7..79aa71ef2 100644 --- a/owlcms/src/main/java/app/owlcms/nui/shared/NavigationPage.java +++ b/owlcms/src/main/java/app/owlcms/nui/shared/NavigationPage.java @@ -133,6 +133,13 @@ public default > Button openInNewT button.getElement().setAttribute("onClick", getWindowOpenerFromClass(targetClass, parameter)); return button; } + + public default > Button openInNewTabQueryParameters(Class targetClass, + String label, String queryParameters) { + Button button = new Button(label); + button.getElement().setAttribute("onClick", getWindowOpenerFromClass(targetClass, null, QueryParameters.fromString(queryParameters))); + return button; + } public default Button openInNewTabNoParam(Class targetClass, String label) { diff --git a/publicresults/frontend/components/ResultsPR.js b/publicresults/frontend/components/ResultsPR.js index c199fe44d..c83957552 100644 --- a/publicresults/frontend/components/ResultsPR.js +++ b/publicresults/frontend/components/ResultsPR.js @@ -114,7 +114,8 @@ class ResultsPR extends LitElement { @@ -189,7 +190,9 @@ class ResultsPR extends LitElement { ${(item?.sattempts ?? []).map( diff --git a/shared/src/main/resources/css/grid/results.css b/shared/src/main/resources/css/grid/results.css index a14a235e3..2bbf32858 100644 --- a/shared/src/main/resources/css/grid/results.css +++ b/shared/src/main/resources/css/grid/results.css @@ -207,7 +207,15 @@ table.results.sinclair { color: var(--lightTeamTextColor); } -table.results tr td.club div.ellipsis { +table.results tr td.club div.clubName { + display:flex; + align-content:center; + width: 100%; + justify-content: space-around; + flex-wrap: wrap; +} + +table.results tr td.club div.clubName div.ellipsis { width: var(--teamNameShortLength); } diff --git a/shared/src/main/resources/css/grid/resultsMedalsCustomization.css b/shared/src/main/resources/css/grid/resultsMedalsCustomization.css index 6355cf20a..530db44c4 100644 --- a/shared/src/main/resources/css/grid/resultsMedalsCustomization.css +++ b/shared/src/main/resources/css/grid/resultsMedalsCustomization.css @@ -6,8 +6,8 @@ /* variable-size columns. fr = free space after other columns have been allocated. for ease of understanding, sum of all fr columns should be 1.00. */ - --nameWidth: 0.60fr; - --clubWidth: 0.40fr; + --nameWidth: auto; + --clubWidth: min-content; /* define this if you use acronyms and want flags to line up --teamNameShortLength: 4ch; */ @@ -167,7 +167,7 @@ table.medals { /* group */ var(--startWidth) /* name */ - minmax(20ch, 25%) + var(--nameWidth) /* category */ var(--categoryWidth) /* birth */ @@ -175,7 +175,7 @@ table.medals { /* custom fields */ var(--custom1Width) var(--custom2Width) /* team name */ - minmax(min-content, 25%) + var(--clubWidth) /* snatch results */ var(--spacerWidth) repeat(3, var(--liftResultWidth)) diff --git a/shared/src/main/resources/css/grid/video/results.css b/shared/src/main/resources/css/grid/video/results.css index 610907fec..e32fc8290 100644 --- a/shared/src/main/resources/css/grid/video/results.css +++ b/shared/src/main/resources/css/grid/video/results.css @@ -207,7 +207,15 @@ table.results.sinclair { color: var(--lightTeamTextColor); } -table.results tr td.club div.ellipsis { +table.results tr td.club div.clubName { + display:flex; + align-content:center; + width: 100%; + justify-content: space-around; + flex-wrap: wrap; +} + +table.results tr td.club div.clubName div.ellipsis { width: var(--teamNameShortLength); } diff --git a/shared/src/main/resources/css/nogrid/results.css b/shared/src/main/resources/css/nogrid/results.css index 60539a26a..ed7410f6f 100644 --- a/shared/src/main/resources/css/nogrid/results.css +++ b/shared/src/main/resources/css/nogrid/results.css @@ -209,7 +209,15 @@ table.results.sinclair { color: var(--lightTeamTextColor); } -table.results tr td.club div.ellipsis { +table.results tr td.club div.clubName { + display:flex; + align-content:center; + width: 100%; + justify-content: space-around; + flex-wrap: wrap; +} + +table.results tr td.club div.clubName div.ellipsis { width: var(--teamNameShortLength); } diff --git a/shared/src/main/resources/css/nogrid/resultsMedalsCustomization.css b/shared/src/main/resources/css/nogrid/resultsMedalsCustomization.css index 90323eb04..bfcb145c7 100644 --- a/shared/src/main/resources/css/nogrid/resultsMedalsCustomization.css +++ b/shared/src/main/resources/css/nogrid/resultsMedalsCustomization.css @@ -235,7 +235,7 @@ table.medals { /* custom fields */ var(--custom1Width) var(--custom2Width) /* team name */ - minmax(min-content, 25%) + var(--clubWidth) /* snatch results */ var(--spacerWidth) repeat(3, var(--liftResultWidth)) diff --git a/shared/src/main/resources/css/nogrid/video/results.css b/shared/src/main/resources/css/nogrid/video/results.css index 8b3a2985a..9774a094d 100644 --- a/shared/src/main/resources/css/nogrid/video/results.css +++ b/shared/src/main/resources/css/nogrid/video/results.css @@ -209,7 +209,15 @@ table.results.sinclair { color: var(--lightTeamTextColor); } -table.results tr td.club div.ellipsis { +table.results tr td.club div.clubName { + display:flex; + align-content:center; + width: 100%; + justify-content: space-around; + flex-wrap: wrap; +} + +table.results tr td.club div.clubName div.ellipsis { width: var(--teamNameShortLength); } diff --git a/src/main/markdown/ReleaseNotes.md b/src/main/markdown/ReleaseNotes.md index e70aef51a..86042b6ec 100644 --- a/src/main/markdown/ReleaseNotes.md +++ b/src/main/markdown/ReleaseNotes.md @@ -6,9 +6,10 @@ > Version 44 is a technical migration release. It updates the code to the current version of the user interface framework ([Vaadin 24](http://vaadin.com)). A significant clean-up of the code was performed at the same time, and several annoyances were fixed as a result. > -**44.0.0-beta13** +**44.0.0-beta14** -- The break management dialog at the end of a group now correctly offers the countdown introduction as default. Improved behavior when changing the current group after starting the intro countdown. +- Flags: The scoreboards and medal boards now handle both short and long team names correctly. The flag is positioned at the left of the cell, and the name is centered. For 3-letter acronyms, making the team column narrow works well. +- Fix: the public scoreboard now correctly switches to medals when the announcer starts the medal ceremony. The medal board inherits the team width and other styling parameters from the public scoreboard. - Known issues: see this [list of known small issues](https://github.com/jflamy/owlcms4/issues/734)
-
${leader.teamName}
+
+
${leader?.teamName}
+
-
${item?.teamName} +
+
${item?.teamName}
${item?.custom2}
-
${item?.teamName}
+
+
${item?.teamName}
+