List of usage examples for com.google.gwt.user.client Element setInnerHTML
@Override public void setInnerHTML(String html)
From source file:com.vaadin.terminal.gwt.client.ui.VCustomLayout.java
License:Open Source License
/** Collect locations from template */ private void scanForLocations(Element elem) { final String location = elem.getAttribute("location"); if (!"".equals(location)) { locationToElement.put(location, elem); elem.setInnerHTML(""); int x = Util.measureHorizontalPaddingAndBorder(elem, 0); int y = Util.measureVerticalPaddingAndBorder(elem, 0); FloatSize fs = new FloatSize(x, y); locationToExtraSize.put(location, fs); } else {/* w w w.jav a2s. co m*/ final int len = DOM.getChildCount(elem); for (int i = 0; i < len; i++) { scanForLocations(DOM.getChild(elem, i)); } } }
From source file:fr.fg.client.animation.CountdownUpdater.java
License:Open Source License
public CountdownUpdater(String id, double value, double speed) { this.id = id; this.value = value; this.speed = speed; Element timedElement = DOM.getElementById(id); if (timedElement != null) timedElement.setInnerHTML(Formatter.formatNumber(Math.ceil(value), true)); }
From source file:fr.fg.client.animation.CountdownUpdater.java
License:Open Source License
public void update(int interpolation) { double oldValue = value; value -= speed * interpolation;/* w w w . java 2s .c om*/ if (value < 0) value = 0; if (Math.ceil(oldValue) == Math.ceil(value)) return; Element timedElement = DOM.getElementById(id); if (timedElement != null) timedElement.setInnerHTML(Formatter.formatNumber(Math.ceil(value), true)); }
From source file:fr.fg.client.animation.ToolTipTextUpdater.java
License:Open Source License
protected void setInnerHTML(String html) { Element timedElement = DOM.getElementById(id); if (timedElement != null) { timedElement.setInnerHTML(html); for (int i = 0; i < 4; i++) { Element outlineElement = DOM.getElementById(id + "_" + i); //$NON-NLS-1$ if (outlineElement != null) outlineElement.setInnerHTML(html); }//from w ww . j a v a2 s . co m } Element toolTipElement = toolTipElementId != null ? DOM.getElementById(toolTipElementId) : this.toolTipElement; if (toolTipElement != null && ToolTipManager.getToolTipText(toolTipElement) != null) { ToolTipManager.setToolTipText(toolTipElement, ToolTipManager.getToolTipText(toolTipElement) .replaceAll("(<[^>]+id=\"" + id + "\"[^>]*>)[^<]*<", "$1" + html + "<")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } }
From source file:fr.fg.client.core.BattleReport.java
License:Open Source License
private void buildEnvironment(ReportData report) { environmentPanel.getElement().setInnerHTML(""); boolean systemVisible = false; for (int player = 0; player < 2; player++) { String[] environments;// ww w.ja v a 2 s . c o m int offset; if (player == 0) { environments = report.getAttackerEnvironment().split(","); offset = 400; } else { environments = report.getDefenderEnvironment().split(","); offset = 100; } for (String environment : environments) { if (environment.startsWith("asteroid")) { if (environment.equals("asteroid")) { for (int i = 0; i < 2; i++) { int[] x = { 185, 310 }; int[] y = { offset - 5, offset + 10 }; Element asteroid = DOM.createDiv(); asteroid.setClassName("asteroid env_" + "normal"); asteroid.getStyle().setProperty("left", x[i] + "px"); asteroid.getStyle().setProperty("top", y[i] + "px"); environmentPanel.getElement().appendChild(asteroid); } } else { for (int i = 0; i < 3; i++) { int[] x = { 125, 250, 370 }; int[] y = { offset - 5, offset + 5, offset - 15 }; Element asteroid = DOM.createDiv(); asteroid.setClassName("asteroid " + (i == 1 ? environment : "") + " env_" + "normal"); asteroid.getStyle().setProperty("left", x[i] + "px"); asteroid.getStyle().setProperty("top", y[i] + "px"); environmentPanel.getElement().appendChild(asteroid); } } } else if (!systemVisible && environment.startsWith("system") && (player == 0 || !report.getAttackerEnvironment().contains("system"))) { Integer starImage = Integer.parseInt(environment.substring("system".length())); Element system = DOM.createDiv(); system.setClassName("system"); system.getStyle().setProperty("backgroundPosition", -120 * (starImage - 1) + "px 0"); environmentPanel.getElement().appendChild(system); systemVisible = true; } else if (environment.equals("spaceStation") && (player == 0 || !report.getAttackerEnvironment().contains("spaceStation"))) { Element spaceStation = DOM.createDiv(); spaceStation.setClassName("spaceStation"); spaceStation.setInnerHTML("<div class=\"shield\"></div>"); environmentPanel.getElement().appendChild(spaceStation); } } } }
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 www. ja va2 s . co m*/ elementById.setInnerHTML(innerHTML); }
From source file:mr.davidsanderson.uml.client.impl.MessagePanelImpl.java
License:Apache License
public void clear() { Element elementById = htmlPanel.getElementById("MessagePanel"); elementById.setInnerHTML(""); Log.debug("MessagePanel.clear : clear messages."); graphEventBus.fireEvent(new GraphEvent(origin, GraphEventType.MSG_CLEAR)); }
From source file:org.apache.solr.explorer.client.util.ui.widget.UnorderedList.java
License:Apache License
public void addListItem(String text, boolean html) { Element li = DOM.createElement("LI"); if (html) {/* www .ja v a2 s . c om*/ li.setInnerHTML(text); } else { li.setInnerText(text); } getElement().appendChild(li); }
From source file:org.bonitasoft.forms.client.view.common.DOMUtils.java
License:Open Source License
/** * insert a content inside an element// w w w.j av a 2 s .c o m * * @param htmlPanel * @param pageLabelElementId * @param pageLabel * @param allowHTML */ public void insertInElement(final HTMLPanel htmlPanel, final String elementId, final String content, final boolean preventHTML) { if (htmlPanel != null) { final HTML htmlContent = new HTML(); if (preventHTML) { htmlContent.setText(content); } else { htmlContent.setHTML(content); } htmlPanel.add(htmlContent, elementId); } else { final Element element = DOM.getElementById(elementId); if (element != null) { if (preventHTML) { element.setInnerText(content); } else { element.setInnerHTML(content); } } } }
From source file:org.bonitasoft.web.toolkit.client.ui.component.table.filters.TableFilter.java
License:Open Source License
protected Element makeRootElement() { // Root tag//from ww w .j a v a 2 s . c o m final Element e = DOM.createDiv(); e.addClassName("tablefilter"); e.addClassName(new JsId(this.name).toString("tablefilter")); e.setAttribute("title", this.tooltip); // Label e.setInnerHTML(HTML.label(this.label, XML.getUniqueId())); return e; }