fix some warnings

This commit is contained in:
ucrhh 2021-03-07 11:51:46 +01:00
parent 85bf7df675
commit 43d1a80242
4 changed files with 23 additions and 13 deletions

View File

@ -11,16 +11,19 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
* Provides a GUI in form of buttons for the user to navigate through steps. * Provides a GUI in form of buttons for the user to navigate through steps.
*/ */
public class ControlPanel extends HorizontalLayout implements LocaleChangeObserver { 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; 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; 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; 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; 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; private final Button share;
/** /**
@ -90,10 +93,10 @@ public class ControlPanel extends HorizontalLayout implements LocaleChangeObserv
@Override @Override
public void localeChange(LocaleChangeEvent event) { public void localeChange(LocaleChangeEvent event) {
share.getElement().setAttribute("title", getTranslation("root.shareButtonTooltip")); share.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.shareButtonTooltip"));
firstStep.getElement().setAttribute("title", getTranslation("root.firstStepTooltip")); firstStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.firstStepTooltip"));
previousStep.getElement().setAttribute("title", getTranslation("root.previousStepTooltip")); previousStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.previousStepTooltip"));
nextStep.getElement().setAttribute("title", getTranslation("root.nextStepTooltip")); nextStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.nextStepTooltip"));
lastStep.getElement().setAttribute("title", getTranslation("root.lastStepTooltip")); lastStep.getElement().setAttribute(ATTRIBUTE_TITLE, getTranslation("root.lastStepTooltip"));
} }
} }

View File

@ -22,6 +22,7 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter {
private int stepCount = -1; private int stepCount = -1;
// initialized by Vaadin
@Id("tc-content") @Id("tc-content")
private Div content; private Div content;
@ -36,6 +37,10 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter {
content.add(latex); 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 @ClientCallable
private void setStepCount(int stepCount) { private void setStepCount(int stepCount) {
this.stepCount = stepCount; this.stepCount = stepCount;

View File

@ -20,6 +20,7 @@ public class MathjaxUnification extends LitTemplate implements MathjaxAdapter {
private final String[] latex; private final String[] latex;
// initialized by Vaadin
@Id("tc-content") @Id("tc-content")
private Div content; private Div content;

View File

@ -27,13 +27,14 @@ public class ConstraintSetIndexFactory {
* @return the next constraint set index * @return the next constraint set index
*/ */
protected String nextConstraintSetIndex() { protected String nextConstraintSetIndex() {
String index = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX String realIndex = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + 1
? ""
: nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + 1
? "" + UNDERSCORE + CURLY_LEFT + LET + CURLY_RIGHT ? "" + UNDERSCORE + CURLY_LEFT + LET + CURLY_RIGHT
: "" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE : "" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE
+ CURLY_LEFT + nextConstraintSetIndex + CURLY_RIGHT + CURLY_RIGHT; + CURLY_LEFT + nextConstraintSetIndex + CURLY_RIGHT + CURLY_RIGHT;
String index = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX
? ""
: realIndex;
nextConstraintSetIndex++; nextConstraintSetIndex++;
return index; return index;
} }