mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
ControlPanel Buttons are now disabled when they have no function
This commit is contained in:
parent
bd5f0eeefa
commit
7271c22029
@ -42,6 +42,7 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
private MathjaxProofTree tree;
|
private MathjaxProofTree tree;
|
||||||
private final transient LatexCreator lc;
|
private final transient LatexCreator lc;
|
||||||
private final Div content;
|
private final Div content;
|
||||||
|
private ControlPanel controlPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the component. When initialization is complete, the first step of the type
|
* Initializes the component. When initialization is complete, the first step of the type
|
||||||
@ -58,13 +59,15 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
error -> getTranslation("root." + error.toString().toLowerCase(Locale.ENGLISH)));
|
error -> getTranslation("root." + error.toString().toLowerCase(Locale.ENGLISH)));
|
||||||
content = new Div();
|
content = new Div();
|
||||||
content.setId(CONTENT_ID);
|
content.setId(CONTENT_ID);
|
||||||
ControlPanel controlPanel = new ControlPanel(this, this);
|
controlPanel = new ControlPanel(this, this);
|
||||||
Scroller scroller = new Scroller(content);
|
Scroller scroller = new Scroller(content);
|
||||||
scroller.setId(SCROLLER_ID);
|
scroller.setId(SCROLLER_ID);
|
||||||
scroller.setScrollDirection(Scroller.ScrollDirection.BOTH);
|
scroller.setScrollDirection(Scroller.ScrollDirection.BOTH);
|
||||||
add(scroller, controlPanel);
|
add(scroller, controlPanel);
|
||||||
treeNumbers = lc.getTreeNumbers();
|
treeNumbers = lc.getTreeNumbers();
|
||||||
setContent();
|
setContent();
|
||||||
|
controlPanel.setEnabledFirstStep(false);
|
||||||
|
controlPanel.setEnabledPreviousStep(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setContent() {
|
private void setContent() {
|
||||||
@ -91,6 +94,12 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
||||||
currentStep = currentStep > treeEnd && tree.getStepCount() > 0 ? treeEnd : 0;
|
currentStep = currentStep > treeEnd && tree.getStepCount() > 0 ? treeEnd : 0;
|
||||||
refreshElements();
|
refreshElements();
|
||||||
|
if (currentStep == 0) {
|
||||||
|
controlPanel.setEnabledFirstStep(false);
|
||||||
|
controlPanel.setEnabledPreviousStep(false);
|
||||||
|
}
|
||||||
|
controlPanel.setEnabledNextStep(true);
|
||||||
|
controlPanel.setEnabledLastStep(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,18 +107,37 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
||||||
currentStep = currentStep < treeEnd ? treeEnd : unification.getStepCount() - 1;
|
currentStep = currentStep < treeEnd ? treeEnd : unification.getStepCount() - 1;
|
||||||
refreshElements();
|
refreshElements();
|
||||||
|
if (currentStep == unification.getStepCount() - 1) {
|
||||||
|
controlPanel.setEnabledNextStep(false);
|
||||||
|
controlPanel.setEnabledLastStep(false);
|
||||||
|
}
|
||||||
|
controlPanel.setEnabledFirstStep(true);
|
||||||
|
controlPanel.setEnabledPreviousStep(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nextStepButton() {
|
public void nextStepButton() {
|
||||||
currentStep = currentStep < unification.getStepCount() - 1 ? currentStep + 1 : currentStep;
|
currentStep = currentStep < unification.getStepCount() - 1 ? currentStep + 1 : currentStep;
|
||||||
refreshElements();
|
refreshElements();
|
||||||
|
if (currentStep == unification.getStepCount() - 1) {
|
||||||
|
controlPanel.setEnabledNextStep(false);
|
||||||
|
controlPanel.setEnabledLastStep(false);
|
||||||
|
}
|
||||||
|
controlPanel.setEnabledFirstStep(true);
|
||||||
|
controlPanel.setEnabledPreviousStep(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void previousStepButton() {
|
public void previousStepButton() {
|
||||||
currentStep = currentStep > 0 ? currentStep - 1 : currentStep;
|
currentStep = currentStep > 0 ? currentStep - 1 : currentStep;
|
||||||
refreshElements();
|
refreshElements();
|
||||||
|
if (currentStep == 0) {
|
||||||
|
controlPanel.setEnabledFirstStep(false);
|
||||||
|
controlPanel.setEnabledPreviousStep(false);
|
||||||
|
}
|
||||||
|
controlPanel.setEnabledNextStep(true);
|
||||||
|
controlPanel.setEnabledLastStep(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user