Search in sources :

Example 16 with Event

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2-examples by mvp4g.

the class SearchView method createView.

public void createView() {
    container = div().add(div().style("width: 100%;").add(div().css("headline").textContent("Search Parameter (search for: 'S' or 'D')")).add(searchName = new TextField("Name")).add(searchCity = new TextField("City")).add(div().css("buttonBar").add(button().css("button").textContent("Search").on(click, event -> getPresenter().doClickSearchButton(searchName.getText(), searchCity.getText()))).add(button().css("button").textContent("Reset").on(click, event -> {
        searchName.setText("");
        searchCity.setText("");
    })).asElement())).asElement();
}
Also used : Element(elemental2.dom.Element) Elements.button(org.jboss.gwt.elemento.core.Elements.button) Elements.div(org.jboss.gwt.elemento.core.Elements.div) TextField(de.gishmo.gwt.example.mvp4g2.springboot.client.widgets.TextField) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement) EventType.click(org.jboss.gwt.elemento.core.EventType.click) LazyReverseView(com.github.mvp4g.mvp4g2.core.ui.LazyReverseView) TextField(de.gishmo.gwt.example.mvp4g2.springboot.client.widgets.TextField)

Example 17 with Event

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.

the class EventTest method testEventTestHistoryNamesNotUnique.

@Test
public void testEventTestHistoryNamesNotUnique() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHistoryNamesNotUnique/EventTestHistoryNamesNotUnique.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("using a already used historyName");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 18 with Event

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.

the class EventTest method testEventAnnotationInsideAOtherClassThenEventBus.

@Test
public void testEventAnnotationInsideAOtherClassThenEventBus() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventAnnotationInsideAOtherClassThenEventBus/EventAnnotationInsideAOtherClassThenEventBus.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventAnnotationInsideAOtherClassThenEventBus/MockShellPresenter.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventAnnotationInsideAOtherClassThenEventBus/IMockShellView.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventAnnotationInsideAOtherClassThenEventBus/MockShellView.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: @Event can only be used inside a event bus! >>com.github.mvp4g.mvp4g2.processor.event.eventAnnotationInsideAOtherClassThenEventBus.MockShellPresenter<< does no implement IsEventBus");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 19 with Event

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.

the class EventTest method testEventTestHandlerInBindAndHandlersAttribute01.

@Test
public void testEventTestHandlerInBindAndHandlersAttribute01() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerInBindAndHandlersAttribute01/EventTestHandlerInBindAndHandlersAttribute.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("can not be set in bind- and handlers-attribute");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 20 with Event

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.

the class EventTest method testEventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature.

@Test
public void testEventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature/EventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature/MockShellPresenter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@NotFoundHistory can only be used on a method with no arguments");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Aggregations

Mvp4g2Processor (com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor)25 Compilation (com.google.testing.compile.Compilation)25 JavaFileObject (javax.tools.JavaFileObject)25 Test (org.junit.Test)25 TypeElement (javax.lang.model.element.TypeElement)5 LazyReverseView (com.github.mvp4g.mvp4g2.core.ui.LazyReverseView)4 ProcessorException (com.github.mvp4g.mvp4g2.processor.ProcessorException)4 Element (elemental2.dom.Element)4 HTMLButtonElement (elemental2.dom.HTMLButtonElement)4 HTMLDivElement (elemental2.dom.HTMLDivElement)4 Elements.button (org.jboss.gwt.elemento.core.Elements.button)4 Elements.div (org.jboss.gwt.elemento.core.Elements.div)4 EventType.click (org.jboss.gwt.elemento.core.EventType.click)4 Element (javax.lang.model.element.Element)3 ExecutableElement (javax.lang.model.element.ExecutableElement)3 Event (com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event)2 InitHistory (com.github.mvp4g.mvp4g2.core.history.annotation.InitHistory)2 NotFoundHistory (com.github.mvp4g.mvp4g2.core.history.annotation.NotFoundHistory)2 EventBusMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventBusMetaModel)2 EventMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventMetaModel)2