diff --git a/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java b/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java index 95142d0..ad19739 100644 --- a/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java +++ b/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java @@ -12,7 +12,6 @@ import edu.kit.typicalc.view.content.typeinferencecontent.MathjaxProofTree; import edu.kit.typicalc.view.content.typeinferencecontent.MathjaxUnification; import edu.kit.typicalc.view.content.typeinferencecontent.ShareDialog; import edu.kit.typicalc.view.main.MainViewImpl; -import edu.kit.typicalc.view.main.MathjaxDisplay; @Route(value = "", layout = MainViewImpl.class) @PageTitle("Typicalc") @@ -35,24 +34,13 @@ public class StartPageView extends VerticalLayout implements ControlPanelView { scroller.setScrollDirection(Scroller.ScrollDirection.BOTH); setAlignItems(Alignment.CENTER); add(scroller, controlPanel); -// disableControlPanel(); + disableControlPanel(); createContent(); } private void createContent() { - String[] strings = new String[]{"$\\tau_0$", "$\\tau_1$", "$\\tau_2$", "$\\tau_3$", "$\\tau_4$", - "$\\tau_5$", "$\\tau_6$", "$\\tau_7$", "$\\tau_8$", "$\\tau_9$", "$\\tau_{10}$", "$\\tau_{11}$", - "$\\tau_{12}$", "$\\tau_{13}$", "$\\tau_{14}$"}; - content.add(new MathjaxDisplay(getTranslation("abs-rule"))); - unification = new MathjaxUnification(strings); - tree = new MathjaxProofTree(getTranslation("demo-tree")); - content.add(unification); - content.add(tree); - content.add(new MathjaxProofTree(getTranslation("demo-tree"))); - content.add(new MathjaxProofTree(getTranslation("demo-tree"))); - content.add(new MathjaxProofTree(getTranslation("demo-tree"))); - content.add(new MathjaxProofTree(getTranslation("demo-tree"))); + content.add("TODO"); } private void disableControlPanel() { diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/ShareDialog.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/ShareDialog.java index 1e0c7d3..830e0ed 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/ShareDialog.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/ShareDialog.java @@ -1,6 +1,11 @@ package edu.kit.typicalc.view.content.typeinferencecontent; +import com.vaadin.flow.component.Unit; import com.vaadin.flow.component.dialog.Dialog; +import com.vaadin.flow.component.orderedlayout.FlexComponent; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.component.textfield.TextArea; +import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.i18n.LocaleChangeEvent; import com.vaadin.flow.i18n.LocaleChangeObserver; @@ -9,16 +14,39 @@ import com.vaadin.flow.i18n.LocaleChangeObserver; */ public class ShareDialog extends Dialog implements LocaleChangeObserver { + private final VerticalLayout layout; + private final TextField urlField; + private final TextField packageField; + private final TextArea latexArea; + /** * Sets up three GUI elements, one for each parameter. The content of each element is equal * to the String that is passed as corresponding parameter. * @param url a permalink to share with other users - * @param latexPackages the needed LaTeX-packages to use the displayed mathmatics + * @param latexPackages the needed LaTeX-packages to use the displayed mathematics * in other LaTeX documents. Should be in the form „\\usepackage“ * @param latexCode LaTeX code for users to copy into their own LaTeX document(s) */ public ShareDialog(String url, String latexPackages, String latexCode) { + setWidth(80, Unit.PERCENTAGE); + layout = new VerticalLayout(); + layout.setAlignItems(FlexComponent.Alignment.START); + layout.setSizeFull(); + add(layout); + urlField = new TextField(getTranslation("share.url.label")); + packageField = new TextField(getTranslation("share.packages.label")); + latexArea = new TextArea(getTranslation("share.latex.label")); + + urlField.setValue(url); + packageField.setValue(latexPackages); + latexArea.setValue(latexCode); + + urlField.setWidthFull(); + packageField.setWidthFull(); + latexArea.setWidthFull(); + + layout.add(urlField, packageField, latexArea); } diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/TypeInferenceView.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/TypeInferenceView.java index a93225f..68dac32 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/TypeInferenceView.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/TypeInferenceView.java @@ -24,8 +24,10 @@ public class TypeInferenceView extends VerticalLayout private int currentStep = 0; + private MathjaxUnification unification; private MathjaxProofTree tree; + private final LatexCreator lc; private final transient TypeInfererInterface typeInferer; private final Div content; private final ControlPanel controlPanel; @@ -35,6 +37,7 @@ public class TypeInferenceView extends VerticalLayout setId(ID); setSizeFull(); addAttachListener(this); + lc = new LatexCreator(typeInferer); content = new Div(); content.setId(CONTENT_ID); controlPanel = new ControlPanel(this, this); @@ -48,7 +51,6 @@ public class TypeInferenceView extends VerticalLayout private void setContent() { // todo implement correctly - LatexCreator lc = new LatexCreator(typeInferer); unification = new MathjaxUnification(lc.getUnification()); tree = new MathjaxProofTree(lc.getTree()); content.add(unification, tree); @@ -56,7 +58,7 @@ public class TypeInferenceView extends VerticalLayout @Override public void shareButton() { - // todo implement + new ShareDialog("currentURL", lc.getLatexPackages(), lc.getTree()).open(); // TODO } private void refreshElements(int currentStep) {