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

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

Introduction

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

Prototype

public static RootLayoutPanel get() 

Source Link

Document

Gets the singleton instance of RootLayoutPanel.

Usage

From source file:accelerator.client.Main.java

License:Open Source License

private void loadMain(LoginInfo loginInfo) {
    mainPresenter = new MainPresenter(clientFactory);
    Shell shell = mainPresenter.getShell();
    shell.setLoginInfo(loginInfo);/*from   w  w w.  ja  v  a  2 s  . c  om*/

    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(shell);

    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    RootLayoutPanel.get().add(shell);
    historyHandler.handleCurrentHistory();
}

From source file:accelerator.client.Main.java

License:Open Source License

private void loadLogin(LoginInfo loginInfo) {
    LoginView view = new LoginView();
    view.setLoginInfo(loginInfo);
    RootLayoutPanel.get().add(view);
}

From source file:accelerator.client.view.desktop.DesktopShell.java

License:Open Source License

/**
 * {@inheritDoc}//from  ww w  .j av a  2 s  .c o  m
 */
public void showStatus(String message) {
    final StatusPopupPanel popup = new StatusPopupPanel();
    popup.setStatus(message);
    popup.setPopupPositionAndShow(new PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
            RootLayoutPanel root = RootLayoutPanel.get();
            int left = root.getAbsoluteLeft() + root.getOffsetWidth() - offsetWidth;
            int top = root.getAbsoluteTop() + root.getOffsetHeight() - offsetHeight;
            popup.setPopupPosition(left, top);
        }
    });
}

From source file:bufferings.ktr.wjr.client.KtrWjr.java

License:Apache License

/**
 * {@inheritDoc}//  ww w .  j  a va2s.c om
 */
public void onModuleLoad() {
    KtrWjrServiceAsync rpcService = new KtrWjrJsonServiceAsync();
    WjrPresenter presenter = new WjrPresenter(rpcService, new WjrLoadingView(), new WjrView());

    RootPanel initialPanel = RootPanel.get(INITIAL_PANEL_ID);
    if (initialPanel != null) {
        initialPanel.getElement().removeFromParent();
    }

    presenter.go(RootLayoutPanel.get());
}

From source file:cc.kune.sandbox.client.KuneSandboxEntryPoint.java

License:GNU Affero Public License

