Example usage for com.google.gwt.user.client.ui HasWidgets.ForIsWidget add

List of usage examples for com.google.gwt.user.client.ui HasWidgets.ForIsWidget add

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HasWidgets.ForIsWidget add.

Prototype

void add(Widget w);

Source Link

Document

Adds a child widget.

Usage

From source file:com.google.gwt.sample.mobilewebapp.client.App.java

License:Apache License

/**
 * Given a parent view to show itself in, start this App.
 * // w  w w .j a v a  2s  .  com
 * @param parentView where to show the app's widget
 */
public void run(HasWidgets.ForIsWidget parentView) {
    activityManager.setDisplay(shell);

    parentView.add(shell);

    ActionEvent.register(eventBus, ActionNames.ADD_TASK, new ActionEvent.Handler() {
        @Override
        public void onAction(ActionEvent event) {
            placeController.goTo(TaskPlace.getTaskCreatePlace());
        }
    });

    eventBus.addHandler(ShowTaskEvent.TYPE, new ShowTaskEvent.Handler() {
        @Override
        public void onShowTask(ShowTaskEvent event) {
            TaskProxy task = event.getTask();
            placeController.goTo(TaskPlace.createTaskEditPlace(task.getId(), task));
        }
    });

    ActionEvent.register(eventBus, ActionNames.GO_HOME, new ActionEvent.Handler() {
        @Override
        public void onAction(ActionEvent event) {
            placeController.goTo(new TaskListPlace(false));
        }
    });

    ActionEvent.register(eventBus, ActionNames.TASK_SAVED, new ActionEvent.Handler() {
        @Override
        public void onAction(ActionEvent event) {
            placeController.goTo(new TaskListPlace(true));
        }
    });

    ActionEvent.register(eventBus, ActionNames.EDITING_CANCELED, new ActionEvent.Handler() {
        @Override
        public void onAction(ActionEvent event) {
            placeController.goTo(new TaskListPlace(false));
        }
    });

    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        @Override
        public void onUncaughtException(Throwable e) {
            while (e instanceof UmbrellaException) {
                e = ((UmbrellaException) e).getCauses().iterator().next();
            }

            String message = e.getMessage();
            if (message == null) {
                message = e.toString();
            }
            log.log(Level.SEVERE, "Uncaught exception", e);
            Window.alert("An unexpected error occurred: " + message);
        }
    });

    // Check for authentication failures or mismatches
    reloadOnAuthenticationFailure.register(eventBus);

    initBrowserHistory(historyMapper, historyHandler, new TaskListPlace(true));
}

From source file:com.guit.client.GuitPresenterBase.java

License:Apache License

@Override
public void addViewTo(HasWidgets.ForIsWidget panel) {
    assert panel != null : "The panel cannot be null";
    panel.add(getView());
}

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

License:Open Source License

public void run(HasWidgets.ForIsWidget root) {
    addHandlers();/*w  w  w .  j  av a 2s .c o m*/

    root.add(injector.getAppShell());

    Footer footer = GWT.create(Footer.class);
    root.add(footer);

    ActivityManager headerActivityManager = new ActivityManager(injector.getHeaderActivityMapper(),
            injector.getEventBus());
    headerActivityManager.setDisplay(injector.getAppShell().getHeaderRegion());
    ActivityManager mainActivityManager = new ActivityManager(injector.getMainActivityMapper(),
            injector.getEventBus());
    mainActivityManager.setDisplay(injector.getAppShell().getMainContentRegion());

    injector.getPlaceHistoryHandler().handleCurrentHistory();
}

From source file:org.xdi.oxd.license.admin.client.ui.MainPanelPresenter.java

@Override
public void go(HasWidgets.ForIsWidget container) {

    container.clear();/* w  w w .j av  a  2s  .c om*/
    checkState();

    container.add(view);

    view.getLogoutButton().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            LoginController.logout();
        }
    });

    new LicenseCryptTabPresenter(view.getLicenseCryptTab());
    Admin.getService().isGenerationApiProtected(new AsyncCallback<Boolean>() {
        @Override
        public void onFailure(Throwable caught) {
            view.getApiNotProtectedAlert().setVisible(true);
        }

        @Override
        public void onSuccess(Boolean result) {
            view.getApiNotProtectedAlert().setVisible(!result);
        }
    });
}