Example usage for com.google.gwt.user.client Element getInnerHTML

List of usage examples for com.google.gwt.user.client Element getInnerHTML

Introduction

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

Prototype

@Override
    public String getInnerHTML() 

Source Link

Usage

From source file:ca.upei.ic.timetable.client.ApplicationView.java

License:Apache License

public ApplicationView(ApplicationController app) {
    app_ = app;//w  w  w . j  av a 2s  . c  om

    // hide the root panel first
    hide();

    // create the application view elements
    // we are using a horizontal split panel to host the left side (course view)
    // and the right side (calendar view)
    DockPanel panel = GWT.create(DockPanel.class);
    panel.setSize("980px", "580px");

    final View findCourseView = app_.getFindCourseController().getView();

    // find course button
    final Button findCourseButton = GWT.create(Button.class);
    findCourseButton.setText("Find Course...");
    findCourseButton.setPixelSize(250, 28);
    findCourseButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            findCourseView.show();
        }

    });
    // message view
    final View messageView = app_.getMessageController().getView();

    // course view
    final View courseView = app_.getCourseController().getView();
    courseView.getWidget().setWidth("340px");

    // calendar view
    final View calendarView = app_.getCourseCalendarController().getView();

    // top panel
    HorizontalPanel topPanel = GWT.create(HorizontalPanel.class);
    topPanel.add(findCourseButton);
    headerPanel_ = GWT.create(HorizontalPanel.class);
    SimplePanel topleft = PanelUtils.simplePanel(new HTML(""), 61, 28);
    headerPanel_.add(topleft);

    // add headers
    for (int i = 1; i < 6; i++) {
        SimplePanel header = GWT.create(SimplePanel.class);
        header.addStyleName("gridHeaderCell");
        header.setPixelSize(128, 28);
        header.add(new HTML(headerStrings[i]));
        headerPanel_.add(header);
    }

    topPanel.add(headerPanel_);

    // add elements to the dock panel
    // to north (top bar)
    panel.add(PanelUtils.horizontalPanel(findCourseButton, headerPanel_), DockPanel.NORTH);
    // to west (left side bar)
    panel.add(PanelUtils.verticalPanel(
            PanelUtils.decoratorPanel(PanelUtils.scrollPanel(courseView.getWidget(), 240, 555)),
            PanelUtils.horizontalPanel(ButtonUtils.button("Clear", 125, 25, new ClickListener() {
                public void onClick(Widget sender) {
                    app_.getCourseController().clear();
                }
            }, null), ButtonUtils.button("Print...", 125, 25, new ClickListener() {
                public void onClick(Widget sender) {
                    Element wrapper = DOM.createDiv();
                    Element header = (Element) headerPanel_.getElement().cloneNode(true);
                    wrapper.appendChild(header);
                    CalendarPanel calendar = (CalendarPanel) app_.getCourseCalendarController().getView()
                            .getWidget();
                    int height = calendar.getRealHeight();
                    Element calendarElement = (Element) calendar.getElement().cloneNode(true);
                    DOM.setStyleAttribute(calendarElement, "page-break-inside", "avoid");
                    DOM.setStyleAttribute(calendarElement, "height", (height + 50) + "px");
                    wrapper.appendChild(calendarElement);
                    app_.print("Main.css", wrapper.getInnerHTML());
                }
            }, null))), DockPanel.WEST);
    // to center (content)
    panel.add(calendarView.getWidget(), DockPanel.CENTER);

    // to footer (copyright)
    panel.add(new HTML(
            "&copy; 2008 University of Prince Edward Island. This is an <a href=\"http://github.com/upei/\">open-source project</a> licensed under Apache License 2.0."),
            DockPanel.SOUTH);

    // add the horizontal panel
    RootPanel.get().add(panel);
}

From source file:mr.davidsanderson.uml.client.impl.MessagePanelImpl.java

License:Apache License

public void addMessage(String msg) {
    Element elementById = htmlPanel.getElementById("MessagePanel");
    String innerHTML = elementById.getInnerHTML();
    innerHTML += msg;//from   w  w  w.j a  va2s. c om
    elementById.setInnerHTML(innerHTML);
}

