Example usage for com.google.gwt.user.client.ui RootLayoutPanel add

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

Introduction

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

Prototype

@Override
public void add(Widget widget) 

Source Link

Document

Adds a widget to this panel.

Usage

From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleSiteManager.java

public void initialize(RootLayoutPanel rootPanel) {
    // XXX allocate different areas in root panel
    root = rootPanel;// w  w w . j  av a2s.  c o  m
    // dock = new DockLayoutPanel(Unit.PX);
    dock = dockPresenter.getDisplay().getDock();
    // dock = dock.addNorth(new HTML("<h1>(Header) "
    // + sessionManager.getSession().getLoginName() + "</h1>"), 100);
    // dock.addSouth(new HTML("<em>Footer</em>"), 50);
    // FIXME 20111130
    dockPresenter.getDisplay().setMessage(sessionManager.getSession().getLoginName());
    // menu = new LayoutPanel();
    menu = dockPresenter.getDisplay().getMenu();
    // dock.addWest(menu, 200);

    // initialize editors area.
    editor = new LayoutPanel();
    editor.setVisible(false);
    dock.add(editor);

    dockPresenter.bind();
    rootPanel.add(dockPresenter.getDisplay().asWidget());

    hookEditorCloseEvent();
    hookHistoryEvent();
    hookMenuClickEvent();
}

From source file:com.ephesoft.dcma.gwt.home.client.BatchListEntryPoint.java

License:Open Source License

/**
 * Processing to be done on load./*w w  w . ja v  a 2s.  c om*/
 */
@Override
public void onLoad() {
    Document.get().setTitle(LocaleDictionary.get().getConstantValue(BatchListConstants.BATCH_LIST_TITLE));
    controller = new BatchListController(eventBus, rpcService);
    controller.createView();
    final LandingView landingView = controller.getView();
    LandingPresenter landingPresenter = controller.getPresenter().getLandingPresenter();
    landingPresenter.bind();
    final RootPanel rootPanel = new RootPanel(landingView.getOuter(), rpcService);
    rootPanel.addStyleName("set_position");
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().addNonClickableTab(
            LocaleDictionary.get().getConstantValue(BatchListConstants.TAB_LABEL_HOME), "BatchList.html");
    rootPanel.getHeader().getTabBar().selectTab(0);
    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

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

        @Override
        public void onSuccess(String arg0) {
            rpcService.getBatchListScreenTab(arg0, new EphesoftAsyncCallback<BatchInstanceStatus>() {

                @Override
                public void customFailure(Throwable arg0) {
                    /*
                     * on failure
                     */
                }

                @Override
                public void onSuccess(BatchInstanceStatus arg0) {
                    if (BatchInstanceStatus.READY_FOR_VALIDATION.equals(arg0)) {
                        landingView.getReviewValidateTabLayoutPanel().selectTab(1);
                    } else {
                        landingView.getReviewValidateTabLayoutPanel().selectTab(0);
                    }
                }
            });
        }
    });
    DataFilter[] filters = new DataFilter[2];
    rpcService.getRowsCount(filters, new EphesoftAsyncCallback<Integer>() {

        public void customFailure(final Throwable caught) {
            // Do not create any tabs in case of failure
        }

        public void onSuccess(final Integer result) {
            if (result == null || result.intValue() == 0) {
                rootPanel.getHeader().addNonClickableTab(
                        LocaleDictionary.get().getConstantValue(BatchListConstants.TAB_LABEL_BATCH_DETAIL),
                        "BatchList.html");
                rootPanel.getHeader().getTabBar().setTabEnabled(1, false);
            } else {
                rootPanel.getHeader().addTab(
                        LocaleDictionary.get().getConstantValue(BatchListConstants.TAB_LABEL_BATCH_DETAIL),
                        "ReviewValidate.html", false);
            }
            rootPanel.getHeader().addTab(
                    LocaleDictionary.get().getConstantValue(BatchListConstants.TAB_LABEL_WEB_SCANNER),
                    "WebScanner.html", false);
            rpcService.isUploadBatchEnabled(new EphesoftAsyncCallback<Boolean>() {

                @Override
                public void customFailure(Throwable arg0) {
                    // TODO Auto-generated method stub
                }

                @Override
                public void onSuccess(Boolean isUploadBatchEnabled) {
                    if (isUploadBatchEnabled) {
                        rootPanel.getHeader().addTab(LocaleDictionary.get().getConstantValue(
                                BatchListConstants.TAB_LABEL_UPLOAD_BATCH), "UploadBatch.html", false);
                    }
                }
            });
        }
    });
    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(final String userName) {
            rootPanel.getHeader().setUserName(userName);
        }

        @Override
        public void customFailure(final Throwable arg0) {
            // Username cannot be set if the call failed.
        }
    });
    RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
    rootLayoutPanel.clear();
    rootLayoutPanel.add(rootPanel);
    final FocusPanel focusPanel = new FocusPanel();
    focusPanel.add(rootLayoutPanel);
    com.google.gwt.user.client.ui.RootPanel.get().add(focusPanel);
}

