Example usage for com.google.gwt.event.shared HandlerManager HandlerManager

List of usage examples for com.google.gwt.event.shared HandlerManager HandlerManager

Introduction

In this page you can find the example usage for com.google.gwt.event.shared HandlerManager HandlerManager.

Prototype

public HandlerManager(Object source) 

Source Link

Document

Creates a handler manager with a source to be set on all events fired via #fireEvent(GwtEvent) .

Usage

From source file:com.ait.tooling.nativetools.client.storage.LocalStorage.java

License:Open Source License

public final HandlerRegistration addLocalStorageHandler(LocalStorageHandler handler) {
    handler = Objects.requireNonNull(handler);

    if (null == m_events) {
        m_events = new HandlerManager(this);
    }/*from  w  ww.j a  v  a 2 s. c  om*/
    if (isSupported()) {
        final HandlerRegistration proxy = Storage.addStorageEventHandler(new StorageEvent.Handler() {
            @Override
            public void onStorageChange(final StorageEvent event) {
                if (isLocalStorage(event)) {
                    m_events.fireEvent(new LocalStorageEvent(get(), event.getKey(), event.getOldValue(),
                            event.getNewValue()));
                }
            }
        });
        return new HandlerRegistrationManager(m_events.addHandler(LocalStorageEvent.TYPE, handler), proxy);
    }
    return m_events.addHandler(LocalStorageEvent.TYPE, handler);
}

From source file:com.ait.tooling.nativetools.client.storage.SessionStorage.java

License:Open Source License

public final HandlerRegistration addSessionStorageHandler(SessionStorageHandler handler) {
    handler = Objects.requireNonNull(handler);

    if (null == m_events) {
        m_events = new HandlerManager(this);
    }//ww w.  j  a v a  2s.co  m
    if (isSupported()) {
        final HandlerRegistration proxy = Storage.addStorageEventHandler(new StorageEvent.Handler() {
            @Override
            public void onStorageChange(final StorageEvent event) {
                if (false == isLocalStorage(event)) {
                    m_events.fireEvent(new SessionStorageEvent(get(), event.getKey(), event.getOldValue(),
                            event.getNewValue()));
                }
            }
        });
        return new HandlerRegistrationManager(m_events.addHandler(SessionStorageEvent.TYPE, handler), proxy);
    }
    return m_events.addHandler(SessionStorageEvent.TYPE, handler);
}

From source file:com.alkacon.forms.client.widgets.A_EditWidget.java

License:Open Source License

/**
 * Creates the {@link HandlerManager} used by this Widget. You can override
 * this method to create a custom {@link HandlerManager}.
 *
 * @return the {@link HandlerManager} you want to use
 *//*from  w  ww  .j  av a  2  s. co  m*/
protected HandlerManager createHandlerManager() {

    return new HandlerManager(this);
}

From source file:com.alkacon.vie.client.Entity.java

License:Open Source License

/**
 * Ensures the existence of the handler manager.
 *
 * @return the handler manager/*w  w w. j  av  a 2  s.  co m*/
 * */
private HandlerManager ensureHandlers() {

    if (getHandlerManager() == null) {
        bindChange(new HandlerManager(this));
    }
    return getHandlerManager();
}

From source file:com.bearsoft.gwt.ui.menu.MenuItemImageText.java

/**
 * Creates the {@link HandlerManager} used by this Widget. You can override
 * this method to create a custom {@link HandlerManager}.
 * //  w  w w  .  j  ava 2 s. c  o m
 * @return the {@link HandlerManager} you want to use
 */
protected HandlerManager createHandlerManager() {
    return new HandlerManager(this);
}

From source file:com.ephesoft.dcma.gwt.core.client.DCMAEntryPoint.java

License:Open Source License

@Override
public void onModuleLoad() {
    GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();

    this.eventBus = new HandlerManager(null);
    this.rpcService = createRpcService();

    eventBus.addHandler(SignoutEvent.type, new SignoutEventHandler() {

        @Override//  www.  j a  va 2  s  .  co  m
        public void onSignout(SignoutEvent event) {
            rpcService.logout(Window.getTitle(), new EphesoftAsyncCallback<Void>() {

                @Override
                public void onSuccess(Void voids) {
                    Window.Location.assign(GWT.getHostPageBaseURL() + getHomePage());
                }

                @Override
                public void customFailure(Throwable arg0) {
                    /*
                     * On Failure
                     */
                }
            });
        }
    });

    eventBus.addHandler(HelpClickEvent.type, new HelpClickEventHandler() {

        @Override
        public void onHelpClicked(HelpClickEvent event) {
            rpcService.getHelpUrl(new EphesoftAsyncCallback<String>() {

                @Override
                public void onSuccess(String url) {
                    // opening the help url in new tab
                    Window.open(url, "_blank", null);
                }

                @Override
                public void customFailure(Throwable arg0) {
                    ConfirmationDialogUtil.showConfirmationDialog(
                            LocaleDictionary.get()
                                    .getConstantValue(LocaleCommonConstants.HELP_URK_ERROR_MESSAGE),
                            LocaleDictionary.get().getConstantValue(LocaleCommonConstants.ERROR_TITLE), true);

                }
            });
        }
    });

    preprocess();
}

From source file:com.facebook.tsdb.tsdash.client.TSDashEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    HandlerManager eventBus = new HandlerManager(null);
    HTTPService service = new HTTPService();
    ApplicationController appCtrl = new ApplicationController(eventBus, service);
    appCtrl.go();/*from w  ww  .  j  av  a 2s  .c o m*/
}

From source file:com.github.gwateke.binding.value.CommitTrigger.java

License:Apache License

/**
 * Constructs a <code>CommitTrigger</code>. 
 */
public CommitTrigger() {
    handlerManager = new HandlerManager(this);
}

From source file:com.google.gwt.gwtpages.demo.client.GWT_Pages_Demo.java

/**
 * This is the entry point method./*from   w w  w  .  j  a v  a  2 s  .  co m*/
 */
public void onModuleLoad() {
    // composite application presenter for use with the layouts demo page
    CompositeLayoutApplicationPresenter presenter = new CompositeLayoutApplicationPresenter(
            PageConstants.LAYOUT_DEFAULT).register(PageConstants.LAYOUT_DEFAULT, new DefaultLayoutPage())
                    .register(PageConstants.LAYOUT_NONE, new NoLayoutPage())
                    .register(PageConstants.LAYOUT_NAV_RIGHT, new RightNavLayoutPage());

    // initialize the pages settings
    Pages.init((DemoPageLoader) GWT.create(DemoPageLoader.class), // the class responsible for mapping page tokens to pages
            presenter, // the component that will actually render the pages
            new HandlerManager(null), true) // the event bus
            .addDefaultEventHandlers().add(this); // add default behavior if desired

    // make the initial page show up (and check the history token to go directly to a requested page and bypass the start
    // page if necessary
    Pages.get().showStartPage(true);
}

From source file:com.google.gwt.sample.contacts.client.Contacts.java

public void onModuleLoad() {
    ContactsServiceAsync rpcService = GWT.create(ContactsService.class);
    HandlerManager eventBus = new HandlerManager(null);
    AppController appViewer = new AppController(rpcService, eventBus);
    appViewer.go(RootPanel.get());/*w  w w.  jav  a2  s.co  m*/
}