Example usage for com.google.gwt.place.shared PlaceChangeEvent PlaceChangeEvent

List of usage examples for com.google.gwt.place.shared PlaceChangeEvent PlaceChangeEvent

Introduction

In this page you can find the example usage for com.google.gwt.place.shared PlaceChangeEvent PlaceChangeEvent.

Prototype

public PlaceChangeEvent(Place newPlace) 

Source Link

Document

Constructs a PlaceChangeEvent for the given Place .

Usage

From source file:client.application.ApplicationPresenter.java

License:Apache License

@Inject
ApplicationPresenter(EventBus eventBus, MyView view, HeaderPresenter headerPresenter,
        SalePresenter salePresenter, MyProxy proxy) {
    super(eventBus, view, proxy, RevealType.Root);
    this.headerPresenter = headerPresenter;
    this.salePresenter = salePresenter;
    RemoteEventService remoteEventService = RemoteEventServiceFactory.getInstance().getRemoteEventService();
    remoteEventService.addListener(ServerEventBusService.MODE_SELECTOR_DOMAIN, new RemoteEventListener() {
        @Override/*w  w w  . j a v  a  2s.c  o m*/
        public void apply(Event anEvent) {
            if (anEvent instanceof ChangeModeTask) {
                String token = ((ChangeModeTask) anEvent).getMode();
                getView().setMode(token);
                getEventBus().fireEvent(new PlaceChangeEvent(new ModePlace(token)));
            } else if (anEvent instanceof ShowSimpleDialogTask) {
                getView().showSimpleDialog(((ShowSimpleDialogTask) anEvent));
            } else if (anEvent instanceof ShowPaymentDialogTask) {
                getView().showPaymentDialog(((ShowPaymentDialogTask) anEvent));
            } else if (anEvent instanceof CloseDialogTask) {
                getView().closeDialog();
            } else if (anEvent instanceof ModifyFocusedContentTask) {
                JsUtils.fireString(((ModifyFocusedContentTask) anEvent).getContent());
            } else if (anEvent instanceof VikiBooleanClientProperty) {
                VikiBooleanClientProperty property = (VikiBooleanClientProperty) anEvent;
                PropertyRegistrator.fireBooleanEvent(property);
            }

        }
    });

    ServerEventBusService.App.getInstance().start(new VoidAsyncCallback());
}

From source file:com.emitrom.gwt4.touch2.demo.client.KitchenSinkEntryPoint.java

License:Open Source License

private void addListeners() {

    if (backButton != null) {
        backButton.addTapHandler(new TapHandler() {
            @Override//ww w  .j  a v a 2  s .  c o  m
            public void onTap(Button button, EventObject event) {
                // remove where we are
                stack.pop();

                // and then go to the previous place
                Place place = stack.pop();
                factory.getEventBus().fireEvent(new PlaceChangeEvent(place));
            }
        });
    }

    sourceButton.addTapHandler(new TapHandler() {

        @Override
        public void onTap(Button button, EventObject event) {

            loadMask.show();

            service.getSource(currentView, new AsyncCallback<String>() {

                @Override
                public void onSuccess(String result) {
                    loadMask.hide();
                    srcPanel.setHtml("");
                    String html = "<textarea name=\"code\" class=\"java:nocontrols\" rows=\"15\" cols=\"100\">";
                    html += result;
                    html += "</textarea>";
                    srcPanel.setHtml(html);
                    srcPanel.show();
                    highlight();
                }

                @Override
                public void onFailure(Throwable caught) {
                    loadMask.hide();
                    System.out.println(caught.getMessage());
                }
            });
        }
    });

    homeButton.addTapHandler(new TapHandler() {

        @Override
        public void onTap(Button button, EventObject event) {
            Window.open("http://www.emitrom.com", "Emitrom", "");
        }
    });

    aboutButton.addTapHandler(new TapHandler() {
        public void onTap(Button button, EventObject event) {
            if (version == null) {
                loadMask.show();

                service.getVersion(new AsyncCallback<String>() {
                    @Override
                    public void onSuccess(String result) {
                        loadMask.hide();
                        version = result;
                        MessageBox.alert("About", version);
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                        loadMask.hide();
                        System.out.println(caught.getMessage());
                    }
                });

            } else {
                MessageBox.alert("About", version);
            }
        }
    });
}

From source file:com.sfeir.common.gwt.client.mvp.PlaceController.java

License:Apache License

/**
 * Request a change to a new place. It is not a given that we'll actually get
 * there. First a {@link PlaceChangeRequestEvent} will be posted to the event
 * bus. If any receivers post a warning message to that event, it will be
 * presented to the user via {@link Delegate#confirm(String)} (which is
 * typically a call to {@link Window#confirm(String)}). If she cancels, the
 * current location will not change. Otherwise, the location changes and a
 * {@link PlaceChangeEvent} is posted announcing the new place.
 * /*from   ww w . j  a v a  2s.  c o m*/
 * @param newPlace a {@link Place} instance
 */
public void goTo(Place newPlace) {
    log.fine("goTo: " + newPlace);

    if (getWhere().equals(newPlace)) {
        log.fine("Asked to return to the same place: " + newPlace);
        return;
    }

    String warning = maybeGoTo(newPlace);
    if (warning == null || delegate.confirm(warning)) {
        where = newPlace;
        eventBus.fireEvent(new PlaceChangeEvent(newPlace));
    }
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.place.AppPlaceController.java

License:Open Source License

public void finishGo(Place newPlace) {
    goingTo = null;
    where = newPlace;
    eventBus.fireEvent(new PlaceChangeEvent(newPlace));
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.presenter.ProjectAdminActivity.java

License:Open Source License

public void setPlace(Place p) {
    ProjectAdminPlace place = (ProjectAdminPlace) p;
    this.project = place.getProject();
    updateView();//from w w w . j ava2  s .c  om
    ProjectAdminMenu.getInstance().select(place);
    adminActivityManager.onPlaceChange(new PlaceChangeEvent(p));
}

From source file:com.tasktop.c2c.server.tasks.client.presenters.TaskAdminPresenter.java

License:Open Source License

public void setPlace(Place aPlace) {
    AbstractProjectAdminTasksPlace place = (AbstractProjectAdminTasksPlace) aPlace;
    view.setProject(place.getProject());
    view.selectPlace(aPlace);/*from  w w  w  .  java2  s  .  co  m*/
    adminActivityManager.onPlaceChange(new PlaceChangeEvent(aPlace));
}

From source file:fr.putnami.pwt.core.mvp.client.MvpController.java

License:Open Source License

private void doGo(Place newPlace) {
    this.currentPlace = newPlace;
    EventBus.get().fireEvent(new PlaceChangeEvent(newPlace));
}