From source file:org.bonitasoft.forms.client.view.common.DOMUtils.java

License:Open Source License

private boolean isContainHeadNode(final Element headElement, final HeadNode headNode) {
    boolean isContained = false;
    final Map<String, String> attributeMap = headNode.getAttributes();
    final String headInnerHtml = headNode.getInnerHtml();
    final int childrenCount = DOM.getChildCount(headElement);
    for (int i = 0; i < childrenCount; i++) {
        final Element childElement = DOM.getChild(headElement, i);

        boolean isSameNode = true;
        int theIndex = 0;
        if (headNode.getTagName() != null
                && headNode.getTagName().equalsIgnoreCase(childElement.getTagName())) {
            final String childElementValue = childElement.getInnerHTML();
            boolean innerHtml = false;
            if (headInnerHtml == null && childElementValue == null) {
                innerHtml = true;/*  w  ww  .java2 s .  c o m*/
            } else if (headInnerHtml != null && childElementValue != null) {
                if (headInnerHtml.equals(childElementValue)) {
                    innerHtml = true;
                }
            }
            if (innerHtml) {
                for (final Entry<String, String> attributeEntry : attributeMap.entrySet()) {
                    if (!isSameNode) {
                        break;
                    }
                    final String attributeKey = attributeEntry.getKey();
                    final String attribeteValue = attributeEntry.getValue();
                    if (childElement.hasAttribute(attributeKey)) {
                        final String childElementAttributeValue = childElement.getAttribute(attributeKey);
                        isSameNode = childElementAttributeValue.equals(attribeteValue);
                        if (isSameNode) {
                            theIndex++;
                        }
                    }

                }
            }
            if (theIndex == attributeMap.size()) {
                isContained = true;
                break;
            }
        }
    }
    return isContained;
}

From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java

License:Open Source License

/**
 * This method is used to set default data.
 */// w  w w . jav a2s  .com
void setData() {
    collectionSummaryText.setText(i18n.GL1587());
    collectionSummaryText.getElement().getStyle().setPaddingBottom(15, Unit.PX);
    collectionSummaryText.addStyleName("collectionSummaryText");
    printWidget.add(collectionSummaryText);
    teacherTabContainer = new AnalyticsTabContainer() {
        @Override
        public void onTabClick(String tabClicked) {
            if (SCORED.equalsIgnoreCase(tabClicked)) {
                hideAllPanels();
                teacherScoredDatapnl.setVisible(true);
            } else if (OPENENDED.equalsIgnoreCase(tabClicked)) {
                hideAllPanels();
                teacherOpenendedData.setVisible(true);
            } else if (BREAKDOWN.equalsIgnoreCase(tabClicked)) {
                hideAllPanels();
                teacherResourceBreakdownDatapnl.setVisible(true);
            } else if (PRINT.equalsIgnoreCase(tabClicked)) {
                Element printElement = collectionSummaryText.getElement();
                printElement.appendChild(collectionSummaryWidget.getElement());
                printElement.appendChild(scoredQuestionHeading.getElement());
                printElement.appendChild(scoredPrintWidget.getElement());
                printElement.appendChild(opendedQuestionHeading.getElement());
                printElement.appendChild(printOpendedData.getElement());
                printElement.appendChild(collectionOverViewWidget.getElement());
                printElement.appendChild(printResourceData.getElement());
                scoredPrintWidget.setVisible(true);
                Print.it(style, printElement);
                scoredPrintWidget.setVisible(false);
            } else {
                scoredPrintWidget.setVisible(true);
                Element printElement = collectionSummaryText.getElement();
                printElement.appendChild(collectionSummaryWidget.getElement());
                printElement.appendChild(scoredQuestionHeading.getElement());
                printElement.appendChild(scoredPrintWidget.getElement());
                printElement.appendChild(opendedQuestionHeading.getElement());
                printElement.appendChild(printOpendedData.getElement());
                printElement.appendChild(collectionOverViewWidget.getElement());
                printElement.appendChild(printResourceData.getElement());
                getUiHandlers().setHtmltopdf(
                        style.toString().replaceAll("'", "\\\\\"")
                                + printElement.getInnerHTML().toString().replaceAll("\"", "\\\\\""),
                        collectionMetaData.getTitle() != null ? collectionMetaData.getTitle() : "");
                scoredPrintWidget.setVisible(false);
            }
        }
    };
    teacherTabContainer.getEmailButton().setVisible(false);
    tabContainer.add(teacherTabContainer);
    filterDropDown.clear();
    filterDropDown.addItem("All", "All");
    filterDropDown.addItem("Questions", "Questions");
    filterDropDown.addItem("Resources", "Resources");
}

