Example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

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

Introduction

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

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

From source file:org.baracusproject.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*/*w ww.j a v a 2s  .c om*/
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy face!");

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "face was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}

From source file:org.bonitasoft.forms.client.view.controller.ConfirmationPageHandler.java

License:Open Source License

/**
 * {@inheritDoc}//  ww w. ja  va 2s  .c om
 */
@Override
public void onSuccess(final ReducedHtmlTemplate result) {

    String confirmMessage = result.getDynamicMessage();
    if (confirmMessage == null) {
        confirmMessage = defaultConfirmationMessage;
    }
    if (getCurrentPageHTMLPanel() != null && applicationHTMLPanel != null) {
        applicationHTMLPanel.remove(getCurrentPageHTMLPanel());
    }
    final HTMLPanel pageHTMLPanel = new HTMLPanel(result.getBodyContent());
    final String onloadAttributeValue = formsTemplateUtils.insertPageTemplate(result.getHeadNodes(),
            pageHTMLPanel, result.getBodyAttributes(), applicationHTMLPanel, elementId);
    formsTemplateUtils.insertInElement(applicationHTMLPanel, CONFIRM_MESSAGE_ELEMENT_ID, confirmMessage);
    final TodoListTaskWidget taskListWidget = new TodoListTaskWidget(applicationHTMLPanel, elementId,
            getCurrentPageHTMLPanel(), formId, urlContext);
    pageHTMLPanel.add(taskListWidget, CONFIRM_TODOLIST_ELEMENT_ID);
    formsTemplateUtils.hideLoading();
    if (onloadAttributeValue != null) {
        formsTemplateUtils.javascriptEval(onloadAttributeValue);
    }
}

From source file:org.bonitasoft.forms.client.view.controller.ErrorPageHandler.java

License:Open Source License

/**
 * {@inheritDoc}/*from www .  jav  a  2  s  .  com*/
 */
public void onSuccess(final ReducedHtmlTemplate result) {

    if (currentPageHTMLPanel != null) {
        applicationHTMLPanel.remove(currentPageHTMLPanel);
    }
    HTMLPanel pageHTMLPanel = new HTMLPanel(result.getBodyContent());
    final String onloadAttributeValue = domUtils.insertPageTemplate(result.getHeadNodes(), pageHTMLPanel,
            result.getBodyAttributes(), applicationHTMLPanel, elementId);
    domUtils.insertInElement(pageHTMLPanel, ERROR_MESSAGE_ELEMENT_ID, errorMessage);
    domUtils.insertInElement(pageHTMLPanel, CAUSE_MESSAGE_ELEMENT_ID, causeMessage);
    // Hide the loading message.

    Element loadingElement = DOM.getElementById("loading");
    if (loadingElement != null) {
        loadingElement.getStyle().setProperty("display", "none");
    }

    if (onloadAttributeValue != null) {
        domUtils.javascriptEval(onloadAttributeValue);
    }
}

From source file:org.bonitasoft.forms.client.view.controller.FormPagesViewController.java

License:Open Source License

/**
 * Build the page (template + form fields)
 *
 * @param formPage//ww  w  .  j  a v  a2 s  .  c o m
 *            the page definition
 * @param hasAlreadyBeenDisplayed
 *            indicates whether the page has already been displayed or not
 * @param isNextPage
 *            indicate if the page to display is the next page
 */
