use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2-examples by mvp4g.
the class DetailView method createView.
public void createView() {
container = div().add(div().style("width: 100%;").add(div().css("headline").textContent("Details")).add(detailFirstName = new TextField("Firstname")).add(detailName = new TextField("Name")).add(detailStreet = new TextField("Street")).add(detailZip = new TextField("Zip")).add(detailCity = new TextField("City")).add(div().css("buttonBar").add(button().css("button").textContent("Save").on(click, event -> {
updateDetailForm();
getPresenter().doUpdate(person);
})).add(button().css("button").textContent("Revert").on(click, event -> {
getPresenter().doRevert();
})))).asElement();
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2-examples by mvp4g.
the class DetailView method createView.
public void createView() {
container = div().add(div().style("width: 100%;").add(div().css("headline").textContent("Details")).add(detailFirstName = new TextField("Firstname")).add(detailName = new TextField("Name")).add(detailStreet = new TextField("Street")).add(detailZip = new TextField("Zip")).add(detailCity = new TextField("City")).add(div().css("buttonBar").add(button().css("button").textContent("Save").on(click, event -> {
updateDetailForm();
getPresenter().doUpdate(person);
})).add(button().css("button").textContent("Revert").on(click, event -> {
getPresenter().doRevert();
})))).asElement();
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class EventTest method testEventDoesNotReturnVoid.
@Test
public void testEventDoesNotReturnVoid() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventDoesNotReturnVoid/EventBusEventDoesNotReturnVoid.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventDoesNotReturnVoid/MockShellPresenter01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventDoesNotReturnVoid/IMockShellView01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventDoesNotReturnVoid/MockShellView01.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: EventElement: >>doSomething<< must return 'void'");
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class EventTest method testEventTestHandlerNotInBindAndHandlersAttribute.
@Test
public void testEventTestHandlerNotInBindAndHandlersAttribute() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttribute.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/MockOneEventHandler.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/MockShellPresenter.java"));
}
});
CompilationSubject.assertThat(compilation).succeeded();
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event01.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event01.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event02.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event02.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event03.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_EventTestHandlerNotInBindAndHandlersAttribute_event03.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_MockOneEventHandlerMetaData.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_MockOneEventHandlerMetaData.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_MockShellPresenterMetaData.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/Com_github_mvp4g_mvp4g2_processor_event_eventTestHandlerNotInBindAndHandlersAttribute_MockShellPresenterMetaData.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java"));
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class EventTest method testEventBusWithOneInitHistoryAnnotationAndNonZeroArgmentsSignature.
@Test
public void testEventBusWithOneInitHistoryAnnotationAndNonZeroArgmentsSignature() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneInitHistoryAnnotationAndNonZeroArgmentsSignature/EventBusWithOneInitHistoryAnnotationAndNonZeroArgmentsSignature.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneInitHistoryAnnotationAndNonZeroArgmentsSignature/MockShellPresenter.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("@InitHistory can only be used on a method with no arguments");
}
Aggregations