mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
refresh unification error message on localeChange
This commit is contained in:
parent
05885a4e6e
commit
cd20ce023e
@ -8,6 +8,8 @@ import com.vaadin.flow.component.dependency.JavaScript;
|
|||||||
import com.vaadin.flow.component.html.Div;
|
import com.vaadin.flow.component.html.Div;
|
||||||
import com.vaadin.flow.component.orderedlayout.Scroller;
|
import com.vaadin.flow.component.orderedlayout.Scroller;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
|
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||||
import edu.kit.typicalc.model.TypeInfererInterface;
|
import edu.kit.typicalc.model.TypeInfererInterface;
|
||||||
import edu.kit.typicalc.view.content.ControlPanel;
|
import edu.kit.typicalc.view.content.ControlPanel;
|
||||||
import edu.kit.typicalc.view.content.ControlPanelView;
|
import edu.kit.typicalc.view.content.ControlPanelView;
|
||||||
@ -26,7 +28,7 @@ import java.util.Locale;
|
|||||||
@CssImport("./styles/view/type-inference.css")
|
@CssImport("./styles/view/type-inference.css")
|
||||||
@JavaScript("./src/key-shortcuts.js")
|
@JavaScript("./src/key-shortcuts.js")
|
||||||
public class TypeInferenceView extends VerticalLayout
|
public class TypeInferenceView extends VerticalLayout
|
||||||
implements ControlPanelView, ComponentEventListener<AttachEvent> {
|
implements ControlPanelView, ComponentEventListener<AttachEvent>, LocaleChangeObserver {
|
||||||
/**
|
/**
|
||||||
* Route of this view.
|
* Route of this view.
|
||||||
*/
|
*/
|
||||||
@ -42,7 +44,8 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
|
|
||||||
private MathjaxUnification unification;
|
private MathjaxUnification unification;
|
||||||
private MathjaxProofTree tree;
|
private MathjaxProofTree tree;
|
||||||
private final transient LatexCreator lc;
|
private transient LatexCreator lc;
|
||||||
|
private final transient TypeInfererInterface typeInferer;
|
||||||
private final Div content;
|
private final Div content;
|
||||||
private final ControlPanel controlPanel;
|
private final ControlPanel controlPanel;
|
||||||
|
|
||||||
@ -55,6 +58,7 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
public TypeInferenceView(TypeInfererInterface typeInferer) {
|
public TypeInferenceView(TypeInfererInterface typeInferer) {
|
||||||
setId(ID);
|
setId(ID);
|
||||||
addAttachListener(this);
|
addAttachListener(this);
|
||||||
|
this.typeInferer = typeInferer;
|
||||||
lc = new LatexCreator(typeInferer,
|
lc = new LatexCreator(typeInferer,
|
||||||
error -> getTranslation("root." + error.toString().toLowerCase(Locale.ENGLISH)));
|
error -> getTranslation("root." + error.toString().toLowerCase(Locale.ENGLISH)));
|
||||||
content = new Div();
|
content = new Div();
|
||||||
@ -133,4 +137,14 @@ public class TypeInferenceView extends VerticalLayout
|
|||||||
currentStep = 0;
|
currentStep = 0;
|
||||||
refreshElements();
|
refreshElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void localeChange(LocaleChangeEvent localeChangeEvent) {
|
||||||
|
lc = new LatexCreator(typeInferer,
|
||||||
|
error -> getTranslation("root." + error.toString().toLowerCase(Locale.ENGLISH)));
|
||||||
|
unification = new MathjaxUnification(lc.getUnification());
|
||||||
|
content.removeAll();
|
||||||
|
content.add(unification, tree);
|
||||||
|
refreshElements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user