From source file:com.ephesoft.dcma.gwt.reporting.client.ReportingEntryPoint.java

License:Open Source License

@Override
public void onLoad() {

    LayoutPanel layoutPanel = new LayoutPanel();
    controller = new ReportingController(eventBus, rpcService);
    layoutPanel.add(controller.createView());
    ReportingPresenter reportingPresenter = controller.getPresenter();
    reportingPresenter.bind();// www.  jav  a 2 s .c  o m

    final RootPanel rootPanel = new RootPanel(layoutPanel, rpcService);

    rootPanel.getHeader().addTab("Batch Class Management", "BatchClassManagement.html", false);
    rootPanel.getHeader().addTab("Batch Instance Management", "BatchInstanceManagement.html", false);
    rootPanel.getHeader().addTab("Workflow Management", "CustomWorkflowManagement.html", false);
    rootPanel.getHeader().addTab("Folder Management", "FolderManager.html", false);
    rootPanel.getHeader().addNonClickableTab("Reports", "Reporting.html");
    rootPanel.getHeader().getTabBar().selectTab(4);
    rootPanel.addStyleName("set_position");
    rootPanel.getHeader().setEventBus(eventBus);

    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(final String userName) {
            rootPanel.getHeader().setUserName(userName);
        }

        @Override
        public void customFailure(final Throwable arg0) {
            // Username cannot be set if the call failed.
        }
    });

    RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
    rootLayoutPanel.clear();
    rootLayoutPanel.add(rootPanel);

}

From source file:com.ephesoft.dcma.gwt.rv.client.ReviewValidate.java

License:Open Source License