From source file:org.gk.client.GKEngine.java

License:Open Source License

public void renderElement(Element ele) {
    String gulSyntax = "<page>" + ele.getInnerHTML() + "</page>";
    Element div = DOM.createDiv();
    div.setId(ele.getId());/* w  w  w  .  j  av  a2  s . c o  m*/
    ele.getParentElement().replaceChild(div, ele);
    if (div.getId().equals("")) {
        div.setId(DOM.createUniqueId());
    }
    LayoutContainer lc = new LayoutContainer();
    lc.setLayout(new FitLayout());
    RootPanel.get(div.getId()).add(lc);
    gk.render(gulSyntax, lc);
}

From source file:org.gk.engine.client.event.attrib.ValueAttribute.java

License:Open Source License

@Override
public Object getAttributeValue(Component com) {
    Object value = null;// w  w w .  j av  a2  s.  co  m
    if (com instanceof IC) {
        value = ((IC) com).getInfo();
    } else if (com instanceof gkHtmlContainer) {
        gkHtmlContainer hc = (gkHtmlContainer) com;
        value = hc.getHtml();
    } else if (com instanceof Field) {
        Field field = (Field) com;
        if (field instanceof DateField) {
            value = DateTimeUtils.getValue((DateField) field);
        } else if (field instanceof gkTimeField) {
            value = ((gkTimeField) field).getTimeValue();
        } else {
            value = field.getValue();
        }
    } else if (com instanceof gkButton) {
        gkButton field = (gkButton) com;
        value = field.getValue();
    } else if (com instanceof LayoutContainer) {
        // LayoutContainer,Frame?URL
        // XFrameLayoutContainerFrame ( XFrame)
        Object obj = ((LayoutContainer) com).getItem(0);
        if (obj instanceof WidgetComponent && ((WidgetComponent) obj).getWidget() instanceof Frame) {
            Frame frame = (Frame) ((WidgetComponent) obj).getWidget();
            value = frame.getUrl();
        }
    } else {
        // ???Element?html
        Element ele = com.getElement();
        value = ele.getInnerHTML();
        Component g = ComponentManager.get().get(ele.getAttribute("gid"));
        if (g instanceof Grid) {
            // ??cellEditor??
            String[] param = ele.getId().split("_");
            if (param.length != 2) {
                return value;
            }
            String columnName = ((Grid) g).getColumnModel().getColumnById(param[0]).getDataIndex();
            int rowIdx = Integer.parseInt(param[1]);
            ModelData md = (ModelData) ((Grid) g).getStore().getModels().get(rowIdx);
            value = md.get(columnName);
        }
    }
    return value;
}

From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.AreaModule.java

License:Open Source License

