Example usage for com.google.gwt.user.client.ui RootPanel remove

List of usage examples for com.google.gwt.user.client.ui RootPanel remove

Introduction

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

Prototype

@Override
public boolean remove(Widget w) 

Source Link

Document

Overrides ComplexPanel#remove(Widget) to change the removed Widget's element back to static positioning.This is done so that any positioning changes to the widget that were done by the panel are undone when the widget is disowned from the panel.

Usage

From source file:com.eduworks.russel.ui.client.handler.ESBSearchHandler.java

License:Apache License

public void buildThumbnails(String objPanel, AjaxPacket searchTermPacket) {
    if (searchTermPacket != null) {
        RootPanel rp = RootPanel.get(objPanel);
        if (rp != null) {
            Element td = null;//w ww.j  ava  2 s  .  com
            tileIndex = 0;
            if (noResults != null)
                rp.remove(noResults);

            if (searchTermPacket.containsKey("obj")) {
                JSONObject jo = searchTermPacket.getObject("obj").isObject();
                if ((jo.containsKey("items") && jo.get("items").isArray().size() == 0)
                        || (jo.containsKey("hits")
                                && jo.get("hits").isObject().get("hits").isArray().size() == 0)) {
                    rp.getElement().setAttribute("style", "text-align:center");
                    noResults = new HTML(NO_SEARCH_RESULTS);
                    rp.add(noResults);
                } else
                    rp.getElement().setAttribute("style", "");

                if (searchType.equals(RusselApi.FLR_TYPE)) {
                    JSONArray ja = searchTermPacket.getObject("obj").get("hits").isObject().get("hits")
                            .isArray();
                    if (ja.size() == 0)
                        return;
                    RUSSELFileRecord[] fileSet = FLRResultExtractor.walkBasicSearch(ja);

                    int screenPosition = 0;
                    for (int x = 0; x < fileSet.length; x++) {
                        if (screenPosition % 2 == 0 && !doNotShow.contains(searchType)
                                && (showOnly.isEmpty() || showOnly.contains(searchType))) {
                            // SEARCH3DR_TYPE uses the vertStack style, and will not use the table-based layout that requires insertion of cell separators.
                            td = DOM.createTD();
                            td.setId(x + "-" + rp.getElement().getId());
                            rp.getElement().appendChild(td);
                        }
                        TileHandler th = buildTile0(fileSet[x], screenPosition++, objPanel, td);
                        th.fillTile(null);
                    }
                } else {
                    int screenPosition = 0;
                    for (int x = 0; x < searchTermPacket.getObject("obj").get("items").isArray().size(); x++) {
                        RUSSELFileRecord fr = new RUSSELFileRecord(new ESBPacket(searchTermPacket
                                .getObject("obj").isObject().get("items").isArray().get(x).isObject()));
                        if (filter != null)
                            if (filter.contains(fr.getGuid()))
                                continue;

                        if (screenPosition % 2 == 0 && !doNotShow.contains(searchType)
                                && (showOnly.isEmpty() || showOnly.contains(searchType))) {
                            // SEARCH3DR_TYPE uses the vertStack style, and will not use the table-based layout that requires insertion of cell separators.
                            td = DOM.createTD();
                            td.setId(x + "-" + rp.getElement().getId());
                            rp.getElement().appendChild(td);
                        }
                        buildTile0(fr, screenPosition++, objPanel, td);
                    }

                    processCallbacks();
                }
            }
        }
    }
}

From source file:com.isotrol.impe3.users.gui.login.LoginPanel.java

License:Open Source License

/**
 * Creates and shows the user application panel.<br/>
 *//*from   w  w w  .  j a  va 2s. co m*/
private void openUserApplication() {
    final RootPanel rootPanel = RootPanel.get();
    // remove login panel
    rootPanel.remove(0);

    UsersViewport mainPanel = new UsersViewport();
    rootPanel.add(mainPanel);
}

From source file:com.vangent.hieos.DocViewer.client.entrypoint.DocViewer.java

License:Open Source License

/**
 * //  w w w  . j  a  v a 2 s .  c  o  m
 * @param canvas
 */
private void addCanvasToRootPanel(Canvas canvas) {
    final RootPanel rootPanel = RootPanel.get();
    // Remove old canvas (if exists).
    if (currentCanvas != null) {
        rootPanel.remove(currentCanvas);
    }
    currentCanvas = canvas;
    rootPanel.add(canvas);

    // Remove loading wrapper (established in host HTML page).
    final RootPanel loadingWrapper = RootPanel.get("loadingWrapper");
    if (loadingWrapper != null) {
        RootPanel.getBodyElement().removeChild(loadingWrapper.getElement());
    }
}