protected void buildPage(final ReducedFormPage formPage, final boolean hasAlreadyBeenDisplayed,
        final boolean isNextPage) {

    enableButtons(false);
    final ReducedHtmlTemplate pageTemplate = formPage.getPageTemplate();
    if (pageHTMLPanel != null) {
        if (applicationHTMLPanel != null) {
            applicationHTMLPanel.remove(pageHTMLPanel);
        }
    }
    pageHTMLPanel = new HTMLPanel(pageTemplate.getBodyContent());

    final String onloadAttributeValue = domUtils.insertPageTemplate(pageTemplate.getHeadNodes(), pageHTMLPanel,
            pageTemplate.getBodyAttributes(), applicationHTMLPanel, elementId);
    final Element pageLabelElement = DOM.getElementById(DOMUtils.PAGE_LABEL_ELEMENT_ID);
    if (pageLabelElement != null) {
        String pageLabel = formPage.getPageLabel();
        if (pageLabel.startsWith("#")) {
            pageLabel = FormsResourceBundle.getMessages().caseStartLabelPrefix() + " " + pageLabel.substring(1);
        }
        domUtils.insertInElement(pageHTMLPanel, DOMUtils.PAGE_LABEL_ELEMENT_ID, pageLabel,
                !formPage.allowHTMLInLabel());
    }

    if (FormType.entry == formPage.getFormType()) {
        buildEditMode(pageHTMLPanel, formPage, hasAlreadyBeenDisplayed, isNextPage, onloadAttributeValue);
        final String autoSubmit = (String) urlContext.get(URLUtils.AUTO_SUBMIT_PARAM);
        if (autoSubmit != null) {
            final FormButtonWidget autoSubmitButton = buttonWidgets.get(autoSubmit);
            if (autoSubmitButton != null && autoSubmitButton.getWidgetType().equals(WidgetType.BUTTON_SUBMIT)) {
                disableButtons(autoSubmitButton.getButton());
                validatePage(ACTION_TYPE.SUBMIT);
            }
        }
    } else {
        buildViewMode(pageHTMLPanel, formPage, hasAlreadyBeenDisplayed, isNextPage, onloadAttributeValue);
    }
    domUtils.overrideBrowserNativeInputs();
    domUtils.hideLoading();

}

From source file:org.chtijbug.workbench.drools.client.navbar.LogoWidgetView.java

License:Apache License

@PostConstruct
public void init() {
    final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, "banner/banner.html");
    rb.setCallback(new RequestCallback() {
        @Override//from   w  w  w  . j a v a  2 s .  co  m
        public void onResponseReceived(final Request request, final Response response) {
            final HTMLPanel html = new HTMLPanel(response.getText());
            container.setWidget(html);
        }

        @Override
        public void onError(final Request request, final Throwable exception) {
            container.setWidget(new Label(AppConstants.INSTANCE.logoBannerError()));
        }
    });
    try {
        final Request r = rb.send();
    } catch (RequestException re) {
        container.setWidget(new Label(AppConstants.INSTANCE.logoBannerError()));
    }

    initWidget(container);
}

From source file:org.curriki.gwt.client.widgets.metadata.MetadataEdit.java

License:Open Source License