public void completeTests() {
    NotifyUser.info("Started");

    final Navbar simpleNavbar = new Navbar();
    final NavbarHeader header = new NavbarHeader();
    final NavbarCollapseButton navbarCollapseButton = new NavbarCollapseButton();
    navbarCollapseButton.setDataTarget("#test");
    header.add(navbarCollapseButton);//from w  ww . j a v a  2  s.c om
    simpleNavbar.add(header);
    final NavbarCollapse navbarCollapse = new NavbarCollapse();
    navbarCollapse.setId("test");
    simpleNavbar.add(navbarCollapse);

    final NavbarNav navbarNav = new NavbarNav();
    final ComplexDropDownMenu<ListDropDown> listDropDown = new ComplexDropDownMenu<ListDropDown>(
            new ListDropDown());
    listDropDown.setMenuText("Plain menu");
    listDropDown.setIcon(IconType.GEAR);
    navbarCollapse.add(navbarNav);
    navbarNav.add(listDropDown.getWidget());

    final AnchorListItem simpleAnchor = new AnchorListItem("Anchor 1");
    simpleAnchor.setIcon(IconType.TWITTER_SQUARE);
    navbarNav.add(simpleAnchor);

    navbarNav.add(new AnchorListItem("Anchor 2"));
    navbarNav.add(new AnchorListItem("Anchor 3"));
    final AnchorListItem menuitem1 = new AnchorListItem("Anchor menuitem 1");
    menuitem1.setIcon(IconType.RANDOM);

    listDropDown.add(menuitem1);

    final CheckListItem checkitem = new CheckListItem("Check item");
    checkitem.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            checkitem.setChecked(!checkitem.isChecked());
        }
    });
    listDropDown.add(checkitem);

    final RadioListItem radioitem = new RadioListItem("Check item");
    radioitem.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            radioitem.setChecked(!radioitem.isChecked());
        }
    });
    listDropDown.add(radioitem);

    final CheckListItem checkitem2 = new CheckListItem("Check anchor");
    checkitem2.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            checkitem2.setChecked(!checkitem2.isChecked());
        }
    });

    navbarNav.add(checkitem2);
    listDropDown.add(new AnchorListItem("Anchor menuitem 2"));
    final ComplexAnchorListItem menuitem3 = new ComplexAnchorListItem("Anchor menuitem 3");
    menuitem3.setIconUrl("http://lorempixel.com/100/100");
    listDropDown.add(menuitem3);
    final AnchorListItem item1 = new AnchorListItem("Testingggg");
    item1.setIcon(IconType.HEART);
    listDropDown.add(item1);

    for (int i = 1; i < 50; i++) {
        listDropDown.add(new AnchorListItem("Anchor " + i));
    }

    final ComplexAnchorListItem itemSubmenu = new ComplexAnchorListItem("Testing submenu");
    itemSubmenu.setIcon(KuneIcon.FOLDER);
    final DropDownSubmenu submenu = new DropDownSubmenu();
    submenu.add(new AnchorListItem("sub item 1"));
    submenu.add(new AnchorListItem("sub item 2"));
    submenu.add(new AnchorListItem("sub item 3"));
    itemSubmenu.add(submenu);
    listDropDown.add(itemSubmenu);

    final DropDown dropDown = new DropDown();

    final Anchor dropDownAnchor = new Anchor();
    // FIXME This fails:
    // final BasicThumb thumb = testThumbs();
    final Image thumb = new Image("http://lorempixel.com/30/30");
    dropDownAnchor.add(thumb);
    dropDownAnchor.setDataToggle(Toggle.DROPDOWN);
    dropDown.add(dropDownAnchor);

    final DropDownMenu dropDownMenu = new DropDownMenu();
    dropDown.add(dropDownMenu);
    final ComplexAnchorListItem dditem1 = new ComplexAnchorListItem("Test 1");
    final ComplexAnchorListItem dditem2 = new ComplexAnchorListItem("Test 2");
    dditem1.setIcon(KuneIcon.BARTER);
    dditem2.setIconUrl("http://lorempixel.com/101/101");
    dropDownMenu.add(dditem1);
    dropDownMenu.add(dditem2);

    // The same with descriptors

    final Image thumb2 = new Image("http://lorempixel.com/30/30");
    final WidgetMenuDescriptor widgetMenu = new WidgetMenuDescriptor(thumb2);
    new MenuItemDescriptor(widgetMenu, new BaseAction("Menuitem desc in widget 1", "Some tooltip"));
    new MenuItemDescriptor(widgetMenu, new BaseAction("Menuitem desc in widget 2", "Some tooltip"));

    // Now with a button

    final MenuDescriptor classicMenu = new MenuDescriptor("Button classic menu");
    classicMenu.withIcon("http://lorempixel.com/30/30");
    new MenuItemDescriptor(classicMenu, new BaseAction("Menuitem desc in widget 1", "Some tooltip"));
    new MenuItemDescriptor(classicMenu, new BaseAction("Menuitem desc in widget 2", "Some tooltip"));

    final MenuDescriptor classicMenu2 = new MenuDescriptor("Button classic2 menu");
    classicMenu2.withIcon("http://lorempixel.com/30/30");
    new MenuItemDescriptor(classicMenu2, new BaseAction("Menuitem desc in widget 3", "Some tooltip"));
    new MenuItemDescriptor(classicMenu2, new BaseAction("Menuitem desc in widget 4", "Some tooltip"));

    final CustomButton btn = new CustomButton("Text custom button");
    Tooltip.to(btn, "Show the dropdown at 100,100 position (or hide it)");
    btn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            if (listDropDown.isMenuVisible()) {
                listDropDown.hide();
            } else {
                listDropDown.show(100, 100);
            }
        }
    });
    btn.setIcon(KuneIcon.FOLDER);

    // final cc.kune.bootstrap.client.ui.IconLabel iconLabel = new
    // cc.kune.bootstrap.client.ui.IconLabel(
    // "Text");
    // iconLabel.setIcon(new KuneIcon('g'));

    final FlowPanel flow = mainContainer.getFlow();
    flow.insert(btn, 0);
    flow.insert(new HTML("<br>"), 1);
    flow.insert(dropDown, 2);
    flow.insert(new HTML("<br>"), 3);

    final ToolbarDescriptor bottomToolbar = new ToolbarDescriptor();
    bottomToolbar.setPosition(NavbarPosition.FIXED_BOTTOM);

    final ButtonDescriptor btnDesc = new ButtonDescriptor(new TestAction("Button desc"));
    btnDesc.withIcon(KuneIcon.SETTINGS).withToolTip("Show me a tooltip");
    btnDesc.setParent(bottomToolbar);

    final IconLabelDescriptor labelDesc = new IconLabelDescriptor(new TestAction("IconLabel desc"));
    labelDesc.withIcon(KuneIcon.TASKS).withToolTip("Show me a tooltip");
    labelDesc.setParent(bottomToolbar);

    final MenuDescriptor menu = new MenuDescriptor("Menu btn");
    menu.setParent(bottomToolbar);
    final MenuItemDescriptor menuItemDescriptor = new MenuItemDescriptor(menu, new TestAction("Menu item"));
    menuItemDescriptor.withIcon(IconType.MAGIC);

    final SubMenuDescriptor submenuDesc = new SubMenuDescriptor(menu, "Some submenu");
    submenuDesc.withIcon(KuneIcon.BARTER);
    new MenuItemDescriptor(submenuDesc, new TestAction("Submenu item 1")).withIcon(IconType.FACEBOOK);
    new MenuItemDescriptor(submenuDesc, new TestAction("Submenu item 2")).withIcon(IconType.FAST_BACKWARD);

    // TODO Add more tests here

    final FlowActionExtensible sitebar = new FlowActionExtensible();
    sitebar.add(createSitebarActions());

    final FlowActionExtensible bottombar = new FlowActionExtensible();
    bottombar.add(bottomToolbar);

    // RootPanel.get().add(testActionToolbar());

    final FlowActionExtensible mainFlow = new FlowActionExtensible();
    mainFlow.add(widgetMenu, classicMenu, classicMenu2);

    final PaperFab paperFab = new PaperFab();
    paperFab.setIcon("polymer");

    mainContainer.getSitebar().add(sitebar);
    mainContainer.getFooter().add(bottombar);
    mainContainer.getFooter().add(paperFab);
    final PaperButton paperBtn = new PaperButton();
    mainContainer.getFooter().add(paperBtn);
    flow.add(mainFlow);
    flow.insert(simpleNavbar, 0);

    testBarButtons(flow);
    addNotifyUserTests(flow);
    addSimpleActions(flow);
    flow.add(new Text(LoremUtils.LOREM_MULTI + LoremUtils.LOREM_MULTI));

    RootLayoutPanel.get().add(mainContainer);
}

