Search in sources :

Example 16 with ViewElement

use of com.mvp4g.rebind.config.element.ViewElement in project mvp4g by mvp4g.

the class PresenterAnnotationsLoader method loadHandler.

@Override
protected PresenterElement loadHandler(JClassType c, Presenter annotation, Mvp4gConfiguration configuration) throws Mvp4gAnnotationException {
    String className = c.getQualifiedSourceName();
    String viewName = buildElementNameIfNeeded(annotation.viewName(), className, "View");
    PresenterElement presenter = new PresenterElement();
    presenter.setView(viewName);
    ViewElement view = new ViewElement();
    view.setClassName(annotation.view().getCanonicalName());
    view.setName(viewName);
    addElement(configuration.getViews(), view, c, null);
    return presenter;
}
Also used : ViewElement(com.mvp4g.rebind.config.element.ViewElement) PresenterElement(com.mvp4g.rebind.config.element.PresenterElement)

Example 17 with ViewElement

use of com.mvp4g.rebind.config.element.ViewElement in project mvp4g by mvp4g.

the class PresenterAnnotationsLoaderTest method testView.

@Test
public void testView() throws Mvp4gAnnotationException {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    JClassType type = oracle.addClass(getSimpleClass());
    annotedClasses.add(type);
    loader.load(annotedClasses, configuration);
    ViewElement view = configuration.getViews().iterator().next();
    assertEquals(view.getClassName(), Object.class.getName());
    assertEquals(view.getName(), type.getQualifiedSourceName().replace('.', '_') + "View");
}
Also used : JClassType(com.google.gwt.core.ext.typeinfo.JClassType) ArrayList(java.util.ArrayList) ViewElement(com.mvp4g.rebind.config.element.ViewElement) Test(org.junit.Test)

Aggregations

ViewElement (com.mvp4g.rebind.config.element.ViewElement)17 Test (org.junit.Test)15 PresenterElement (com.mvp4g.rebind.config.element.PresenterElement)14 EventElement (com.mvp4g.rebind.config.element.EventElement)12 EventHandlerElement (com.mvp4g.rebind.config.element.EventHandlerElement)4 Presenters (com.mvp4g.rebind.test_tools.annotation.Presenters)4 BaseEventBus (com.mvp4g.client.event.BaseEventBus)3 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)3 InvalidTypeException (com.mvp4g.rebind.exception.InvalidTypeException)3 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)2 EventBusWithLookup (com.mvp4g.client.event.EventBusWithLookup)2 InvalidMvp4gConfigurationException (com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException)2 TestBroadcast (com.mvp4g.rebind.test_tools.annotation.TestBroadcast)2 SimpleView02 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView02)2 ArrayList (java.util.ArrayList)2 EventBus (com.mvp4g.client.event.EventBus)1 OneObject (com.mvp4g.rebind.test_tools.OneObject)1 TestBroadcast2 (com.mvp4g.rebind.test_tools.annotation.TestBroadcast2)1 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)1 SimpleView03 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView03)1