Search in sources :

Example 11 with HistoryConverterElement

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

the class Mvp4gConfigurationTest method newHistoryConverter.

private HistoryConverterElement newHistoryConverter(Class<?> c, String name) {
    HistoryConverterElement historyConverter = new HistoryConverterElement();
    historyConverter.setName(name);
    oracle.addClass(c);
    historyConverter.setClassName(c.getCanonicalName());
    return historyConverter;
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement)

Example 12 with HistoryConverterElement

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

the class Mvp4gConfigurationTest method testEventHistoryConverterRemove.

@Test
public void testEventHistoryConverterRemove() throws InvalidMvp4gConfigurationException {
    HistoryConverterElement hc1 = newHistoryConverter(SimpleHistoryConverter01.class, "hc1");
    HistoryConverterElement hc2 = newHistoryConverter(SimpleHistoryConverter02.class, "hc2");
    historyConverters.add(hc1);
    historyConverters.add(hc2);
    EventElement event = newEvent("testEvent");
    event.setHistory("hc1");
    events.add(event);
    setEventBus();
    assertEquals(2, historyConverters.size());
    assertTrue(historyConverters.contains(hc1));
    assertTrue(historyConverters.contains(hc2));
    configuration.validateHistoryConverters();
    assertEquals(1, historyConverters.size());
    assertTrue(historyConverters.contains(hc1));
    assertFalse(historyConverters.contains(hc2));
    configuration.validateHistoryConverters();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) EventElement(com.mvp4g.rebind.config.element.EventElement) Test(org.junit.Test)

Example 13 with HistoryConverterElement

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

the class Mvp4gConfigurationTest method testRemoveClearHistory.

@Test
public void testRemoveClearHistory() throws InvalidMvp4gConfigurationException {
    HistoryConverterElement e = new HistoryConverterElement();
    e.setClassName(ClearHistory.class.getCanonicalName());
    historyConverters.add(e);
    EventBusElement eventBus = new EventBusElement(EventBus.class.getName(), BaseEventBus.class.getName(), false);
    configuration.setEventBus(eventBus);
    configuration.validateHistoryConverters();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) ClearHistory(com.mvp4g.client.history.ClearHistory) EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) BaseEventBus(com.mvp4g.client.event.BaseEventBus) EventBus(com.mvp4g.client.event.EventBus) BaseEventBus(com.mvp4g.client.event.BaseEventBus) Test(org.junit.Test)

Example 14 with HistoryConverterElement

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

the class HistoryAnnotationsLoader method loadElementWithServices.

/*
   * (non-Javadoc)
   *
   * @see
   * com.mvp4g.rebind.config.loader.annotation.Mvp4gAnnotationsWithServiceLoader#loadElementWithServices
   * (com.google.gwt.core.ext.typeinfo.JClassType, java.lang.annotation.Annotation,
   * com.mvp4g.rebind.config.Mvp4gConfiguration)
   */
@Override
Mvp4gWithServicesElement loadElementWithServices(JClassType c, History annotation, Mvp4gConfiguration configuration) throws Mvp4gAnnotationException {
    String className = c.getQualifiedSourceName();
    String historyName = buildElementNameIfNeeded(annotation.name(), className, "");
    String type = annotation.type().name();
    HistoryConverterElement historyConverter = new HistoryConverterElement();
    historyConverter.setName(historyName);
    historyConverter.setClassName(className);
    historyConverter.setType(type);
    addElement(configuration.getHistoryConverters(), historyConverter, c, null);
    return historyConverter;
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement)

Aggregations

HistoryConverterElement (com.mvp4g.rebind.config.element.HistoryConverterElement)14 Test (org.junit.Test)12 EventElement (com.mvp4g.rebind.config.element.EventElement)4 InjectedElement (com.mvp4g.rebind.config.element.InjectedElement)3 BaseEventBus (com.mvp4g.client.event.BaseEventBus)2 EventBus (com.mvp4g.client.event.EventBus)2 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)2 PresenterElement (com.mvp4g.rebind.config.element.PresenterElement)2 InvalidMvp4gConfigurationException (com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException)2 Modules (com.mvp4g.rebind.test_tools.Modules)2 ClearHistory (com.mvp4g.client.history.ClearHistory)1 EventHandlerElement (com.mvp4g.rebind.config.element.EventHandlerElement)1 HistoryElement (com.mvp4g.rebind.config.element.HistoryElement)1 ServiceElement (com.mvp4g.rebind.config.element.ServiceElement)1 InvalidTypeException (com.mvp4g.rebind.exception.InvalidTypeException)1 OneObject (com.mvp4g.rebind.test_tools.OneObject)1 EventBusOk (com.mvp4g.rebind.test_tools.annotation.events.EventBusOk)1 SimpleHistoryConverter01 (com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01)1 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)1 SimpleView02 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView02)1