public AreaModule(String id, String path, Element divElement, String moduleType, MainModule mainModule) {
    super(id, path, divElement, mainModule);
    hasDragDrop = false;/*  w w  w .  ja v  a  2s  . com*/
    addIconInHeader = false;

    head = new Header();

    if (editable) {
        add(head);
    }

    this.mockupStyle = DOM.getElementAttribute(divElement, "mockupStyle");
    this.missingList = "true".equals(DOM.getElementAttribute(divElement, "missingList"));
    this.showAreaButton = "true".equals(DOM.getElementAttribute(divElement, "showAreaButton"));
    this.areaHolder = DOM.getElementAttribute(divElement, "areaHolder");
    this.conflictsWith = DOM.getElementAttribute(divElement, "conflictsWith");
    String areaType = DOM.getElementAttribute(divElement, "areaType");
    if (areaType != null && areaType.length() > 0) {
        this.areaType = areaType;
    }

    if (this.conflictsWith.length() == 0) {
        this.conflictsWith = null;
    }

    String areaTitle;
    if (path.contains("/")) {
        areaTitle = path.substring(path.lastIndexOf('/') + 1);
    } else {
        areaTitle = path;
    }
    setHeaderText(areaTitle);

    head.setId("JahiaGxtArea__" + areaTitle);
    head.setTextStyle("x-panel-header-text-" + moduleType + "module");
    head.addStyleName("x-panel-header");
    head.addStyleName("x-panel-header-" + moduleType + "module");

    html = new HTML(divElement.getInnerHTML());

    content = new LayoutContainer();
    content.add(html);
    add(content);
}

From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.ListModule.java

License:Open Source License

public ListModule(String id, String path, Element divElement, MainModule mainModule) {
    super(id, path, divElement, mainModule);
    head = new Header();

    if (editable) {
        add(head);/*from   w  w  w.  j  av a  2s.c  om*/
    }

    if (path.contains("/")) {
        head.setText(Messages.get("label.list") + " : " + path.substring(path.lastIndexOf('/') + 1));
    } else {
        head.setText(Messages.get("label.list") + " : " + path);
    }
    setBorders(false);
    //        setBodyBorder(false);
    head.addStyleName("x-panel-header");
    head.addStyleName("x-panel-header-listmodule");
    html = new HTML(divElement.getInnerHTML());
    add(html);
}

From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.SimpleModule.java

License:Open Source License

public SimpleModule(String id, final String path, Element divElement, final MainModule mainModule,
        boolean header) {
    super(id, path, divElement, mainModule);

    hasDragDrop = !"false".equals(DOM.getElementAttribute(divElement, "dragdrop"));
    editable = !"false".equals(DOM.getElementAttribute(divElement, "editable"));
    bindable = "true".equals(DOM.getElementAttribute(divElement, "bindable"));

    if ((header || bindable) && editable) {
        head = new Header();
        add(head);//w ww  .j a  v  a 2  s  . c o  m
        setHeaderText(path.substring(path.lastIndexOf('/') + 1));
        head.addStyleName("x-panel-header");
        head.addStyleName("x-panel-header-simplemodule");
        setBorders(false);
    }

    html = new HTML(divElement.getInnerHTML());
    add(html);

    if (bindable) {
        head.addTool(new ToolButton("x-tool-pin", new BindSelectionListener(mainModule)));
    }
}

From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.decorator.NuxeoDecoratorVisitor.java

License:Apache License

protected void decorateText(String textToDecorate) {
    checkEndNodeFound();// w  w  w .  j a va  2  s.com

    String afterText = getAfterText();
    Log.debug("Decorator -- afterText: " + afterText);
    if (afterText.length() > 0) {
        textToDecorate = textToDecorate.substring(0, textToDecorate.length() - afterText.length());
    }

    if (currentNode.getParentNode().getNodeName().equalsIgnoreCase("tr")) {
        // don't add nodes to tr
        return;
    }

    com.google.gwt.dom.client.Element spanElement = decorateTextWithSpan(textToDecorate);
    if (spanElement == null) {
        if (afterText.length() > 0) {
            Document document = currentNode.getOwnerDocument();
            Node parent = currentNode.getParentNode();
            insertBefore(parent, currentNode, document.createTextNode(afterText));
        }
    } else {
        Log.debug("Decorator -- span element: " + spanElement.getInnerHTML());
        if (afterText.length() > 0) {
            Document document = currentNode.getOwnerDocument();
            Node parent = currentNode.getParentNode();
            insertBefore(parent, spanElement.getNextSibling(), document.createTextNode(afterText));
        }
    }
}