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 final transient LatexCreator lc;
|
||||
private final Div content;
|
||||
private ControlPanel controlPanel;
|
||||
|
||||
/**
|
||||
* 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)));
|
||||
content = new Div();
|
||||
content.setId(CONTENT_ID);
|
||||
ControlPanel controlPanel = new ControlPanel(this, this);
|
||||
controlPanel = new ControlPanel(this, this);
|
||||
Scroller scroller = new Scroller(content);
|
||||
scroller.setId(SCROLLER_ID);
|
||||
scroller.setScrollDirection(Scroller.ScrollDirection.BOTH);
|
||||
add(scroller, controlPanel);
|
||||
treeNumbers = lc.getTreeNumbers();
|
||||
setContent();
|
||||
controlPanel.setEnabledFirstStep(false);
|
||||
controlPanel.setEnabledPreviousStep(false);
|
||||
}
|
||||
|
||||
private void setContent() {
|
||||
@ -91,6 +94,12 @@ public class TypeInferenceView extends VerticalLayout
|
||||
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
||||
currentStep = currentStep > treeEnd && tree.getStepCount() > 0 ? treeEnd : 0;
|
||||
refreshElements();
|
||||
if (currentStep == 0) {
|
||||
controlPanel.setEnabledFirstStep(false);
|
||||
controlPanel.setEnabledPreviousStep(false);
|
||||
}
|
||||
controlPanel.setEnabledNextStep(true);
|
||||
controlPanel.setEnabledLastStep(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,18 +107,37 @@ public class TypeInferenceView extends VerticalLayout
|
||||
int treeEnd = treeNumbers.indexOf(tree.getStepCount() - 1);
|
||||
currentStep = currentStep < treeEnd ? treeEnd : unification.getStepCount() - 1;
|
||||
refreshElements();
|
||||
if (currentStep == unification.getStepCount() - 1) {
|
||||
controlPanel.setEnabledNextStep(false);
|
||||
controlPanel.setEnabledLastStep(false);
|
||||
}
|
||||
controlPanel.setEnabledFirstStep(true);
|
||||
controlPanel.setEnabledPreviousStep(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nextStepButton() {
|
||||
currentStep = currentStep < unification.getStepCount() - 1 ? currentStep + 1 : currentStep;
|
||||
refreshElements();
|
||||
if (currentStep == unification.getStepCount() - 1) {
|
||||
controlPanel.setEnabledNextStep(false);
|
||||
controlPanel.setEnabledLastStep(false);
|
||||
}
|
||||
controlPanel.setEnabledFirstStep(true);
|
||||
controlPanel.setEnabledPreviousStep(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void previousStepButton() {
|
||||
currentStep = currentStep > 0 ? currentStep - 1 : currentStep;
|
||||
refreshElements();
|
||||
if (currentStep == 0) {
|
||||
controlPanel.setEnabledFirstStep(false);
|
||||
controlPanel.setEnabledPreviousStep(false);
|
||||
}
|
||||
controlPanel.setEnabledNextStep(true);
|
||||
controlPanel.setEnabledLastStep(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user