From 43d1a8024250af29158bc5ac27c2c809ddc61c8f Mon Sep 17 00:00:00 2001 From: ucrhh Date: Sun, 7 Mar 2021 11:51:46 +0100 Subject: [PATCH] fix some warnings --- .../typicalc/view/content/ControlPanel.java | 23 +++++++++++-------- .../MathjaxProofTree.java | 5 ++++ .../MathjaxUnification.java | 1 + .../ConstraintSetIndexFactory.java | 7 +++--- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/content/ControlPanel.java b/src/main/java/edu/kit/typicalc/view/content/ControlPanel.java index d9cb1ac..6ff1af8 100644 --- a/src/main/java/edu/kit/typicalc/view/content/ControlPanel.java +++ b/src/main/java/edu/kit/typicalc/view/content/ControlPanel.java @@ -11,16 +11,19 @@ import com.vaadin.flow.i18n.LocaleChangeObserver; * Provides a GUI in form of buttons for the user to navigate through steps. */ public class ControlPanel extends HorizontalLayout implements LocaleChangeObserver { - public static final String ID = "control-panel"; + + private static final String ATTRIBUTE_TITLE = "title"; + + private static final String ID = "control-panel"; private final Button firstStep; - public static final String FIRST_STEP_ID = "first-step"; + private static final String FIRST_STEP_ID = "first-step"; private final Button lastStep; - public static final String LAST_STEP_ID = "last-step"; + private static final String LAST_STEP_ID = "last-step"; private final Button nextStep; - public static final String NEXT_STEP_ID = "next-step"; + private static final String NEXT_STEP_ID = "next-step"; private final Button previousStep; - public static final String PREVIOUS_STEP_ID = "previous-step"; + private static final String PREVIOUS_STEP_ID = "previous-step"; private final Button share; /** @@ -90,10 +93,10 @@ public class ControlPanel extends HorizontalLayout implements LocaleChangeObserv @Override public void localeChange(LocaleChangeEvent event) { - share.getElement().setAttribute("title", getTranslation("root.shareButtonTooltip")); - firstStep.getElement().setAttribute("title", getTranslation("root.firstStepTooltip")); - previousStep.getElement().setAttribute("title", getTranslation("root.previousStepTooltip")); - nextStep.getElement().setAttribute("title", getTranslation("root.nextStepTooltip")); - lastStep.getElement().setAttribute("title", getTranslation("root.lastStepTooltip")); + share.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.shareButtonTooltip")); + firstStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.firstStepTooltip")); + previousStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.previousStepTooltip")); + nextStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.nextStepTooltip")); + lastStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.lastStepTooltip")); } } diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxProofTree.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxProofTree.java index 4adb88a..f347417 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxProofTree.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxProofTree.java @@ -22,6 +22,7 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter { private int stepCount = -1; + // initialized by Vaadin @Id("tc-content") private Div content; @@ -36,6 +37,10 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter { content.add(latex); } + /** + * Used by mathjax-proof-tree.ts to set the calculated number of steps in the tree. + * @param stepCount number of steps in tree + */ @ClientCallable private void setStepCount(int stepCount) { this.stepCount = stepCount; diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java index 1c97202..dc679d1 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java @@ -20,6 +20,7 @@ public class MathjaxUnification extends LitTemplate implements MathjaxAdapter { private final String[] latex; + // initialized by Vaadin @Id("tc-content") private Div content; diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/ConstraintSetIndexFactory.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/ConstraintSetIndexFactory.java index 066d3e8..647b11b 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/ConstraintSetIndexFactory.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/ConstraintSetIndexFactory.java @@ -27,13 +27,14 @@ public class ConstraintSetIndexFactory { * @return the next constraint set index */ protected String nextConstraintSetIndex() { - String index = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX - ? "" - : nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + 1 + String realIndex = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + 1 ? "" + UNDERSCORE + CURLY_LEFT + LET + CURLY_RIGHT : "" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE + CURLY_LEFT + nextConstraintSetIndex + CURLY_RIGHT + CURLY_RIGHT; + String index = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + ? "" + : realIndex; nextConstraintSetIndex++; return index; }