public class ApplicationModule extends AbstractPresenterModule { @Override protected void configure() { install(new UiModule());
// Application Presenters bindPresenter(ApplicationPresenter.class, ApplicationPresenter.MyView.class, ApplicationView.class, ApplicationPresenter.MyProxy.class); bindPresenter(HomePresenter.class, HomePresenter.MyView.class, HomeView.class, HomePresenter.MyProxy.class); bindPresenter(DevicesPresenter.class, DevicesPresenter.MyView.class, DevicesView.class, DevicesPresenter.MyProxy.class); bindPresenter(ContainerListPresenter.class, ContainerListPresenter.MyView.class, ContainerListView.class, ContainerListPresenter.MyProxy.class); bindSingletonPresenterWidget(DeviceEditorDialogPresenterWidget.class, DeviceEditorDialogPresenterWidget.MyView.class, DeviceEditorDialogView.class); bindSingletonPresenterWidget(ContainerInfoPresenter.class, ContainerInfoPresenter.MyView.class, ContainerInfoView.class); bindSingletonPresenterWidget(SettingsPresenter.class, SettingsPresenter.MyView.class, SettingsView.class);
}}public class ApplicationPresenter extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy> implements CurrentUserChangedHandler, AsyncCallStartHandler, AsyncCallFailHandler, AsyncCallSucceedHandler { /** * {@link ApplicationPresenter}'s proxy. */ @ProxyStandard public interface MyProxy extends Proxy<ApplicationPresenter> { }
/** * {@link ApplicationPresenter}'s view. */ public interface MyView extends View { void setTopMessage(String string); } @ContentSlot public static final Type<RevealContentHandler<?>> SLOT_SetMainContent = new Type<>();
@Inject ApplicationPresenter(EventBus eventBus, MyView view, MyProxy proxy) { super(eventBus, view, proxy, RevealType.Root); }
@ProxyEvent @Override public void onCurrentUserChanged(CurrentUserChangedEvent event) { }
@ProxyEvent @Override public void onAsyncCallStart(AsyncCallStartEvent event) { getView().setTopMessage("Loading..."); }
@ProxyEvent @Override public void onAsyncCallFail(AsyncCallFailEvent event) { getView().setTopMessage("Oops, something went wrong..."); }
@ProxyEvent @Override public void onAsyncCallSucceed(AsyncCallSucceedEvent event) { getView().setTopMessage(null); }
@Override protected void onReveal() { // Workaround to set a body background in login page ScriptInjector.fromString("document.body.classList.remove('signin');") .setWindow(ScriptInjector.TOP_WINDOW).inject(); // Inject the js that must be executed when the document is ready, // after gwt code is deployed, js for the template ScriptInjector.fromString(JsClientBundle.INSTANCE.docuReadyJS().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); }}
public class NameTokens { public static final String homePage = "!homePage"; public static final String loginPage = "!loginPage"; public static final String containersPage = "!containersPage"; //TODO why do we have two devices things? public static final String devicesPage = "!devicesPage"; public static final String devicesDialog = "!devicesDialog"; public static final String uiExamplesPage = "!uiExamples"; public static final String settingsPage = "!settingsPage";
public static String getHomePage() { return homePage; } public static String getSettingsPage() { return settingsPage; } public static String getDevicesPage() { return devicesPage; } public static String getDevicesDialog() { return devicesDialog; } public static String getContainersPage() { return containersPage; }
public static String getUiExamplesPage() { return uiExamplesPage; }
}
public class SettingsPresenter extends Presenter<SettingsPresenter.MyView, SettingsPresenter.MyProxy> implements SettingsUiHandlers { Logger logger = Logger.getLogger("RootLogger"); /** * {@link SettingsPresenter}'s proxy. */ @ProxyCodeSplit @NameToken(NameTokens.settingsPage) // The first tab in the main page public interface MyProxy extends ProxyPlace<SettingsPresenter> { }
/** * {@link SettingsPresenter}'s view. */ public interface MyView extends View, HasUiHandlers<SettingsUiHandlers> { void setTitle(String title);
}
private DispatchAsync dispatcher;
@Inject SettingsPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, final DispatchAsync dispatcher) { super(eventBus, view, proxy, ApplicationPresenter.SLOT_SetMainContent); this.dispatcher = dispatcher; view.setUiHandlers(this); }
@Override protected void onReveal() { getView().setTitle("Trust|me MDM"); } @Override protected void onReset() { super.onReset(); }
public class ClientModule extends AbstractPresenterModule { @Override protected void configure() { install(new DefaultModule(DefaultPlaceManager.class)); install(new ApplicationModule()); install(new RpcDispatchAsyncModule()); // binds DispatchAsync to RpcDispatchAsync
bind(ClientModelProvider.class).in(Singleton.class); bind(CurrentUser.class).in(Singleton.class); bind(IsAdminGatekeeper.class).in(Singleton.class); bind(LoggedInGatekeeper.class).in(Singleton.class);
// DefaultPlaceManager Constants bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.homePage); bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.homePage); bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.loginPage);
// CSRF-Protection bindConstant().annotatedWith(SecurityCookie.class).to(ConstantHelper.securityCookie); // Load and inject CSS resources bind(ResourceLoader.class).asEagerSingleton(); }}--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ahhhh i see.