use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2-examples by mvp4g.
the class DetailPresenter method onGotoDetail.
@EventHandler
public void onGotoDetail(long id) {
eventBus.setNavigationConfirmation(this);
try {
Person result = PersonService.get().get(id);
view.setUpData(result);
eventBus.setContent(view.asElement());
eventBus.setStatus("Edit person data");
} catch (PersonNotFoundException e) {
DomGlobal.window.alert("Panic!");
}
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2-examples by mvp4g.
the class ListPresenter method onGotoList.
@EventHandler
public void onGotoList(String searchName, String searchCity) {
List<Person> result = PersonService.get().get(new PersonSearch(searchName, searchCity));
view.resetTable();
view.setData(result);
eventBus.setContent(view.asElement());
if (result.size() == 0) {
eventBus.setStatus("No person found");
} else if (result.size() == 1) {
eventBus.setStatus("Found one person");
} else {
eventBus.setStatus("Found " + Integer.toString(result.size()) + " persons");
}
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2-examples by mvp4g.
the class ListPresenter method onGotoList.
@EventHandler
public void onGotoList(String searchName, String searchCity) {
GWT.debugger();
ClientContext.get().getPersonService().search(new PersonSearch(searchName, searchCity), new MethodCallback<List<Person>>() {
@Override
public void onFailure(Method method, Throwable throwable) {
DomGlobal.alert("error: " + throwable.getMessage());
}
@Override
public void onSuccess(Method method, List<Person> persons) {
GWT.debugger();
view.setData(persons);
eventBus.setContent(view.asElement());
if (persons.size() == 0) {
eventBus.setStatus("No person found");
} else if (persons.size() == 1) {
eventBus.setStatus("Found one person");
} else {
eventBus.setStatus("Found " + Integer.toString(persons.size()) + " persons");
}
}
});
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testEventHandlerAnnotationAnnotatedOnAInterface.
@Test
public void testEventHandlerAnnotationAnnotatedOnAInterface() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerAnnotationAnnotatedOnAInterface/EventHandlerAnnotationAnnotatedOnAInterface.java"));
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("@Handler can only be used with a class");
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testEventHandlingMethodDoesNotReturnVoid02.
@Test
public void testEventHandlingMethodDoesNotReturnVoid02() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid02/EventBusEventHandlingMethodDoesNotReturnVoid.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid02/MockOneEventHandler.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid02/MockShellPresenter01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid02/IMockShellView01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid02/MockShellView01.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: >>com.github.mvp4g.mvp4g2.processor.eventhandler.eventHandlingMethodDoesNotReturnVoid02.MockOneEventHandler<< -> EventElement: >>onDoSomethingInHandler(java.lang.String)<< must return 'void'");
}
Aggregations