private void addCRS(Document doc, Panel panel, boolean isPrivate) {
    String role = Main.getProperty("role");
    XObject crsObj = doc.getObject(Constants.CURRIKI_REVIEW_STATUS_CLASS);
    Integer reviewpending = (crsObj == null) ? null
            : (Integer) crsObj.get(Constants.CURRIKI_REVIEW_STATUS_REVIEWPENDING);
    String status = (crsObj == null) ? null : (String) crsObj.get(Constants.CURRIKI_REVIEW_STATUS_STATUS);
    currentCRSStatus = status;//from ww  w  . ja v a2 s . c  o  m
    String lastReviewDate = (crsObj == null) ? ""
            : crsObj.getViewProperty(Constants.CURRIKI_REVIEW_STATUS_LASTTREVIEWDATE);
    FlowPanel crsPanel = new FlowPanel();
    crsPanel.setStyleName("crs_review");
    HTMLPanel crsPanelTitle = new HTMLPanel(Main.getTranslation("curriki.crs.currikireview"));
    crsPanelTitle.setStyleName("crs_reviewtitle");
    crsPanel.add(crsPanelTitle);
    String txt = Main.getTranslation("curriki.crs.review.tooltip");
    Image image = new Image(Constants.ICON_PATH + "exclamation.png");
    PopupPanel popup = new PopupPanel(true);
    popup.setStyleName("metadata-tooltip-popup");
    // popup.setWidth("300px");
    popup.add(new HTML(txt));
    image.addMouseListener(new TooltipMouseListener(popup));
    crsPanel.add(image);
    FlowPanel crsRatingPanel = new FlowPanel();
    crsRatingPanel.setStyleName("crs_reviewrating");
    if ((status == null) || (status.equals("100")) || (status.equals(""))) {
        crsRatingPanel.setStyleName("crs_reviewnorating");
        HTMLPanel crsRatingTextPanel = new HTMLPanel(Main.getTranslation("curriki.crs.unrated"));
        crsRatingTextPanel.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingTextPanel);
    } else {
        HTMLPanel crsRatingTextPanel = new HTMLPanel(Main.getTranslation("curriki.crs.rating" + status));
        crsRatingTextPanel.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingTextPanel);
        if ((lastReviewDate != null) && (!lastReviewDate.equals(""))) {
            String sreviewDate = (lastReviewDate.length() >= 8) ? lastReviewDate.substring(0, 8)
                    : lastReviewDate;
            HTMLPanel crsRatingDatePanel = new HTMLPanel(
                    Main.getTranslation("curriki.crs.asof") + " " + sreviewDate);
            crsRatingDatePanel.setStyleName("crs_reviewratingdate");
            crsRatingPanel.add(crsRatingDatePanel);
        }
        Image crsRatingImage = new Image(Constants.SKIN_PATH + "crs" + status + ".gif");
        crsRatingImage.addClickListener(new ClickListener() {
            public void onClick(Widget widget) {
                ComponentsPage.getSingleton().switchPage("comment");
            }
        });
        crsRatingImage.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingImage);
    }
    crsPanel.add(crsRatingPanel);
    if (!"200".equals(status) && !isPrivate) {
        if ((reviewpending != null) && reviewpending.intValue() == 1) {
            HTMLPanel crsReviewPendingPanel = new HTMLPanel(Main.getTranslation("curriki.crs.reviewpending"));
            crsReviewPendingPanel.setStyleName("crs_reviewpending");
            crsPanel.add(crsReviewPendingPanel);
        } else {
            Hyperlink crsReviewNominateLink = new Hyperlink();
            crsReviewNominateLink.setHTML(Main.getTranslation("curriki.crs.reviewnominate"));
            crsReviewNominateLink.setStyleName("crs_reviewnominate");
            crsReviewNominateLink.addClickListener(new ClickListener() {
                public void onClick(Widget widget) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    new NominateDialog(currentAsset, new AsyncCallback() {
                        public void onFailure(Throwable throwable) {
                            // nothing to do this was a cancel
                        }

                        public void onSuccess(Object object) {
                            // Refresh the page
                            Editor editor = Main.getSingleton().getEditor();
                            editor.setCurrentAssetInvalid(true);
                            editor.refreshState();
                        }
                    });

                    // String url = Main.getTranslation("params.crs.nominateurl") + "?fromgwt=1&page=" + currentAsset.getFullName();
                    // Window.open(url, "_blank", "");
                }
            });
            crsPanel.add(crsReviewNominateLink);
        }

        // if the reviewer mode is set to one then we show the review link
        if (("reviewer".equals(role)) || ("admin".equals(role))) {
            Hyperlink crsReviewReviewLink = new Hyperlink();
            crsReviewReviewLink.setHTML(Main.getTranslation("curriki.crs.review"));
            crsReviewReviewLink.setStyleName("crs_reviewreview");
            crsReviewReviewLink.addClickListener(new ClickListener() {
                public void onClick(Widget widget) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    String url = Main.getTranslation("params.crs.reviewurl") + "?page="
                            + currentAsset.getFullName();
                    Window.open(url, "_blank", "");
                }
            });
            crsPanel.add(crsReviewReviewLink);
        }
    }

    /*
    // We are not putting the set to partner button anymore in the CB
    // see CURRIKI-2781
    if ("admin".equals(role)) {
    final CheckBox setToPCheckBox = new CheckBox(Main.getTranslation("curriki.crs.settopartner"));
    setToPCheckBox.setChecked("200".equals(currentCRSStatus));
    setToPCheckBox.addClickListener(new ClickListener() {
        public void onClick(Widget widget) {
            String questionText;
            String titleText;
            if ("200".equals(currentCRSStatus)) {
                questionText = Main.getTranslation("curriki.crs.confirmunsettopartner");
                titleText = "curriki.crs.unsettopartner";
            } else {
                questionText = Main.getTranslation("curriki.crs.confirmsettopartner");
                titleText = "curriki.crs.settopartner";
            }
            ncDialog = new NextCancelDialog(titleText, questionText, "crsconfirmsettopartner", new AsyncCallback() {
                public void onFailure(Throwable throwable) {
                    setToPCheckBox.setChecked("200".equals(currentCRSStatus));
                    ncDialog.hide();
                }
                public void onSuccess(Object object) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    final String newCRSStatus =  "200".equals(currentCRSStatus) ? "100" : "200";
                    ncDialog.hide();
                    CurrikiService.App.getInstance().updateProperty(currentAsset.getFullName(), Constants.CURRIKI_REVIEW_STATUS_CLASS, "status", newCRSStatus, new CurrikiAsyncCallback() {
                        public void onFailure(Throwable caught) {
                            super.onFailure(caught);
                            setToPCheckBox.setChecked("200".equals(currentCRSStatus));
                        }
            
                        public void onSuccess(Object result) {
                            super.onSuccess(result);
                            setToPCheckBox.setChecked("200".equals(newCRSStatus));
                            currentCRSStatus = newCRSStatus;
                        }
                    });
                }
            });
            
        }
    });
    crsPanel.add(setToPCheckBox);
    }
    */
    panel.add(crsPanel);

}