From source file:ch.heftix.mailxel.client.Mailxel.java

License:Open Source License

/**
*/
public void onModuleLoad() {

    MailxelPanel mailxelPanel = new MailxelPanel(mailService);

    RootLayoutPanel.get().add(mailxelPanel);
}

From source file:ch.unifr.pai.ice.client.ICEMain.java

License:Apache License

@Override
public void onModuleLoad() {

    if (DeviceType.getDeviceType() == DeviceType.MULTICURSOR) {

        /***************************************
         * Get the size of the browser window.
        ***************************************/
        MultiCursorController multiCursor = GWT.create(NoMultiCursorController.class);
        multiCursor.start();//from www  .ja  va  2  s  .c o  m

        identifier = String.valueOf(new Date().getTime() / 1000);
        Window.alert("Start experiment: " + identifier);
        RootLayoutPanel.get().add(tabPanel);

        /*
         * tabPanel setup
         */

        //*****************Trainings***************************//
        //tabPanel.add(trainingCheckBoxes, "TA");
        //tabPanel.add(trainingtextEntrySepSpace1Users, "TB");  //tabPanel.add(trainingTextEntry1Space1User, "TB");
        //tabPanel.add(trainingDNdBoxes, "TC");
        //tabPanel.add(trainingLineTracking, "TD");

        //*****************Click Blobs***************************//
        //tabPanel.add(checkBoxes, "A"); 
        //tabPanel.add(checkB2u, "Click blobs 2 users"); 
        tabPanel.add(checkB4u, "Click blobs 4 users");

        //*****************Text Edit****************************//
        //tabPanel.add(textEntrySepSpace1Users, "B"); 
        //tabPanel.add(textEntrySepSpace2Users, "TE multi Space - 2 users");  
        tabPanel.add(textEntrySepSpace4Users, "TE multi Space - 4 users");

        ////******************D&D*********************************//
        //tabPanel.add(dNdBoxes, "C");
        //tabPanel.add(dNdBoxes2S, "D & D 2 spaces"); 
        tabPanel.add(dNdBoxes4S, "D & D 4 spaces");
        //tabPanel.add(dN4dropBoxes, "D & 4 D boxes"); 

        //tabPanel.add(textEntry1Space1User, "B");
        //tabPanel.add(textEntry1Space2Users, "TE 1 Space - 2 users"); 
        //tabPanel.add(textEntry1Space4Users, "TE 1 Space - 4 users");
        //tabPanel.add(lineTracking, "D");
        // tabPanel.add(lineTracking2users, "L tracking 2");
        // tabPanel.add(lineTracking4users, "L tracking 4");   

        tabPanel.selectTab(0);

        if (tabPanel.getWidget(0) instanceof RequireInitialisation) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    ((RequireInitialisation) tabPanel.getWidget(0)).initialise();
                }
            });
        }

        tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {

            @Override
            public void onSelection(SelectionEvent event) {

                Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                    @Override
                    public void execute() {
                        ((RequireInitialisation) tabPanel.getWidget(tabPanel.getSelectedIndex())).initialise();
                    }
                });
            }
        });

        /*
         * re-position of the widgets on the resized window
         */
        Window.addResizeHandler(new ResizeHandler() {
            @Override
            public void onResize(ResizeEvent event) {

            }
        });

    }

    else {

        TouchPadWidget widget = GWT.create(TouchPadWidget.class);
        RootLayoutPanel.get().add(widget);
        //widget.initialize(UUID.get(), null, null);
        widget.start();
    }

}