From source file:fr.putnami.pwt.core.widget.client.Modal.java

License:Open Source License

public void hide() {
    final RootPanel rootPanel = RootPanel.get();

    this.visible = false;
    StyleUtils.removeStyle(Modal.this, Modal.STYLE_VISIBLE);
    StyleUtils.removeStyle(rootPanel, Modal.STYLE_MODAL_OPEN);

    Modal.MODAL_BACKDROP.hide();/*from w ww.j  a va2  s  .  c  o  m*/

    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
        @Override
        public boolean execute() {
            Modal.this.getElement().getStyle().clearDisplay();
            rootPanel.remove(getContainerWidget());
            return false;
        }
    }, 150);
}

From source file:net.scran24.common.client.OverlayDiv.java

public void setVisible(boolean visible) {
    if (this.visible == visible)
        return;//from  w  w  w.  j  av a 2  s.  co  m

    RootPanel body = RootPanel.get();

    if (visible) {
        fade = new FlowPanel();
        fade.addStyleName("intake24-overlay-fade");
        body.add(fade);

        overlay = new FlowPanel();
        overlay.addStyleName("intake24-overlay");
        overlay.add(contents);

        body.add(overlay);
    } else {
        overlay.remove(contents);
        body.remove(fade);
        body.remove(overlay);
        fade = null;
        overlay = null;
    }

    this.visible = visible;
}

From source file:org.datacleaner.monitor.shared.widgets.FileUploadFunctionHandler.java

License:Open Source License

public static void uploadFile(String fileUploadElementId) {
    final Element element = Document.get().getElementById(fileUploadElementId);

    final InputElement inputElement = getFileInput(element);
    if (inputElement == null) {
        throw new IllegalArgumentException("No file input found within element id: " + fileUploadElementId);
    }//  w  ww .  j a va  2 s. c  om

    GWT.log("Found file input element: " + inputElement);

    final String inputName = inputElement.getName();
    final Element parent = inputElement.getParentElement();

    parent.setInnerHTML("<div class='loader'></div>");

    // use "contentType" param because form submission requires everything
    // to be text/html
    final String url = Urls.createRelativeUrl("util/upload?contentType=text/html");

    final RootPanel rootPanel = RootPanel.get();

    final FormPanel form = new FormPanel();
    form.setVisible(false);
    form.setAction(url);
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.getElement().appendChild(inputElement);
    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {

            final String stringResponse = event.getResults();

            GWT.log("File upload form submit complete! Results: " + stringResponse);

            try {
                final JSONValue jsonResponse = JSONParser.parseLenient(stringResponse);
                final JSONArray jsonFiles = jsonResponse.isObject().get("files").isArray();
                final JSONValue jsonFile = jsonFiles.get(0);
                final String jsonFileStr = jsonFile.toString();
                parent.setInnerHTML("<p>File uploaded!</p><input type='hidden' name='" + inputName + "' value='"
                        + jsonFileStr + "' />");
                rootPanel.remove(form);
            } catch (Exception e) {
                ErrorHandler.showErrorDialog("Unexpected error occurred",
                        "An error occurred when uploading the file to the server.", stringResponse);
            }
        }
    });

    rootPanel.add(form);

    GWT.log("Submitting hidden file upload form");

    form.submit();
}

From source file:org.datacleaner.monitor.wizard.RootWizardPanelWrapper.java

License:Open Source License

@Override
public void hideWizard() {
    _childWizardPanel.hideWizard();
    RootPanel rootPanel = RootPanel.get(_htmlDivId);
    rootPanel.remove(getWizardWidget());
}

From source file:org.daxplore.presenter.client.Presenter.java

License:Open Source License

private void setWarningBanner(WarningBanner warning) {
    RootPanel warningSection = RootPanel.get("ID-general-warning");
    if (currentWarning != null) {
        warningSection.remove(currentWarning);
    }/*from   w  w  w  .  j  a va 2 s.  c o  m*/
    currentWarning = warning;
    warningSection.add(warning);
}

From source file:org.daxplore.presenter.client.Presenter.java

License:Open Source License

private void removeWarningBanner() {
    RootPanel warningSection = RootPanel.get("ID-general-warning");
    if (currentWarning != null) {
        warningSection.remove(currentWarning);
        currentWarning = null;//from  w  ww  .ja  v a  2  s  . co  m
    }
}

From source file:org.gwm.splice.client.icon.IconManager.java

License:Apache License

private void removeIcons() {
    RootPanel rp = RootPanel.get();
    for (Iterator iter = icons.values().iterator(); iter.hasNext();) {
        DesktopIcon icon = (DesktopIcon) iter.next();
        rp.remove(icon);
    }//from www. j a  v  a2 s. c  om
}