diff --git a/src/main/java/edu/kit/typicalc/view/main/MainView.java b/src/main/java/edu/kit/typicalc/view/main/MainView.java new file mode 100644 index 0000000..b55a795 --- /dev/null +++ b/src/main/java/edu/kit/typicalc/view/main/MainView.java @@ -0,0 +1,26 @@ +package edu.kit.typicalc.view.main; + +import edu.kit.typicalc.model.TypeInfererInterface; +import edu.kit.typicalc.model.parser.ParseError; + +/** + * Provides an interface for the presenter to interact with the view. The interaction consists of + * either passing a TypeInfererInterface or a ParseError to the view. + */ +public interface MainView { + + /** + * Starts the creation of the visual representation of the provided typeInferer. + * After the process is finished, the first step of the type inference tree is displayed. + * + * @param typeInferer the result of the computation of the type inference algorithm + */ + void setTypeInferenceView(TypeInfererInterface typeInferer); + + /** + * Displays the provided error indicating syntactically invalid input. + * + * @param error the error which is displayed to indicate invalid input + */ + void displayError(ParseError error); +} diff --git a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java index a889d7f..60419dd 100644 --- a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java +++ b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java @@ -17,6 +17,8 @@ import com.vaadin.flow.component.tabs.Tabs; import com.vaadin.flow.component.tabs.TabsVariant; import com.vaadin.flow.router.PageTitle; import com.vaadin.flow.router.RouterLink; +import edu.kit.typicalc.model.TypeInfererInterface; +import edu.kit.typicalc.model.parser.ParseError; import edu.kit.typicalc.view.content.typeinferencecontent.TypeInferenceView; import java.util.Optional; @@ -26,7 +28,7 @@ import java.util.Optional; */ @CssImport("./styles/views/main/main-view.css") @JsModule("./styles/shared-styles.js") -public class MainViewImpl extends AppLayout { +public class MainViewImpl extends AppLayout implements MainView { private final Tabs menu; private H1 viewTitle; @@ -103,4 +105,14 @@ public class MainViewImpl extends AppLayout { private String getCurrentPageTitle() { return getContent().getClass().getAnnotation(PageTitle.class).value(); } + + @Override + public void setTypeInferenceView(TypeInfererInterface typeInferer) { + // TODO Auto-generated method stub + } + + @Override + public void displayError(ParseError error) { + // TODO Auto-generated method stub + } }