From source file:ch.unifr.pai.twice.dragndrop.standalone.client.DragNDropStandalone.java

License:Apache License

@Override
public void onModuleLoad() {

    // Enable multicursor support
    MultiCursorController c = GWT.create(MultiCursorController.class);
    c.start();//w w w.  jav  a2s  . c  o m

    DockLayoutPanel mainpanel = new DockLayoutPanel(Unit.PX);
    final AbsolutePanel p = new AbsolutePanel();
    DraggableLabel l = new DraggableLabel();
    l.setText("DRAG ME");
    mainpanel.add(p);
    RootLayoutPanel.get().add(mainpanel);
    p.add(l);
    final FocusPanel drop = new FocusPanel();
    drop.setWidth("500px");
    drop.setHeight("400px");
    drop.getElement().getStyle().setBackgroundColor("green");
    p.add(drop);
    p.setWidgetPosition(drop, 400, 200);

    // define the green focus panel to be a drop target handler
    DragNDrop.setDropHandler(drop, new DropTargetHandler() {

        @Override
        public void onHoverEnd(String deviceId, Widget widget, Element dragProxy, Event event) {
            drop.getElement().getStyle().setBackgroundColor("yellow");

        }

        @Override
        public void onHover(String deviceId, Widget widget, Element dragProxy, Event event,
                Double intersectionPercentage, Double intersectionPercentageWithTarget) {
            drop.getElement().getStyle().setBackgroundColor("red");
        }

        @Override
        public boolean onDrop(String deviceId, Widget widget, Element dragProxy, Event event,
                Double intersectionPercentage, Double intersectionPercentageWithTarget) {
            Window.alert("Dropped");
            return false;
        }

        @Override
        public Priority getPriority() {
            return Priority.NORMAL;
        }
    }, true);

    // Make the label draggable
    DragNDrop.makeDraggable(l, DragConfiguration.withProxy(new DragNDropHandler() {

        @Override
        public void onStartDrag(String deviceId, Widget draggedWidget) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onEndOfDrop(String deviceId, Widget draggedWidget, int dragProxyLeft, int dragProxyTop,
                Event event) {
            // TODO Auto-generated method stub

        }

        @Override
        public boolean onDrop(String deviceId, Widget draggedWidget, int dragProxyLeft, int dragProxyTop,
                Event event, DropTargetHandler dropTarget, boolean outOfBox) {
            p.setWidgetPosition(draggedWidget, dragProxyLeft - p.getAbsoluteLeft(),
                    dragProxyTop - p.getAbsoluteTop());
            return true;
        }
    }));
}

From source file:ch.unifr.pai.twice.layout.client.DynamicLayout.java

License:Apache License

/**
 * @return the root panel which shall be the initial hook to attach the components. By default, this is the {@link RootLayoutPanel} but it can be overridden
 *         by subtypes if necessary//from   w  w w.  j a  va 2s.  c  o  m
 */
protected Panel getRootPanel() {
    return RootLayoutPanel.get();
}

From source file:ch.unifr.pai.twice.layout.client.mobile.MobileInterface.java

License:Apache License

/**
 * Switch to a specific component ({@link TWICEModule}). If the module has not been accessed yet, it is instantiated and the callback is invoked.
 * // www  . j a  v  a  2s. co  m
 * @param componentName
 */
void switchComponent(String componentName) {
    RootLayoutPanel.get().clear();
    if (componentName == null && components.keySet().size() > 0) {
        componentName = (String) components.keySet().toArray()[0];
    }
    // Is it a not yet instantiated module?
    final TWICEModule module = modules.get(componentName);
    if (module != null) {
        // Then instantiate it and add it to the components
        final String moduleComponentName = componentName;
        TWICEModuleController.instantiateModule(module, new AsyncCallback<Widget>() {

            @Override
            public void onSuccess(Widget result) {
                if (currentWidget != null)
                    TWICEModuleController.stop(currentWidget);
                components.put(moduleComponentName, result);
                modules.remove(moduleComponentName);
                AsyncCallback<Widget> callback = callbacks.get(moduleComponentName);
                if (callback != null) {
                    callback.onSuccess(result);
                }
                switchToWidget(moduleComponentName, result);
            }

            @Override
            public void onFailure(Throwable caught) {
                Window.alert("Was not able to initialize module " + moduleComponentName);
            }
        });
    } else {
        Widget w = components.get(componentName);
        if (w == null && components.size() > 0) {
            componentName = (String) components.keySet().toArray()[0];
            w = components.get(componentName);
        }
        switchToWidget(componentName, w);

    }
}