List of usage examples for com.google.gwt.user.client Element setInnerHTML
@Override public void setInnerHTML(String html)
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.InvalidableWithCodeRenderer.java
License:Apache License
public static String render(IInvalidationProvider entity, String code) { final Element anchor = DOM.createAnchor(); anchor.setInnerText(code);//from w ww . j a va2s . com DOM.setElementProperty(anchor, "href", "#"); String link = DOM.toString(anchor); boolean isValid = entity.getInvalidation() == null; if (isValid) { return link; } Element div = DOM.createDiv(); div.setAttribute("class", "invalid"); div.setInnerHTML(link); return DOM.toString(div); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.LinkRenderer.java
License:Apache License
/** renders a div witch looks like an anchor (hand cursor is on div - block) */ public static String renderAsLink(final String message) { final Element div = DOM.createDiv(); div.setInnerHTML(message); div.setClassName("link-style"); return DOM.toString(div); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.MultilineHTML.java
License:Apache License
public static String wrapUpInDivWithTooltip(String text, String tooltip) { final Element div = DOM.createDiv(); div.setInnerHTML(text); div.setTitle(tooltip);//from ww w .jav a 2s. c o m return DOM.toString(div); }
From source file:com.alkacon.geranium.client.util.DebugLog.java
License:Open Source License
/** * Prints a new line into the log window by adding a p-tag including given text as HTML.<p> * /* w w w .j a va 2s. com*/ * @param text the text to print */ public void printLine(String text) { if (!DEBUG) { return; } @SuppressWarnings("unused") Element child = DOM.createElement("p"); child.setInnerHTML(text); m_html.getElement().insertFirst(child); }
From source file:com.eduworks.russel.ds.client.handler.TileHandler.java
License:Apache License
public void assetAdd() { Element e = DOM.getElementById(idPrefix + "-object"); e.removeFromParent();// w w w. j a va 2 s. com Element td = DOM.createTD(); td.setInnerHTML(templates.getEPSSNoteAssetObjectWidget().getText()); Vector<String> iDs = PageAssembler.merge("epssCurrentSection", "x", td); idPrefix = iDs.firstElement().substring(0, iDs.firstElement().indexOf("-")); td.setId(idPrefix + "-assetNote"); addHooks(); PageAssembler.runCustomJSHooks(); refreshTile(null); ((Hidden) PageAssembler.elementToWidget("epssActiveRemoveAsset", PageAssembler.HIDDEN)).setValue(""); ((Hidden) PageAssembler.elementToWidget("epssActiveAddAsset", PageAssembler.HIDDEN)) .setValue(searchRecord.getGuid() + "," + searchRecord.getFilename()); DOM.getElementById("epssUpdate").removeClassName("white"); DOM.getElementById("epssUpdate").addClassName("blue"); DOM.getElementById("r-save-alert").removeClassName("hide"); EPSSEditScreen.addAssetTrigger(); }
From source file:com.extjs.gxt.ui.client.core.CompositeElement.java
License:sencha.com license
/** * Sets the element's inner HTML.//from w ww. j ava 2 s. c o m * * @param html the html */ public void setInnerHtml(String html) { for (Element elem : items) { elem.setInnerHTML(html); } }
From source file:com.extjs.gxt.ui.client.core.MarkupBase.java
License:sencha.com license
public static Element createRootElement(String html) { Element rootElement = DOM.createDiv(); rootElement.setInnerHTML(html); if (rootElement.getFirstChild() != null) { rootElement = rootElement.getFirstChildElement().cast(); }/*from w w w . j a v a 2s . c o m*/ return rootElement; }
From source file:com.extjs.gxt.ui.client.widget.form.Field.java
License:sencha.com license
/** * Clear any invalid styles / messages for this field. *///from ww w . ja v a 2 s. c o m public void clearInvalid() { if (!rendered) { return; } getInputEl().removeStyleName(invalidStyle); if (forceInvalidText != null) { forceInvalidText = null; } if ("side".equals(messageTarget)) { if (errorIcon != null && errorIcon.isAttached()) { ComponentHelper.doDetach(errorIcon); errorIcon.setVisible(false); setAriaState("aria-describedby", ""); } } else if ("title".equals(messageTarget)) { setTitle(""); } else if ("tooltip".equals(messageTarget)) { hideToolTip(); if (toolTip != null) { toolTip.disable(); } } else { Element elem = XDOM.getElementById(messageTarget); if (elem != null) { elem.setInnerHTML(""); } } if (GXT.isAriaEnabled()) { getAriaSupport().setState("aria-invalid", "false"); } fireEvent(Events.Valid, new FieldEvent(this)); }
From source file:com.extjs.gxt.ui.client.widget.form.Field.java
License:sencha.com license
/** * Marks this field as invalid. Validation will still run if called again, and * the error message will be changed or cleared based on validation. To set a * error message that will not be cleared until manually cleared see * {@link #forceInvalid(String)}/*from w w w .j ava 2 s .com*/ * * @param msg the validation message treated as HTML */ public void markInvalid(String msg) { msg = Format.htmlEncode(msg == null ? getMessages().getInvalidText() : msg); activeErrorMessage = msg; if (!rendered || preventMark) { return; } getInputEl().addStyleName(invalidStyle); if ("side".equals(messageTarget)) { if (errorIcon == null) { errorIcon = new WidgetComponent(getImages().getInvalid().createImage()); Element p = el().getParent().dom; errorIcon.render(p); errorIcon.setHideMode(HideMode.VISIBILITY); errorIcon.hide(); errorIcon.setStyleAttribute("display", "block"); errorIcon.el().makePositionable(true); errorIcon.getAriaSupport().setRole("alert"); if (GXT.isAriaEnabled()) { setAriaState("aria-describedby", errorIcon.getId()); errorIcon.setTitle(getErrorMessage()); } } else if (!errorIcon.el().isConnected()) { Element p = el().getParent().dom; p.appendChild(errorIcon.getElement()); } if (!errorIcon.isAttached()) { ComponentHelper.doAttach(errorIcon); } alignErrorIcon(); if (GXT.isIE || GXT.isOpera) { alignErrorIcon(); } // needed to prevent flickering DeferredCommand.addCommand(new Command() { public void execute() { if (errorIcon.isAttached()) { errorIcon.show(); } } }); errorIcon.setToolTip(msg); errorIcon.getToolTip().addStyleName("x-form-invalid-tip"); el().repaint(); } else if ("title".equals(messageTarget)) { setTitle(msg); } else if ("tooltip".equals(messageTarget)) { setToolTip(msg); getToolTip().addStyleName("x-form-invalid-tip"); getToolTip().enable(); } else if ("none".equals(messageTarget)) { // do nothing } else { Element elem = XDOM.getElementById(messageTarget); if (elem != null) { elem.setInnerHTML(msg); } } if (GXT.isAriaEnabled()) { setAriaState("aria-invalid", "true"); } FieldEvent fe = new FieldEvent(this); fe.setMessage(msg); fireEvent(Events.Invalid, fe); }
From source file:com.extjs.gxt.ui.client.widget.grid.ColumnHeader.java
License:sencha.com license
private final void removeChildren(Element parent) { Element child = null;//from ww w . j ava 2 s .c o m while ((child = parent.getFirstChildElement().cast()) != null) { parent.removeChild(child); } String tag = parent.getTagName().toLowerCase(); if (!tag.equals("table") && !tag.equals("tbody") && !tag.equals("tr") && !tag.equals("td")) { parent.setInnerHTML(""); } }