From source file:org.dashbuilder.client.navbar.LogoWidgetView.java

License:Apache License

@PostConstruct
public void init() {
    final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, "banner/banner.html");
    rb.setCallback(new RequestCallback() {
        @Override//w  w  w .  j  av a 2 s  .co m
        public void onResponseReceived(final Request request, final Response response) {
            final HTMLPanel html = new HTMLPanel(response.getText());
            container.setWidget(html);
        }

        @Override
        public void onError(final Request request, final Throwable exception) {
            container.setWidget(new Label(AppConstants.INSTANCE.logoBannerError()));
        }
    });
    try {
        rb.send();
    } catch (RequestException re) {
        container.setWidget(new Label(AppConstants.INSTANCE.logoBannerError()));
    }

    initWidget(container);
}

From source file:org.dashbuilder.client.navbar.TopMenuBar.java

License:Apache License

public void setNavHeaderHtml(String htmlFile) {
    DOMUtil.removeAllChildren(navHeader);

    RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, htmlFile);
    rb.setCallback(new RequestCallback() {

        public void onResponseReceived(Request request, Response response) {
            HTMLPanel html = new HTMLPanel(response.getText());
            navHeader.appendChild((Node) html.getElement());
        }// w  w  w  .j a  v  a  2 s.  com

        public void onError(Request request, Throwable exception) {
            Label label = new Label(AppConstants.INSTANCE.logoBannerError());
            navHeader.appendChild((Node) label.getElement());
        }
    });

    try {
        rb.send();
    } catch (RequestException re) {
        Label label = new Label(AppConstants.INSTANCE.logoBannerError());
        navHeader.appendChild((Node) label.getElement());
    }
}

From source file:org.dashbuilder.renderer.client.metric.MetricView.java

License:Apache License

@Override
public void setHtml(String html) {
    htmlPanel = new HTMLPanel(html);
    container.clear();
    container.add(htmlPanel);
}

From source file:org.daxplore.presenter.client.ui.WidgetAnchor.java

License:Open Source License

public void setHref(String href) {
    HTMLPanel htmlPanel = new HTMLPanel("<a href='" + href + "'><div id='anchor-widget'></div></a>");
    htmlPanel.addAndReplaceElement(widget, "anchor-widget");
    panel.setWidget(htmlPanel);/*from ww w  .java2  s . c o m*/
}