diff --git a/etc/wiki/05. Browser History Support.md b/etc/wiki/05. Browser History Support.md new file mode 100644 index 0000000..78b3d8c --- /dev/null +++ b/etc/wiki/05. Browser History Support.md @@ -0,0 +1,142 @@ +### Place Service +#### Description +Mvp4g2 instantiates a Place Service to easily manage history based on History converter. + +History converters have two goals: + +* convert event parameters to a string (to add it to the token) and/or store them (in cookie for example) when an event + is stored in browser history ([see this section for more information](#Associate_an_History_Converter_to_an_event)). + +* convert, when history changes, a token to an event, retrieve information to build its parameters (thanks to the token, + database, cookie...) and then fires the converted event to event bus. This conversion is done by convertFromToken + method. + +This is how Mvp4g2 stores an event to the browser history: + +![Place Service](https://github.com/mvp4g/mvp4g2/blob/master/etc/uml/place_service.png) + +This is how Mvp4g retrieves an event from browser history: + +![Place Service Reverse](https://github.com/mvp4g/mvp4g2/blob/master/etc/uml/place_service_reverse.png) + +The token stored in the browser history will be built the following way: event name (or history name, if one is enter +inside the event bus) + "?" + value returned by the handling method of the event. This is the default implementation of +mvp4g2. + +Any event can be stored in history. All you have to do is to associate a history converter to an event. + +If you need to store event information when the event is stored in the browser history, you can do this thanks to the convertToToken conversion method. + +If you need to retrieve event information when browser history changes, you can do this in the convertFromToken method of the history converter. + +#### Create a History Converter +To create a history converter, you have to: + +* create a class that implements HistoryConverter +* have a constructor with no parameter +* annotate your class with @History +* have your history converter implement the event to token conversion method ([see this section for more information](#Associate_an_History_Converter_to_an_event)). +``` +@History +public class CompanyHistoryConverter + implements HistoryConverter {...} +``` +The @History annotation has also an attribute type. The event to token method that you will have to define for the event will depend on the type ([see this section for more information](#Associate_an_History_Converter_to_an_event)). + +#### Associate a History Converter to an event +To add a history converter to an event, you need to specify the history converter attribute of the @Event annotation that annotates the method of your event. +``` +@Event(..., historyConverter = CompanyHistoryConverter.class) +public void goToCompany(long id); +``` +By defining the history converter class, Mvp4g2 will be able to find the instance of history converter class and +associate it with the event. + +Mvp4g2 generates instances of history converter as singleton so for one class, it generates only one instance, which means that if for several events, the same history converter class is associated, then the events will share the same instance of the converter. + +When a history converter is associated to an event, it needs to implement the conversion method of this event. The method to define will depend on the history converter type: + +* NONE: parameters won't be converted, only the event's name will be stored in browser's history. +* DEFAULT: the history converter needs to define the handling method of the event but this method must return a String. The returned String will be added to the token and stored in browser's history. + +For example for the previous event, you need to define the following method in your history converter: +``` +public String onGoToCompany(long id); +``` +* SIMPLE: the history converter needs to define one convertToToken method for each event that has a different parameters signature. This convertToToken method must return String and must have the same parameters as the event to convert plus a first String parameter. Mvp4g will use this first String parameter to pass the event's name. The returned String will added to the token and stored in browser's history. + +For example, if you have the following event bus: +``` +public interface OneEventBus ... { + + @Event(..., historyConverter=OneHistoryConverter.class) + void event1(int i); + + @Event(..., historyConverter=OneHistoryConverter.class) + void event2(int i); + + @Event(..., historyConverter=OneHistoryConverter.class) + void event3(int i, String s); + +} +``` +you would need to define this history converter with 2 convertToToken methods: +``` +public class OneHistoryConverter... { + + public String convertToToken(String eventType, int i){ + //called by event1 and event2 + ... + } + + public String convertToToken(String eventType, int i, String s){ + //called by event 3 + ... + } + +} +``` +You can define the history converter type thanks to the "type" attribute of the @History annotation: +``` +@History(type = HistoryConverterType.SIMPLE) +public class OneHistoryConverter implements HistoryConverter { ... } +``` +By default, the type attribute is equals to **DEFAULT**. + +#### Init and NotFound events +When dealing with history, two particular cases can happen: + +* token stored in history is null or empty (ie equals to ""). +* token is incorrect (for example, user tried to modify the url and event type stored in the token is not correct). + +For both of these cases, Mvp4g lets you define events that can be fired if they happen. You can annotate the method defining an event in your event bus with: + +* @InitHistory, to manage the case when the token is empty +* @NotFoundHistory, to manage the case when the token is incorrect. +``` +@InitHistory +@Event(handlers = { RootTemplatePresenter.class, TopBarPresenter.class }) +public void init(); + +@NotFoundHistory +@Event(handlers = RootTemplatePresenter.class) +public void notFound(); +``` +@InitHistory must be set if you have events with history converters. @NotFoundHistory is always optional. If you have events with history converters and you haven't set the @NotFoundHistory, then the event annotated with @InitHistory will be fired in case the token is incorrect. + +**No object can be fired with event(s) annotated with @InitHistory or @NotFoundHistory.** + +#### Clear History Token +For some event, you may want to delete history token stored in the URL. In order to do so, you just have to associate your event to a particular HistoryConverter provided by the framework, ClearHistory. +``` +@Event(handlers = MainPresenter.class, historyConverter=ClearHistory.class) +public void clearHistory(); +``` +#### History on start +When you start your application, you may want to fire the current history state in order to convert any token that could be stored in the URL. + +In order to do so, you have to set the attribute historyOnStart of the @EventBus annotation of your event bus to true. By default this parameter is false. +``` +@Events(...historyOnStart = true) +public interface MainEventBus extends EventBusWithLookup {...} +``` diff --git a/mvp4g2-processor/pom.xml b/mvp4g2-processor/pom.xml index 7d94ee9..945fe17 100644 --- a/mvp4g2-processor/pom.xml +++ b/mvp4g2-processor/pom.xml @@ -25,7 +25,7 @@ com.github.mvp4g mvp4g2-parent - 1.0.0 + 1.0.1 mvp4g2-processor @@ -65,19 +65,18 @@ https://github.com/mvp4g/mvp4g2/issues - 0.8 + 0.10 - 1.0.0 1.0-rc4 - 1.10.0 - 0.39 + 1.11.0 + 0.40 com.github.mvp4g mvp4g2 - ${mvp4g2.version} + ${project.version} @@ -94,7 +93,7 @@ junit junit - 4.12 + ${junit.version} test diff --git a/mvp4g2-processor/src/main/java/com/github/mvp4g/mvp4g2/processor/generator/AddPresenterGenerator.java b/mvp4g2-processor/src/main/java/com/github/mvp4g/mvp4g2/processor/generator/AddPresenterGenerator.java index a4824ee..534d812 100644 --- a/mvp4g2-processor/src/main/java/com/github/mvp4g/mvp4g2/processor/generator/AddPresenterGenerator.java +++ b/mvp4g2-processor/src/main/java/com/github/mvp4g/mvp4g2/processor/generator/AddPresenterGenerator.java @@ -30,7 +30,7 @@ import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.WildcardTypeName; import com.github.mvp4g.mvp4g2.core.eventbus.PresenterRegistration; -import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2RuntimeException; +import com.github.mvp4g.mvp4g2.core.Mvp4g2RuntimeException; import com.github.mvp4g.mvp4g2.core.internal.eventbus.AbstractEventBus; import com.github.mvp4g.mvp4g2.core.internal.ui.PresenterMetaDataRegistration; import com.github.mvp4g.mvp4g2.core.ui.IsPresenter; diff --git a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java index d13a71d..f6c5179 100644 --- a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java +++ b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerNotInBindAndHandlersAttribute/EventTestHandlerNotInBindAndHandlersAttributeImpl.java @@ -1,7 +1,7 @@ package com.github.mvp4g.mvp4g2.processor.event.eventTestHandlerNotInBindAndHandlersAttribute; import com.github.mvp4g.mvp4g2.core.eventbus.PresenterRegistration; -import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2RuntimeException; +import com.github.mvp4g.mvp4g2.core.Mvp4g2RuntimeException; import com.github.mvp4g.mvp4g2.core.internal.eventbus.AbstractEventBus; import com.github.mvp4g.mvp4g2.core.internal.eventbus.EventMetaData; import com.github.mvp4g.mvp4g2.core.internal.ui.HandlerMetaData; diff --git a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java index 620abd1..c89af7d 100644 --- a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java +++ b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java @@ -1,7 +1,7 @@ package com.github.mvp4g.mvp4g2.processor.event.startEventTestEventBusWithOneStartAnnotation; import com.github.mvp4g.mvp4g2.core.eventbus.PresenterRegistration; -import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2RuntimeException; +import com.github.mvp4g.mvp4g2.core.Mvp4g2RuntimeException; import com.github.mvp4g.mvp4g2.core.internal.eventbus.AbstractEventBus; import com.github.mvp4g.mvp4g2.core.internal.eventbus.EventMetaData; import com.github.mvp4g.mvp4g2.core.internal.ui.HandlerMetaData; diff --git a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/eventhandler/eventhandlerWithHanderlsAttributeAndEventHandlerAnnotation/EventBusEventhandlerWithHanderlsAttributeAndEventHandlerAnnotationImpl.java b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/eventhandler/eventhandlerWithHanderlsAttributeAndEventHandlerAnnotation/EventBusEventhandlerWithHanderlsAttributeAndEventHandlerAnnotationImpl.java index 39098c2..8583fd2 100644 --- a/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/eventhandler/eventhandlerWithHanderlsAttributeAndEventHandlerAnnotation/EventBusEventhandlerWithHanderlsAttributeAndEventHandlerAnnotationImpl.java +++ b/mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/eventhandler/eventhandlerWithHanderlsAttributeAndEventHandlerAnnotation/EventBusEventhandlerWithHanderlsAttributeAndEventHandlerAnnotationImpl.java @@ -1,7 +1,7 @@ package com.github.mvp4g.mvp4g2.processor.eventhandler.eventhandlerWithHanderlsAttributeAndEventHandlerAnnotation; import com.github.mvp4g.mvp4g2.core.eventbus.PresenterRegistration; -import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2RuntimeException; +import com.github.mvp4g.mvp4g2.core.Mvp4g2RuntimeException; import com.github.mvp4g.mvp4g2.core.internal.eventbus.AbstractEventBus; import com.github.mvp4g.mvp4g2.core.internal.eventbus.EventMetaData; import com.github.mvp4g.mvp4g2.core.internal.ui.HandlerMetaData; diff --git a/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/PropertyFactory.java b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/PropertyFactory.java new file mode 100644 index 0000000..c1583ab --- /dev/null +++ b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/PropertyFactory.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.junit.test.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Properties; + +import com.github.mvp4g.mvp4g2.core.history.annotation.History; +import com.github.mvp4g.mvp4g2.core.internal.history.HistoryMetaData; +import org.junit.Assert; + +public class PropertyFactory { + + + private static HistoryMetaData getHistoryMetaData(String requestedHistoryConverter, + String uri) { + if (requestedHistoryConverter == null) { + return null; + } + final HistoryMetaData[] historyMetaData = {null}; + ClassLoader loader = Thread.currentThread() + .getContextClassLoader(); + Properties historyMetaDataProps = new Properties(); + try (InputStream resourceStream = loader.getResourceAsStream(uri)) { + historyMetaDataProps.load(resourceStream); + } catch (IOException e) { + Assert.fail("Resource >>" + uri + "<< not found!"); + } + String[] historyConverters = historyMetaDataProps.getProperty("historyConverters") + .split(","); + Arrays.stream(historyConverters) + .filter(s -> requestedHistoryConverter.equals(s)) + .forEach(s -> { + History.HistoryConverterType type; + String historyConverterType = historyMetaDataProps.getProperty(s + ".historyConverterType"); + switch (historyConverterType) { + case "DEFAULT": + type = History.HistoryConverterType.DEFAULT; + break; + case "SIMPLE": + type = History.HistoryConverterType.SIMPLE; + break; + default: + type = History.HistoryConverterType.NONE; + break; + } + historyMetaData[0] = new HistoryMetaData(historyMetaDataProps.getProperty(s + ".historyConverter"), + type) { + @Override + public String getHistoryConverterClassName() { + return super.getHistoryConverterClassName(); + } + }; + }); + return historyMetaData.length == 0 ? null : historyMetaData[0]; + } +} diff --git a/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/internal/history/PlaceServiceTest.java b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/internal/history/PlaceServiceTest.java new file mode 100644 index 0000000..6f03a9a --- /dev/null +++ b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/internal/history/PlaceServiceTest.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.junit.test.core.internal.history; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Properties; + +import com.github.mvp4g.junit.test.core.stub.DefaultHistoryProxyStubImpl; +import com.github.mvp4g.junit.test.core.stub.EventBusStub; +import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; +import com.github.mvp4g.mvp4g2.core.history.IsHistoryConverter; +import com.github.mvp4g.mvp4g2.core.history.annotation.History; +import com.github.mvp4g.mvp4g2.core.internal.history.PlaceService; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * PlaceService Tester. + * + * @author + * @version 1.0 + * @since
Apr 29, 2018
+ */ +public class PlaceServiceTest { + + private IsEventBus eventBus; + private PlaceService placeService; + + + @Before + public void before() + throws Exception { + this.placeService = new PlaceService<>(new EventBusStub(), + new DefaultHistoryProxyStubImpl(), + false, + false); + // add EventMetaData + + // add HistoryMetaData + } + + @Test + public void testPlaceCrawlable() { + String eventName = "eventName"; + // add history converter + getHistoryMetaData(placeService, + "HistoryConverterWithoutCrawable.properties"); + // addEventName +// EventMetaData eventMetaData = new EventMetaData() { +// } +// +// +// +// placeServiceDefault.addConverter(historyName, +// buildHistoryConverter(true)); +// placeServiceDefault.place(historyName, +// null, +// false); +// assertEquals("!" + historyName, +// history.getToken()); +// assertFalse(history.isIssueEvent()); + } + + private void getHistoryMetaData(PlaceService placeService, + String uri) { + ClassLoader loader = Thread.currentThread() + .getContextClassLoader(); + Properties historyMetaData = new Properties(); + try (InputStream resourceStream = loader.getResourceAsStream(uri)) { + historyMetaData.load(resourceStream); + } catch (IOException e) { + Assert.fail("Resource >>" + uri + "<< not found!"); + } + String[] historyConverters = historyMetaData.getProperty("historyConverters").split(","); + Arrays.stream(historyConverters).forEach(s -> { + History.HistoryConverterType type; + String historyConverterType = historyMetaData.getProperty(s + ".historyConverterType"); + switch (historyConverterType) { + case "DEFAULT": + type = History.HistoryConverterType.DEFAULT; + break; + case "SIMPLE": + type = History.HistoryConverterType.SIMPLE; + break; + default: + type = History.HistoryConverterType.NONE; + break; + } +// HistoryMetaData metaData = new HistoryMetaData(historyMetaData.getProperty(s + ".historyConverter"), type)); + + }); + +// return new EventMetaData(eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventName"), +// eventMetaDataProps.getProperty("historyName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// ); +// return new HistoryMetaData(historyMetaData.get(historyMetaData.get())); + } + + private IsHistoryConverter buildHistoryConverter(final boolean crawlable) { + return new IsHistoryConverter() { + + public void convertFromToken(String eventType, + String form, + EventBusStub eventBus) { +// eventBus.dispatch(eventType, +// form); + } + + public boolean isCrawlable() { + return crawlable; + } + + }; + } + +// private EventMetaData getEventMetaData(String uri) { +// ClassLoader loader = Thread.currentThread().getContextClassLoader(); +// Properties eventMetaDataProps = new Properties(); +// try(InputStream resourceStream = loader.getResourceAsStream(uri)) { +// eventMetaDataProps.load(resourceStream); +// } catch (IOException e) { +// Assert.that(false, "Resource >>" + uri + "<< not found!"); +// } +// return new EventMetaData(eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventName"), +// eventMetaDataProps.getProperty("historyName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// eventMetaDataProps.getProperty("eventInternalName"), +// ); +// +// } +// +// +// String internalEventName, +// String eventName, +// String historyName, +// HistoryMetaData historyMetaData, +// IsHistoryConverter historyConverter, +// boolean passive, +// boolean navigationEvent +// this.placeService.set + + +} diff --git a/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/DefaultHistoryProxyStubImpl.java b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/DefaultHistoryProxyStubImpl.java new file mode 100644 index 0000000..de72e8e --- /dev/null +++ b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/DefaultHistoryProxyStubImpl.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.junit.test.core.stub; + +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; +import com.github.mvp4g.mvp4g2.core.internal.history.IsHistoryProxy; +import com.github.mvp4g.mvp4g2.core.internal.history.PopStateHandler; + +@Mvp4g2InternalUse +public class DefaultHistoryProxyStubImpl + implements IsHistoryProxy { + + @Override + public void addPopStateListener(PopStateHandler handler) { + // do nothing ... it's JUnit ... no History ... + } + + @Override + public String getLocation() { + return "JunitTest"; + } + + @Override + public void pushState(String param, + String title, + String url) { + // do nothing ... it's JUnit ... no History ... + } + +} diff --git a/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/EventBusStub.java b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/EventBusStub.java new file mode 100644 index 0000000..501a069 --- /dev/null +++ b/mvp4g2/etc/backUp/test/java/com/github/mvp4g/junit/test/core/stub/EventBusStub.java @@ -0,0 +1,764 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ +package com.github.mvp4g.junit.test.core.stub; + +import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; +import com.github.mvp4g.mvp4g2.core.eventbus.PresenterRegistration; +import com.github.mvp4g.mvp4g2.core.eventbus.annotation.Debug; +import com.github.mvp4g.mvp4g2.core.Mvp4g2RuntimeException; +import com.github.mvp4g.mvp4g2.core.internal.eventbus.AbstractEventBus; +import com.github.mvp4g.mvp4g2.core.internal.eventbus.DefaultMvp4g2Logger; +import com.github.mvp4g.mvp4g2.core.ui.IsPresenter; + +public final class EventBusStub + extends AbstractEventBus + implements IsEventBus { + + public EventBusStub() { + super("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter"); + } + + @Override + public void loadDebugConfiguration() { + super.setDebugEnable(true); + super.setLogger(new DefaultMvp4g2Logger()); + super.setLogLevel(Debug.LogLevel.SIMPLE); + } + + @Override + public void loadFilterConfiguration() { + super.setFiltersEnable(false); + } + + @Override + protected void loadEventMetaData() { +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setNavigation +// // +// super.putEventMetaData("setNavigation_pPp_elemental2_dom_Element", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setNavigation()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setStatus +// // +// super.putEventMetaData("setStatus_pPp_java_lang_String", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setStatus()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoList +// // +// super.putEventMetaData("gotoList_pPp_java_lang_String_pPp_java_lang_String", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoList()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_start +// // +// super.putEventMetaData("start", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_start()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoDetail +// // +// super.putEventMetaData("gotoDetail_pPp_long", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoDetail()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setContent +// // +// super.putEventMetaData("setContent_pPp_elemental2_dom_Element", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_setContent()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_initHistory +// // +// super.putEventMetaData("initHistory", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_initHistory()); +// // +// // ---------------------------------------------------------------------- +// // +// // handle De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoSearch +// // +// super.putEventMetaData("gotoSearch_pPp_java_lang_String_pPp_java_lang_String", +// new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_Mvp4g2SimpleApplicationEventBus_gotoSearch()); + } + + @Override + protected void loadEventHandlerMetaData() { +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter (Presenter) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData(); +// super.putPresenterMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData.getPresenter() +// .setEventBus(this); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData.getPresenter() +// .setView(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData.getView()); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData.getView() +// .setPresenter(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_shell_ShellPresenterMetaData.getPresenter()); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter (Presenter) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData(); +// super.putPresenterMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData.getPresenter() +// .setEventBus(this); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData.getPresenter() +// .setView(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData.getView()); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData.getView() +// .setPresenter(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_navigation_NavigationPresenterMetaData.getPresenter()); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter (Presenter) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData(); +// super.putPresenterMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData.getPresenter() +// .setEventBus(this); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData.getPresenter() +// .setView(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData.getView()); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData.getView() +// .setPresenter(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_list_ListPresenterMetaData.getPresenter()); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter (Presenter) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData(); +// super.putPresenterMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData.getPresenter() +// .setEventBus(this); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData.getPresenter() +// .setView(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData.getView()); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData.getView() +// .setPresenter(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_detail_DetailPresenterMetaData.getPresenter()); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter (Presenter) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData(); +// super.putPresenterMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData.getPresenter() +// .setEventBus(this); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData.getPresenter() +// .setView(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData.getView()); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData.getView() +// .setPresenter(de_gishmo_gwt_example_mvp4g2_simpleapplication_client_ui_search_SearchPresenterMetaData.getPresenter()); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 (EventHandler) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler02MetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler02MetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler02MetaData(); +// super.putHandlerMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler02MetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler02MetaData.getHandler() +// .setEventBus(this); +// // +// // ===> +// // handle de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 (EventHandler) +// // +// De_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler01MetaData de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler01MetaData = new De_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler01MetaData(); +// super.putHandlerMetaData("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01", +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler01MetaData); +// de_gishmo_gwt_example_mvp4g2_simpleapplication_client_handler_SimpleApplicationHandler01MetaData.getHandler() +// .setEventBus(this); +// // +// // ===> add the handler to the handler list of the EventMetaData-class +// super.getEventMetaData("setNavigation_pPp_elemental2_dom_Element") +// .addHandler("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.getEventMetaData("gotoDetail_pPp_long") +// .addHandler("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.getEventMetaData("gotoList_pPp_java_lang_String_pPp_java_lang_String") +// .addHandler("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.getEventMetaData("gotoSearch_pPp_java_lang_String_pPp_java_lang_String") +// .addHandler("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); + } + + @Override + public final void fireStartEvent() { + this.start(); + } + + // @Override + public final void start() { + int startLogDepth = AbstractEventBus.logDepth; + try { + execStart(); + } finally { + AbstractEventBus.logDepth = startLogDepth; + } + } + + public final void execStart() { + super.logEvent(++AbstractEventBus.logDepth, + "start"); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("start")) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("start"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 +// handlers = this.handlerMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02"); +// super.executeHandler(eventMetaData, +// handlers, +// null, +// new AbstractEventBus.ExecHandler() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// HandlerMetaData metaData) { +// return metaData.getHandler() +// .pass(eventMetaData.getEventName()); +// } +// +// @Override +// public void execEventHandlingMethod(HandlerMetaData metaData) { +// ((SimpleApplicationHandler02) metaData.getHandler()).onStart(); +// } +// }, +// false); + } + + @Override + public final void fireInitHistoryEvent() { + this.initHistory(); + } + + public final void initHistory() { + int startLogDepth = AbstractEventBus.logDepth; + try { + execInitHistory(); + } finally { + AbstractEventBus.logDepth = startLogDepth; + } + } + + public final void execInitHistory() { +// super.logEvent(++AbstractEventBus.logDepth, +// "initHistory"); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("initHistory")) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("initHistory"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// null, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName()); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((SearchPresenter) metaData.getPresenter()).onInitHistory(); +// } +// }, +// false); + } + + @Override + public final void fireNotFoundHistoryEvent() { + this.initHistory(); + } + +// @Override +// public final void setNavigation(final Element element) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// execSetNavigation(element); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execSetNavigation(final Element element) { +// super.logEvent(++AbstractEventBus.logDepth, +// "setNavigation", +// element); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("setNavigation", +// element)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("setNavigation_pPp_elemental2_dom_Element"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// element); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// null, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// element); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((ShellPresenter) metaData.getPresenter()).onSetNavigation(element); +// } +// }, +// false); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +// handlers = this.handlerMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.executeHandler(eventMetaData, +// handlers, +// null, +// new AbstractEventBus.ExecHandler() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// HandlerMetaData metaData) { +// return metaData.getHandler() +// .pass(eventMetaData.getEventName(), +// element); +// } +// +// @Override +// public void execEventHandlingMethod(HandlerMetaData metaData) { +// ((SimpleApplicationHandler01) metaData.getHandler()).onSetNavigation(element); +// } +// }, +// false); +// } +// +// @Override +// public final void setStatus(final String status) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// execSetStatus(status); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execSetStatus(final String status) { +// super.logEvent(++AbstractEventBus.logDepth, +// "setStatus", +// status); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("setStatus", +// status)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("setStatus_pPp_java_lang_String"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// status); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// null, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// status); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((ShellPresenter) metaData.getPresenter()).onSetStatus(status); +// } +// }, +// false); +// } +// +// @Override +// public final void gotoList(final String searchName, +// final String searchOrt) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// super.logAskingForConfirmation(++AbstractEventBus.logDepth, +// "gotoList", +// searchName, +// searchOrt); +// super.placeService.confirmEvent(new NavigationEventCommand(this) { +// @Override +// public void execute() { +// execGotoList(searchName, +// searchOrt); +// } +// }); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execGotoList(final String searchName, +// final String searchOrt) { +// super.logEvent(++AbstractEventBus.logDepth, +// "gotoList", +// searchName, +// searchOrt); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("gotoList", +// searchName, +// searchOrt)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("gotoList_pPp_java_lang_String_pPp_java_lang_String"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// searchName, +// searchOrt); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// searchName, +// searchOrt); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((ListPresenter) metaData.getPresenter()).onGotoList(searchName, +// searchOrt); +// } +// }, +// true); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +// handlers = this.handlerMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.executeHandler(eventMetaData, +// handlers, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecHandler() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// HandlerMetaData metaData) { +// return metaData.getHandler() +// .pass(eventMetaData.getEventName(), +// searchName, +// searchOrt); +// } +// +// @Override +// public void execEventHandlingMethod(HandlerMetaData metaData) { +// ((SimpleApplicationHandler01) metaData.getHandler()).onGotoList(searchName, +// searchOrt); +// } +// }, +// true); +// if (listOfExecutedHandlers.size() > 0) { +// super.placeService.place("gotoList", +// ((de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter) super.placeService.getHistoryConverter("gotoList")).convertToToken("gotoList", +// searchName, +// searchOrt), +// false); +// } +// } +// +// @Override +// public final void gotoDetail(final long id) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// super.logAskingForConfirmation(++AbstractEventBus.logDepth, +// "gotoDetail", +// id); +// super.placeService.confirmEvent(new NavigationEventCommand(this) { +// @Override +// public void execute() { +// execGotoDetail(id); +// } +// }); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execGotoDetail(final long id) { +// super.logEvent(++AbstractEventBus.logDepth, +// "gotoDetail", +// id); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("gotoDetail", +// id)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("gotoDetail_pPp_long"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// id); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// id); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((DetailPresenter) metaData.getPresenter()).onGotoDetail(id); +// } +// }, +// true); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +// handlers = this.handlerMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.executeHandler(eventMetaData, +// handlers, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecHandler() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// HandlerMetaData metaData) { +// return metaData.getHandler() +// .pass(eventMetaData.getEventName(), +// id); +// } +// +// @Override +// public void execEventHandlingMethod(HandlerMetaData metaData) { +// ((SimpleApplicationHandler01) metaData.getHandler()).onGotoDetail(id); +// } +// }, +// true); +// if (listOfExecutedHandlers.size() > 0) { +// super.placeService.place("gotoDetail", +// ((de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter) super.placeService.getHistoryConverter("gotoDetail")).convertToToken("gotoDetail", +// id), +// false); +// } +// } +// +// @Override +// public final void setContent(final Element element) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// execSetContent(element); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execSetContent(final Element element) { +// super.logEvent(++AbstractEventBus.logDepth, +// "setContent", +// element); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("setContent", +// element)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("setContent_pPp_elemental2_dom_Element"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// element); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// null, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// element); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((ShellPresenter) metaData.getPresenter()).onSetContent(element); +// } +// }, +// false); +// } +// +// @Override +// public final void gotoSearch(final String searchName, +// final String searchOrt) { +// int startLogDepth = AbstractEventBus.logDepth; +// try { +// super.logAskingForConfirmation(++AbstractEventBus.logDepth, +// "gotoSearch", +// searchName, +// searchOrt); +// super.placeService.confirmEvent(new NavigationEventCommand(this) { +// @Override +// public void execute() { +// execGotoSearch(searchName, +// searchOrt); +// } +// }); +// } finally { +// AbstractEventBus.logDepth = startLogDepth; +// } +// } +// +// public final void execGotoSearch(final String searchName, +// final String searchOrt) { +// super.logEvent(++AbstractEventBus.logDepth, +// "gotoSearch", +// searchName, +// searchOrt); +// ++AbstractEventBus.logDepth; +// if (!super.filterEvent("gotoSearch", +// searchName, +// searchOrt)) { +// return; +// } +// EventMetaData eventMetaData = super.getEventMetaData("gotoSearch_pPp_java_lang_String_pPp_java_lang_String"); +// super.createAndBindView(eventMetaData); +// super.bind(eventMetaData, +// searchName, +// searchOrt); +// super.activate(eventMetaData); +// super.deactivate(eventMetaData); +// List> handlers = null; +// List> presenters = null; +// List listOfExecutedHandlers = new ArrayList<>(); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter +// presenters = this.presenterMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter"); +// super.executePresenter(eventMetaData, +// presenters, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecPresenter() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// PresenterMetaData metaData) { +// return metaData.getPresenter() +// .pass(eventMetaData.getEventName(), +// searchName, +// searchOrt); +// } +// +// @Override +// public void execEventHandlingMethod(PresenterMetaData metaData) { +// ((SearchPresenter) metaData.getPresenter()).onGotoSearch(searchName, +// searchOrt); +// } +// }, +// true); +// // handling: de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +// handlers = this.handlerMetaDataMap.get("de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01"); +// super.executeHandler(eventMetaData, +// handlers, +// listOfExecutedHandlers, +// new AbstractEventBus.ExecHandler() { +// @Override +// public boolean execPass(EventMetaData eventMetaData, +// HandlerMetaData metaData) { +// return metaData.getHandler() +// .pass(eventMetaData.getEventName(), +// searchName, +// searchOrt); +// } +// +// @Override +// public void execEventHandlingMethod(HandlerMetaData metaData) { +// ((SimpleApplicationHandler01) metaData.getHandler()).onGotoSearch(searchName, +// searchOrt); +// } +// }, +// true); +// if (listOfExecutedHandlers.size() > 0) { +// super.placeService.place("gotoSearch", +// ((de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter) super.placeService.getHistoryConverter("gotoSearch")).convertToToken("gotoSearch", +// searchName, +// searchOrt), +// false); +// } +// } + + @Override + public PresenterRegistration addHandler(IsPresenter presenter, + boolean bind) + throws + Mvp4g2RuntimeException { + throw new Mvp4g2RuntimeException(presenter.getClass() + .getCanonicalName() + ": can not be used with the addHandler()-method, because it is not defined as multiple presenter!"); + } +} diff --git a/mvp4g2/etc/backUp/test/resources/HistoryConverterWithoutCrawable.properties b/mvp4g2/etc/backUp/test/resources/HistoryConverterWithoutCrawable.properties new file mode 100644 index 0000000..823fdb9 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/HistoryConverterWithoutCrawable.properties @@ -0,0 +1,20 @@ +# +# Copyright (c) 2018 - Frank Hossfeld +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# + +com.github.mvp4g.junit.test.core.stub.DefaultHistoryProxyStubImpl.historyConverter=com.github.mvp4g.junit.test.core.stub.DefaultHistoryProxyStubImpl +com.github.mvp4g.junit.test.core.stub.DefaultHistoryProxyStubImpl.historyConverterType=SIMPLE +historyConverters=com.github.mvp4g.junit.test.core.stub.DefaultHistoryProxyStubImpl \ No newline at end of file diff --git a/mvp4g2/etc/backUp/test/resources/application.properties b/mvp4g2/etc/backUp/test/resources/application.properties new file mode 100644 index 0000000..f3aaddf --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/application.properties @@ -0,0 +1,7 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +loader=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.Mvp4g2SimpleApplicationLoader +eventBus=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.Mvp4g2SimpleApplicationEventBus +encodeToken=false +application=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.Mvp4g2SimpleApplicationApplication +historyOnStart=true diff --git a/mvp4g2/etc/backUp/test/resources/eventBus.properties b/mvp4g2/etc/backUp/test/resources/eventBus.properties new file mode 100644 index 0000000..df0a864 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/eventBus.properties @@ -0,0 +1,10 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +debugLogLevel=SIMPLE +eventBus=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.Mvp4g2SimpleApplicationEventBus +hasFiltersAnnotation=false +debugLogger=com.github.mvp4g.mvp4g2.core.internal.eventbus.DefaultMvp4g2Logger +hasDebugAnnotation=true +events=setNavigation_pPp_elemental2_dom_Element,setStatus_pPp_java_lang_String,gotoList_pPp_java_lang_String_pPp_java_lang_String,start,gotoDetail_pPp_long,setContent_pPp_elemental2_dom_Element,initHistory,gotoSearch_pPp_java_lang_String_pPp_java_lang_String +shell=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +filters= diff --git a/mvp4g2/etc/backUp/test/resources/gotoDetail_pPp_long.properties b/mvp4g2/etc/backUp/test/resources/gotoDetail_pPp_long.properties new file mode 100644 index 0000000..ef55e70 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/gotoDetail_pPp_long.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=gotoDetail_pPp_long +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter +startEvent=false +navigationEvent=true +notFoundHistory=false +deactivateHandlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 +activateHandlers= +eventName=gotoDetail +historyEventName=C3PO +initHistory=false +historyConverter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter +passive=false +parameters=id_tTt_long diff --git a/mvp4g2/etc/backUp/test/resources/gotoList_pPp_java_lang_String_pPp_java_lang_String.properties b/mvp4g2/etc/backUp/test/resources/gotoList_pPp_java_lang_String_pPp_java_lang_String.properties new file mode 100644 index 0000000..12ad502 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/gotoList_pPp_java_lang_String_pPp_java_lang_String.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=gotoList_pPp_java_lang_String_pPp_java_lang_String +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter +startEvent=false +navigationEvent=true +notFoundHistory=false +deactivateHandlers= +activateHandlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 +eventName=gotoList +historyEventName=C2N2 +initHistory=false +historyConverter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter +passive=false +parameters=searchName_tTt_java.lang.String,searchOrt_tTt_java.lang.String diff --git a/mvp4g2/etc/backUp/test/resources/gotoSearch_pPp_java_lang_String_pPp_java_lang_String.properties b/mvp4g2/etc/backUp/test/resources/gotoSearch_pPp_java_lang_String_pPp_java_lang_String.properties new file mode 100644 index 0000000..aaf465b --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/gotoSearch_pPp_java_lang_String_pPp_java_lang_String.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=gotoSearch_pPp_java_lang_String_pPp_java_lang_String +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter +startEvent=false +navigationEvent=true +notFoundHistory=false +deactivateHandlers= +activateHandlers= +eventName=gotoSearch +historyEventName=R2D2 +initHistory=false +historyConverter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter +passive=false +parameters=searchName_tTt_java.lang.String,searchOrt_tTt_java.lang.String diff --git a/mvp4g2/etc/backUp/test/resources/handler.properties b/mvp4g2/etc/backUp/test/resources/handler.properties new file mode 100644 index 0000000..cce35a5 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/handler.properties @@ -0,0 +1,7 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02.handlerClassName=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01.handledEvents=onSetNavigation_pPp_elemental2_dom_Element,onGotoDetail_pPp_long,onGotoList_pPp_java_lang_String_pPp_java_lang_String,onGotoSearch_pPp_java_lang_String_pPp_java_lang_String +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02,de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01.handlerClassName=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler01 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02.handledEvents= diff --git a/mvp4g2/etc/backUp/test/resources/history.properties b/mvp4g2/etc/backUp/test/resources/history.properties new file mode 100644 index 0000000..2450614 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/history.properties @@ -0,0 +1,5 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter.historyConverter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter.historyConverterType=SIMPLE +historyConverters=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.history.DefaultHistoryConverter diff --git a/mvp4g2/etc/backUp/test/resources/initHistory.properties b/mvp4g2/etc/backUp/test/resources/initHistory.properties new file mode 100644 index 0000000..0fc8087 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/initHistory.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=initHistory +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter +startEvent=false +navigationEvent=false +notFoundHistory=true +deactivateHandlers= +activateHandlers= +eventName=initHistory +historyEventName=\#%\!|&*+\!\#\#%$ +initHistory=true +historyConverter=com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event.NoHistoryConverter +passive=false +parameters= diff --git a/mvp4g2/etc/backUp/test/resources/presenter.properties b/mvp4g2/etc/backUp/test/resources/presenter.properties new file mode 100644 index 0000000..e33c218 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/presenter.properties @@ -0,0 +1,38 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.isMultiple=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.viewInterface=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.IListView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.presenter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.viewClass=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.handledEvents= +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.viewCreationMethod=FRAMEWORK +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.isMultiple=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.presenter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.handledEvents= +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.viewClass=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.viewInterface=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.INavigationView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.isShell=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.presenter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.isShell=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.viewClass=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.isMultiple=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.presenter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.isMultiple=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.viewClass=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.viewInterface=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.IShellView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.presenter=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter +presenters=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter,de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter,de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter,de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter,de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.viewClass=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.isMultiple=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.handledEvents= +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.handledEvents= +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.viewCreationMethod=PRESENTER +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.isShell=false +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.viewCreationMethod=PRESENTER +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.viewCreationMethod=PRESENTER +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.handledEvents= +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.DetailPresenter.viewInterface=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.detail.IDetailView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter.viewCreationMethod=FRAMEWORK +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter.isShell=true +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.SearchPresenter.viewInterface=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.search.ISearchView +de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.list.ListPresenter.isShell=false diff --git a/mvp4g2/etc/backUp/test/resources/setContent_pPp_elemental2_dom_Element.properties b/mvp4g2/etc/backUp/test/resources/setContent_pPp_elemental2_dom_Element.properties new file mode 100644 index 0000000..d70a8e8 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/setContent_pPp_elemental2_dom_Element.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=setContent_pPp_elemental2_dom_Element +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +startEvent=false +navigationEvent=false +notFoundHistory=false +deactivateHandlers= +activateHandlers= +eventName=setContent +historyEventName=\#%\!|&*+\!\#\#%$ +initHistory=false +historyConverter=com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event.NoHistoryConverter +passive=false +parameters=element_tTt_elemental2.dom.Element diff --git a/mvp4g2/etc/backUp/test/resources/setNavigation_pPp_elemental2_dom_Element.properties b/mvp4g2/etc/backUp/test/resources/setNavigation_pPp_elemental2_dom_Element.properties new file mode 100644 index 0000000..b331603 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/setNavigation_pPp_elemental2_dom_Element.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=setNavigation_pPp_elemental2_dom_Element +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +startEvent=false +navigationEvent=false +notFoundHistory=false +deactivateHandlers= +activateHandlers= +eventName=setNavigation +historyEventName=\#%\!|&*+\!\#\#%$ +initHistory=false +historyConverter=com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event.NoHistoryConverter +passive=false +parameters=element_tTt_elemental2.dom.Element diff --git a/mvp4g2/etc/backUp/test/resources/setStatus_pPp_java_lang_String.properties b/mvp4g2/etc/backUp/test/resources/setStatus_pPp_java_lang_String.properties new file mode 100644 index 0000000..4603a20 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/setStatus_pPp_java_lang_String.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=setStatus_pPp_java_lang_String +bindings= +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.shell.ShellPresenter +startEvent=false +navigationEvent=false +notFoundHistory=false +deactivateHandlers= +activateHandlers= +eventName=setStatus +historyEventName=\#%\!|&*+\!\#\#%$ +initHistory=false +historyConverter=com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event.NoHistoryConverter +passive=false +parameters=status_tTt_java.lang.String diff --git a/mvp4g2/etc/backUp/test/resources/start.properties b/mvp4g2/etc/backUp/test/resources/start.properties new file mode 100644 index 0000000..d691611 --- /dev/null +++ b/mvp4g2/etc/backUp/test/resources/start.properties @@ -0,0 +1,16 @@ +# +#Sun Apr 29 08:29:04 CEST 2018 +eventInternalName=start +bindings=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui.navigation.NavigationPresenter +handlers=de.gishmo.gwt.example.mvp4g2.simpleapplication.client.handler.SimpleApplicationHandler02 +startEvent=true +navigationEvent=false +notFoundHistory=false +deactivateHandlers= +activateHandlers= +eventName=start +historyEventName=\#%\!|&*+\!\#\#%$ +initHistory=false +historyConverter=com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event.NoHistoryConverter +passive=false +parameters= diff --git a/mvp4g2/pom.xml b/mvp4g2/pom.xml index 7b53fde..5f0f6cf 100644 --- a/mvp4g2/pom.xml +++ b/mvp4g2/pom.xml @@ -25,14 +25,13 @@ com.github.mvp4g mvp4g2-parent - 1.0.0 + 1.0.1 mvp4g2 jar Model View Presenter with Event Bus For GWT 2 + 3 based on APT - 2018 @@ -76,6 +75,18 @@ elemental2-dom ${elemental2.version}
+ + junit + junit + ${junit.version} + test + + + junit + junit + 4.12 + compile +
diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2RuntimeException.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/Mvp4g2RuntimeException.java similarity index 96% rename from mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2RuntimeException.java rename to mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/Mvp4g2RuntimeException.java index 840edb9..975dfee 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2RuntimeException.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/Mvp4g2RuntimeException.java @@ -15,7 +15,7 @@ * */ -package com.github.mvp4g.mvp4g2.core.internal; +package com.github.mvp4g.mvp4g2.core; @SuppressWarnings("serial") public class Mvp4g2RuntimeException diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/eventbus/IsEventBus.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/eventbus/IsEventBus.java index b495be7..15060fb 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/eventbus/IsEventBus.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/eventbus/IsEventBus.java @@ -18,7 +18,7 @@ package com.github.mvp4g.mvp4g2.core.eventbus; import com.github.mvp4g.mvp4g2.core.history.IsNavigationConfirmation; -import com.github.mvp4g.mvp4g2.core.history.PlaceService; +import com.github.mvp4g.mvp4g2.core.internal.history.PlaceService; import com.github.mvp4g.mvp4g2.core.ui.IsPresenter; public interface IsEventBus { @@ -39,7 +39,7 @@ public interface IsEventBus { void fireNotFoundHistoryEvent(); /** - * Framework m,ethod to set the shell + * Framework method to set the shell *
* Do not use! */ diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Base64Utils.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Base64Utils.java index e06c266..a475bc8 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Base64Utils.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Base64Utils.java @@ -21,6 +21,7 @@ * A utility to decode and encode byte arrays as Strings, using only "safe" * characters. */ +@Mvp4g2InternalUse public class Base64Utils { /** * An array mapping size but values to the characters that will be used to diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ForInternalUseOnly.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2InternalUse.java similarity index 85% rename from mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ForInternalUseOnly.java rename to mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2InternalUse.java index f4ad99e..dc1c115 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ForInternalUseOnly.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/Mvp4g2InternalUse.java @@ -23,10 +23,11 @@ /** * Annotation to mark classes, which will used by the framework. *
- *

Do not use lasses annotated with internalFrameworkClass!

+ *

Do not use classes annotated with Mvp4g2InternalUse! This + * classes can change without any announcement.

* * @author Frank Hossfeld */ @Retention(RetentionPolicy.RUNTIME) -public @interface ForInternalUseOnly { +public @interface Mvp4g2InternalUse { } diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/AbstractApplication.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/AbstractApplication.java index 642df82..30650f5 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/AbstractApplication.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/AbstractApplication.java @@ -17,14 +17,17 @@ package com.github.mvp4g.mvp4g2.core.internal.application; -import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; -import com.github.mvp4g.mvp4g2.core.history.PlaceService; import com.github.mvp4g.mvp4g2.core.application.IsApplication; import com.github.mvp4g.mvp4g2.core.application.IsApplicationLoader; +import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; +import com.github.mvp4g.mvp4g2.core.internal.history.PlaceService; +import com.github.mvp4g.mvp4g2.core.internal.history.impl.DefaultHistoryProxyImpl; /** * generator of the eventBus */ +@Mvp4g2InternalUse public abstract class AbstractApplication implements IsApplication { @@ -51,6 +54,7 @@ public void run() { private void onFinishLaoding() { // create place service and bind this.placeService = new PlaceService(this.eventBus, + new DefaultHistoryProxyImpl(), historyOnStart, encodeToken); this.eventBus.setPlaceService(this.placeService); diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/NoApplicationLoader.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/NoApplicationLoader.java index 1d21949..18faf7a 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/NoApplicationLoader.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/application/NoApplicationLoader.java @@ -18,14 +18,14 @@ package com.github.mvp4g.mvp4g2.core.internal.application; import com.github.mvp4g.mvp4g2.core.application.IsApplicationLoader; -import com.github.mvp4g.mvp4g2.core.internal.ForInternalUseOnly; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; /** * Default applilcation loader *

does nothing

*

Used by the framework

*/ -@ForInternalUseOnly +@Mvp4g2InternalUse public final class NoApplicationLoader implements IsApplicationLoader { diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/AbstractEventBus.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/AbstractEventBus.java index 38f1bd1..cc3e43e 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/AbstractEventBus.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/AbstractEventBus.java @@ -30,8 +30,8 @@ import com.github.mvp4g.mvp4g2.core.eventbus.annotation.Debug; import com.github.mvp4g.mvp4g2.core.history.IsHistoryConverter; import com.github.mvp4g.mvp4g2.core.history.IsNavigationConfirmation; -import com.github.mvp4g.mvp4g2.core.history.PlaceService; -import com.github.mvp4g.mvp4g2.core.internal.ForInternalUseOnly; +import com.github.mvp4g.mvp4g2.core.internal.history.PlaceService; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; import com.github.mvp4g.mvp4g2.core.internal.ui.HandlerMetaData; import com.github.mvp4g.mvp4g2.core.internal.ui.PresenterMetaData; import com.github.mvp4g.mvp4g2.core.internal.ui.PresenterMetaDataRegistration; @@ -42,7 +42,7 @@ import static java.util.Objects.isNull; -@ForInternalUseOnly +@Mvp4g2InternalUse public abstract class AbstractEventBus implements IsEventBus { diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/DefaultMvp4g2Logger.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/DefaultMvp4g2Logger.java index 5628a36..def686f 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/DefaultMvp4g2Logger.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/DefaultMvp4g2Logger.java @@ -21,12 +21,14 @@ import com.github.mvp4g.mvp4g2.core.Mvp4g2; import com.github.mvp4g.mvp4g2.core.eventbus.IsMvp4g2Logger; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; /** * Default implementation of Mvp4gLogger. * * @author plcoirier */ +@Mvp4g2InternalUse public class DefaultMvp4g2Logger implements IsMvp4g2Logger { diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/EventMetaData.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/EventMetaData.java index 8b41eee..5a86aec 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/EventMetaData.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/eventbus/EventMetaData.java @@ -25,6 +25,7 @@ import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; import com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event; import com.github.mvp4g.mvp4g2.core.history.IsHistoryConverter; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; import com.github.mvp4g.mvp4g2.core.internal.history.HistoryMetaData; import static java.util.Objects.isNull; @@ -32,6 +33,7 @@ /** * generator of the eventbus */ +@Mvp4g2InternalUse public abstract class EventMetaData { /* name of the event */ diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/HistoryMetaData.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/HistoryMetaData.java index 5560b1c..39312bf 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/HistoryMetaData.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/HistoryMetaData.java @@ -18,10 +18,12 @@ package com.github.mvp4g.mvp4g2.core.internal.history; import com.github.mvp4g.mvp4g2.core.history.annotation.History; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; /** * meta data history annotation */ +@Mvp4g2InternalUse public abstract class HistoryMetaData { /* class name of the history converter */ diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/IsHistoryProxy.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/IsHistoryProxy.java new file mode 100644 index 0000000..09193bb --- /dev/null +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/IsHistoryProxy.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.mvp4g2.core.internal.history; + +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; + +@Mvp4g2InternalUse +public interface IsHistoryProxy { + + void addPopStateListener(PopStateHandler handler); + + String getLocation(); + + void pushState(String param, + String title, + String url); + +} diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/history/PlaceService.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PlaceService.java similarity index 88% rename from mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/history/PlaceService.java rename to mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PlaceService.java index 3477135..e9c9e6f 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/history/PlaceService.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PlaceService.java @@ -15,19 +15,22 @@ * */ -package com.github.mvp4g.mvp4g2.core.history; +package com.github.mvp4g.mvp4g2.core.internal.history; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus; +import com.github.mvp4g.mvp4g2.core.history.IsHistoryConverter; +import com.github.mvp4g.mvp4g2.core.history.NavigationEventCommand; import com.github.mvp4g.mvp4g2.core.internal.Base64Utils; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; import com.github.mvp4g.mvp4g2.core.internal.eventbus.EventMetaData; -import elemental2.dom.DomGlobal; import static java.util.Objects.isNull; +@Mvp4g2InternalUse public class PlaceService { // private static final String MODULE_SEPARATOR = "/"; @@ -41,8 +44,11 @@ public class PlaceService { private Map> eventMetaDataMap; private Map historyNameMap; private boolean enabled = true; + /* history proxy - we use this proxy here, to avoid using Elemental 2 feature directly in this class! */ + private IsHistoryProxy historyProxy; public PlaceService(E eventBus, + IsHistoryProxy historyProxy, boolean historyOnStart, boolean encodeToken) { super(); @@ -51,32 +57,15 @@ public PlaceService(E eventBus, this.historyNameMap = new HashMap<>(); this.eventBus = eventBus; + this.historyProxy = historyProxy; this.historyOnStart = historyOnStart; this.encodeToken = encodeToken; - DomGlobal.window.addEventListener("popstate", - (e) -> confirmEvent(new NavigationEventCommand(eventBus) { - protected void execute() { - enabled = false; - convertToken(getTokenFromUrl(DomGlobal.window.location.toString())); - enabled = true; - } - })); - } - - /** - * Ask for user's confirmation before firing an event - * - * @param event event to confirm - */ - public void confirmEvent(NavigationEventCommand event) { - if (isNull(this.eventBus.getNavigationConfirmationPresenter())) { - //no need to remove the confirmation, there is none - event.fireEvent(false); - } else { - eventBus.getNavigationConfirmationPresenter() - .confirm(event); - } + this.historyProxy.addPopStateListener(event -> { + enabled = false; + convertToken(getTokenFromUrl(this.historyProxy.getLocation())); + enabled = true; + }); } /** @@ -177,6 +166,21 @@ protected String getParamSeparator() { return "?"; } + /** + * Ask for user's confirmation before firing an event + * + * @param event event to confirm + */ + public void confirmEvent(NavigationEventCommand event) { + if (isNull(this.eventBus.getNavigationConfirmationPresenter())) { + //no need to remove the confirmation, there is none + event.fireEvent(false); + } else { + eventBus.getNavigationConfirmationPresenter() + .confirm(event); + } + } + public void startApplication() { // the last thing we do, is to add the shell to the viewport eventBus.setShell(); @@ -185,7 +189,7 @@ public void startApplication() { // do we have history? if (this.hasHistory()) { if (this.historyOnStart) { - convertToken(getTokenFromUrl(DomGlobal.window.location.toString())); + convertToken(getTokenFromUrl(this.historyProxy.getLocation())); } else { eventBus.fireInitHistoryEvent(); } @@ -238,14 +242,18 @@ public String place(String eventName, } String token = tokenize(metaData.getHistoryName(), encodedParam); - // if (converters.get(eventName) - // .isCrawlable()) { - // token = CRAWLABLE + token; - // } + // crawable event + IsHistoryConverter historyConverter = this.getHistoryConverter(eventName); + if (historyConverter != null) { + if (historyConverter.isCrawlable()) { + token = CRAWLABLE + token; + } + } + // push history ... if (!onlyToken) { - DomGlobal.window.history.pushState(param, - "", - PlaceService.URL_SEPARATOR + token); + this.historyProxy.pushState(param, + "", + PlaceService.URL_SEPARATOR + token); } return token; } diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PopStateHandler.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PopStateHandler.java new file mode 100644 index 0000000..dc20619 --- /dev/null +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/PopStateHandler.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.mvp4g2.core.internal.history; + +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; +import elemental2.dom.PopStateEvent; + +@Mvp4g2InternalUse +@FunctionalInterface +public interface PopStateHandler { + + void onPopState(PopStateEvent event); + +} diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/impl/DefaultHistoryProxyImpl.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/impl/DefaultHistoryProxyImpl.java new file mode 100644 index 0000000..f615cce --- /dev/null +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/history/impl/DefaultHistoryProxyImpl.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 - Frank Hossfeld + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + +package com.github.mvp4g.mvp4g2.core.internal.history.impl; + +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; +import com.github.mvp4g.mvp4g2.core.internal.history.IsHistoryProxy; +import com.github.mvp4g.mvp4g2.core.internal.history.PopStateHandler; +import elemental2.dom.DomGlobal; +import elemental2.dom.PopStateEvent; + +@Mvp4g2InternalUse +public class DefaultHistoryProxyImpl + implements IsHistoryProxy { + + @Override + public void addPopStateListener(PopStateHandler handler) { + DomGlobal.window.addEventListener("popstate", + (e) -> handler.onPopState((PopStateEvent) e)); + } + + @Override + public String getLocation() { + return DomGlobal.window.location.toString(); + } + + @Override + public void pushState(String param, + String title, + String url) { + DomGlobal.window.history.pushState(param, + "", + url); + } + +} diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/AbstractHandlerMetaData.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/AbstractHandlerMetaData.java index 5a93d8c..a6fb2d8 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/AbstractHandlerMetaData.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/AbstractHandlerMetaData.java @@ -17,9 +17,12 @@ package com.github.mvp4g.mvp4g2.core.internal.ui; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; + /** * generator of the eventbus */ +@Mvp4g2InternalUse public abstract class AbstractHandlerMetaData { private String canonicalName; diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/HandlerMetaData.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/HandlerMetaData.java index aa68e8f..e888a74 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/HandlerMetaData.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/HandlerMetaData.java @@ -17,6 +17,7 @@ package com.github.mvp4g.mvp4g2.core.internal.ui; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; import com.github.mvp4g.mvp4g2.core.ui.IsHandler; /** @@ -24,6 +25,7 @@ * * @param

the meta data event handler */ +@Mvp4g2InternalUse public abstract class HandlerMetaData

> extends AbstractHandlerMetaData { diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaData.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaData.java index af3238f..9e0193e 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaData.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaData.java @@ -17,6 +17,7 @@ package com.github.mvp4g.mvp4g2.core.internal.ui; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; import com.github.mvp4g.mvp4g2.core.ui.IsLazyReverseView; import com.github.mvp4g.mvp4g2.core.ui.IsPresenter; import com.github.mvp4g.mvp4g2.core.ui.annotation.Presenter; @@ -27,6 +28,7 @@ * @param

the meta data presenter * @param

the meta data view */ +@Mvp4g2InternalUse public abstract class PresenterMetaData

, V extends IsLazyReverseView> extends AbstractHandlerMetaData { diff --git a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaDataRegistration.java b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaDataRegistration.java index 6a3ef95..4c6c281 100644 --- a/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaDataRegistration.java +++ b/mvp4g2/src/main/java/com/github/mvp4g/mvp4g2/core/internal/ui/PresenterMetaDataRegistration.java @@ -17,6 +17,9 @@ package com.github.mvp4g.mvp4g2.core.internal.ui; +import com.github.mvp4g.mvp4g2.core.internal.Mvp4g2InternalUse; + +@Mvp4g2InternalUse public interface PresenterMetaDataRegistration { void remove(); diff --git a/pom.xml b/pom.xml index 6f469c9..3921205 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ com.github.mvp4g mvp4g2-parent - 1.0.0 + 1.0.1 pom MVP4G 2 parent - Implementation of mvp4g for GWT 2 + 3 @@ -83,6 +83,8 @@ github + 4.12 + 1.8 1.8