@Override
public void onLoad() {
    defineBridgeMethod();//from   w w  w  .j  ava  2s.c o m
    Document.get().setTitle(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.RV_TITLE));
    final ReviewValidateController controller = new ReviewValidateController(rpcService, eventBus);

    ReviewValidateView view = controller.getPresenter().getView();

    final RootPanel rootPanel = new RootPanel(view.getOuter(), rpcService);
    rootPanel.getHeader().setEventBus(eventBus);
    rootPanel.getHeader().setShowDialogBoxOnTabClick(true);
    rootPanel.getHeader().setDialogMessage(
            LocaleDictionary.get().getMessageValue(ReviewValidateMessages.MSG_BACKBUTTON_CONFM));
    rootPanel.getHeader().addTab(
            LocaleDictionary.get().getConstantValue(ReviewValidateConstants.TAB_LABEL_HOME), "BatchList.html",
            true);
    rootPanel.getHeader().addNonClickableTab(
            LocaleDictionary.get().getConstantValue(ReviewValidateConstants.TAB_LABEL_BATCH_DETAIL),
            "ReviewValidate.html");
    rootPanel.getHeader().addTab(
            LocaleDictionary.get().getConstantValue(ReviewValidateConstants.TAB_LABEL_WEB_SCANNER),
            "WebScanner.html", true);

    checkAndDisplayUploadBatchTab(rootPanel);

    ScreenMaskUtility.maskScreen();

    rpcService.getRowsCount(new EphesoftAsyncCallback<Integer>() {

        public void customFailure(Throwable caught) {
            // no change needed if there is a failure in getting row count
        }

        public void onSuccess(Integer result) {
            if (result == null || result.intValue() == 0) {
                rootPanel.getHeader().getTabBar().setTabEnabled(1, false);
            }
        }
    });

    rpcService.getUserName(new EphesoftAsyncCallback<String>() {

        @Override
        public void onSuccess(String userName) {
            rootPanel.getHeader().setUserName(userName);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void customFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
            ConfirmationDialogUtil.showConfirmationDialogError(
                    LocaleDictionary.get().getMessageValue(ReviewValidateMessages.MSG_USERNAME_ERROR));
        }
    });

    RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
    rootLayoutPanel.clear();
    rootLayoutPanel.add(rootPanel);

    final FocusPanel focusPanel = new FocusPanel();
    focusPanel.add(rootLayoutPanel);

    addFocusPanelHandlers(focusPanel);

    com.google.gwt.user.client.ui.RootPanel.get().add(focusPanel);

    Window.addWindowClosingHandler(new Window.ClosingHandler() {

        @Override
        public void onWindowClosing(ClosingEvent arg0) {
            onWindowClose();

        }
    });

    controller.onPresenterLoad(null);

}

From source file:com.example.GWTOAuthLoginDemo.client.GWTOAuthLoginDemo.java

License:Open Source License

private void showApp(int what) {
    Window.setMargin("0px");
    RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
    rootLayoutPanel.clear();//  w  ww . jav a  2  s . c o m
    if (what == APPSCREEN_MAIN) {
        appScreen.setWidth("100%");
        rootLayoutPanel.add(appScreen);
    } else {
        String html = WELCOME_STRING;
        appScreenLogin.setWidth("100%");
        appScreenLogin.updateWecomeLabel(html);
        appScreenLogin.resetLoginParams();
        rootLayoutPanel.add(appScreenLogin);
    }
}

From source file:com.google.gwt.examples.DockLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Attach five widgets to a DockLayoutPanel, one in each direction. Lay
    // them out in 'em' units.
    DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
    p.addNorth(new HTML("north"), 2);
    p.addSouth(new HTML("south"), 2);
    p.addEast(new HTML("east"), 2);
    p.addWest(new HTML("west"), 2);
    p.add(new HTML("center"));

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}

From source file:com.google.gwt.examples.LayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Attach two child widgets to a LayoutPanel, laying them out horizontally,
    // splitting at 50%.
    Widget childOne = new HTML("left"), childTwo = new HTML("right");
    LayoutPanel p = new LayoutPanel();
    p.add(childOne);/*from w  w w .  java2s . c om*/
    p.add(childTwo);

    p.setWidgetLeftWidth(childOne, 0, PCT, 50, PCT);
    p.setWidgetRightWidth(childTwo, 0, PCT, 50, PCT);

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}

From source file:com.google.gwt.examples.SplitLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-pane layout with splitters. 
    SplitLayoutPanel p = new SplitLayoutPanel();
    p.addWest(new HTML("navigation"), 128);
    p.addNorth(new HTML("list"), 384);
    p.add(new HTML("details"));

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}

From source file:com.google.gwt.examples.StackLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-item stack, with headers sized in EMs. 
    StackLayoutPanel p = new StackLayoutPanel(Unit.EM);
    p.add(new HTML("this"), new HTML("[this]"), 4);
    p.add(new HTML("that"), new HTML("[that]"), 4);
    p.add(new HTML("the other"), new HTML("[the other]"), 4);

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}

From source file:com.google.gwt.examples.TabLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-item tab panel, with the tab area 1.5em tall.
    TabLayoutPanel p = new TabLayoutPanel(1.5, Unit.EM);
    p.add(new HTML("this"), "[this]");
    p.add(new HTML("that"), "[that]");
    p.add(new HTML("the other"), "[the other]");

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}