List of usage examples for com.google.gwt.user.client Element setInnerHTML
@Override public void setInnerHTML(String html)
From source file:org.bonitasoft.web.toolkit.client.ViewController.java
License:Open Source License
private static void addClosePopupAction(final RawView view) { final Element popupHeader = DOM.getElementById("popupcontainerheader"); popupHeader.setInnerHTML(""); // To remove button repetition after popup re-opening popupHeader.appendChild(/* w ww. j a v a 2s .com*/ new Link(new JsId("close_popup"), "Close popup", "Close this popup", view.getClosePopupAction()) .getElement()); }
From source file:org.eclipse.che.ide.extension.builder.client.console.BuilderConsoleViewImpl.java
License:Open Source License
private Widget getFullLogsWidget(String logUrl) { HTML html = new HTML(); html.getElement().setId(FULL_LOGS_WIDGET_ID); html.getElement().getStyle().setProperty("fontFamily", "\"Droid Sans Mono\", monospace"); html.getElement().getStyle().setProperty("fontSize", "11px"); html.getElement().getStyle().setProperty("paddingLeft", "2px"); Element text = DOM.createSpan(); text.setInnerHTML(localizationConstant.fullBuildLogConsoleLink()); html.getElement().appendChild(text); Anchor link = new Anchor(); link.setHref(logUrl);/* ww w . j av a 2 s . com*/ link.setText(logUrl); link.setTitle(logUrl); link.setTarget("_blank"); link.getElement().getStyle().setProperty("color", "#61b7ef"); html.getElement().appendChild(link.getElement()); return html; }
From source file:org.geomajas.gwt.client.gfx.context.VmlGraphicsContext.java
License:Open Source License
/** * Draw a string of text onto the <code>GraphicsContext</code>. * /* w w w. j av a2 s. c o m*/ * @param parent * parent group object * @param name * The text's name. * @param text * The actual string content. * @param position * The upper left corner for the text to originate. * @param style * The styling object for the text. */ public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) { if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "shape", null); if (element != null) { // Set position, style and content: applyAbsolutePosition(element, position); Element textbox = helper.createOrUpdateSingleChild(element, "textbox"); VmlStyleUtil.applyStyle(textbox, style); // hook to upper-left corner textbox.setPropertyString("inset", "0px, 0px, 0px, 0px"); textbox.setInnerHTML(text); // Set width, because this may change otherwise... applyElementSize(element, getWidth(), getHeight(), false); } } }
From source file:org.geomajas.quickstart.mobile.client.widget.feature.FeatureInfoPresenterImpl.java
License:Open Source License
@Override public String getTitle() { Feature f = getCurrentFeature();//w ww.ja va2 s.com Element span = DOM.createSpan(); span.setInnerHTML(f.getLayer().getTitle()); span.getStyle().setFontSize(15, Style.Unit.PX); return f.getLabel() + " (" + (currentIndex + 1) + "/" + featureList.size() + ")" + "<br />" + span.getString(); }
From source file:org.gk.engine.client.event.attrib.ValueAttribute.java
License:Open Source License
@Override public void setAttributeValue(Component com, Object value) { if (com instanceof IC) { // TreeMap if (com instanceof gkXMLTreePanelIC && value instanceof Map) { TreeUtils.updateSelectNode((gkXMLTreePanelIC) com, (Map) value); } else if (com instanceof gkTreeDirPanelIC && value instanceof Map) { // ????name Map map = (Map) value; assert map.containsKey(gkTreeDirPanelIC.ID) : "can't found nodeId:" + map; String id = map.get(gkTreeDirPanelIC.ID).toString(); if (map.containsKey(gkTreeDirPanelIC.NAME)) { // name?path?? String name = map.get(gkTreeDirPanelIC.NAME).toString(); TreePanel tree = (TreePanel) com; TreeStore store = tree.getStore(); ModelData md = store.findModel(id); ModelData parent = store.getParent(md); int index = store.indexOf(md); gkMap newmd = (gkMap) gkMap.clone((Map) md); String oldPath = md.get(gkTreeDirPanelIC.PATH).toString(); String oldName = md.get(gkTreeDirPanelIC.NAME).toString(); int last = oldPath.lastIndexOf(oldName); String lastPath = oldPath.substring(last); lastPath = lastPath.replace(oldName, name); String newPath = oldPath.substring(0, last) + lastPath; newmd.set(gkTreeDirPanelIC.NAME, name); newmd.set(gkTreeDirPanelIC.PATH, newPath); store.insert(parent, newmd, index, false); store.remove(md);/*from w w w.j a v a 2 s. co m*/ } } else { ((IC) com).setInfo(value); } } else if (com instanceof gkButton) { gkButton btn = (gkButton) com; btn.setValue((String) value); } else if (com instanceof gkHtmlContainer) { gkHtmlContainer hc = (gkHtmlContainer) com; if (value instanceof Map) { hc.setInfo((Map) value); } else { hc.setHtml((String) value); } } else if (com instanceof LayoutContainer) { String v = (String) value; LayoutContainer lc = (LayoutContainer) com; // LayoutContainer?Frameurl Object obj = lc.getItem(0); if (obj instanceof WidgetComponent && ((WidgetComponent) obj).getWidget() instanceof Frame) { ((Frame) ((WidgetComponent) obj).getWidget()).setUrl(v); } else { Engine.get().renderPanel(v, lc, true); } } else if (com instanceof Field) { Field field = (Field) com; boolean orgFireChange = field.isFireChangeEventOnSetValue(); // field.setFireChangeEventOnSetValue(true); if (field instanceof DateField) { DateTimeUtils.setValue((DateField) field, value + ""); } else if (field instanceof gkTimeField) { ((gkTimeField) field).setTimeValue(value + ""); } else if (field instanceof gkComboBox && value instanceof Map && ((ComboBox) com).getStore().getCount() == 0) { // ????text:valuemap // addstoresetValue ComboBox combo = (ComboBox) com; Map data = (Map) value; combo.getStore().add(new gkMap(data)); combo.getPropertyEditor().setList(combo.getStore().getModels()); field.setValue(value); } else { if (value instanceof String) { field.setValue(field.getPropertyEditor().convertStringValue((String) value)); } else { field.setValue(value); } } field.setFireChangeEventOnSetValue(orgFireChange); // } else { // ???Elementhtml // gidgridModelData Element ele = com.getElement(); ele.setInnerHTML((String) value); // gid????labelField // ?gid?gid,?gid // ??Grid store? String gid = ele.getAttribute("gid"); if (gid == null || gid.equals("")) { gid = ele.getParentElement().getAttribute("gid"); } Component g = ComponentManager.get().get(gid); if (g instanceof Grid) { // ?cellEditor?? String[] param = ele.getId().split("_"); if (param.length != 2) { return; } ListStore ds = ((Grid) g).getStore(); String columnName = ((Grid) g).getColumnModel().getColumnById(param[0]).getDataIndex(); int rowIdx = Integer.parseInt(param[1]); ModelData md = (ModelData) ds.getModels().get(rowIdx); md.set(columnName, value); StoreEvent evt = new StoreEvent(ds); evt.setModel(md); evt.setOperation(RecordUpdate.EDIT); ds.fireEvent(Store.Update, evt); // cellEditor ? Component editorField = ComponentUtils.findComponent(param[0]); if (editorField instanceof Field) { ((Field) editorField).setValue(value); } } } }
From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.ModuleHelper.java
License:Open Source License
public static Map<Element, Module> parse(Module module, Module parent, List<Element> el) { Map<Element, Module> m = new HashMap<Element, Module>(); GWT.log("size : " + el.size()); for (Element divElement : el) { String jahiatype = DOM.getElementAttribute(divElement, JAHIA_TYPE); if ("module".equals(jahiatype)) { String id = DOM.getElementAttribute(divElement, "id"); if (children.get(module.getModuleId()).contains(id)) { Module subModule = modulesById.get(id); if (subModule != null) { subModule.setDepth(module.getDepth() + 1); m.putAll(//from w w w . ja v a 2 s. c om parse(subModule, module, getAllJahiaTypedElementsRec(subModule.getInnerElement()))); m.put(divElement, subModule); divElement.setInnerHTML(""); module.getContainer().add(subModule.getContainer()); } } } } module.setParentModule(parent); module.onParsed(); return m; }
From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.ModuleHelper.java
License:Open Source License
public static void move(Map<Element, Module> m) { long start = System.currentTimeMillis(); for (Element divElement : m.keySet()) { Element moduleElement = m.get(divElement).getContainer().getElement(); divElement.setInnerHTML(""); // Element oldParent = DOM.getParent(divElement); // DOM.appendChild(DOM.clone(divElement, true), moduleElement); // DOM.removeChild(oldParent, divElement); DOM.appendChild(divElement, moduleElement); }/* ww w . j a va 2s . c om*/ GWT.log("Move : " + (System.currentTimeMillis() - start) + " ms"); }
From source file:org.jbpm.console.ng.bd.client.util.DataGridUtils.java
License:Apache License
public static int calculateWidth(final String value) { if (value == null || value.length() == 0) return 0; com.google.gwt.dom.client.Element m = getCharacterMeasuringElement(DEPLOYMENTS_SIZE_CALCULATOR); if (m != null) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(SafeHtmlUtils.fromTrustedString(value)); m.setInnerHTML(sb.toSafeHtml().asString()); int a = m.getClientWidth(); int b = m.getOffsetWidth(); return a; }/* w ww . ja v a2 s . com*/ return 0; }
From source file:org.lightframe.components.client.ui.VWindowManager.java
License:Apache License
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. Ensure correct implementation, // and let the containing layout manage caption, etc. if (client.updateComponent(this, uidl, true)) { return;/*from w w w. j a va2s . c o m*/ } // Save reference to server connection object to be able to send // user interaction later this.client = client; // Save the UIDL identifier for the component uidlId = uidl.getId(); if (uidl.hasAttribute(ATTRIBUTE_SC_WINDOW_NAMES)) { // ugly way to clear all elements. getElement().setInnerHTML(""); final String[] names = uidl.getStringArrayAttribute(ATTRIBUTE_SC_WINDOW_NAMES); for (final String name : names) { final Element windowBox = DOM.createDiv(); windowBox.setInnerHTML(name); windowBox.setClassName(WINDOWBOX_CLASSNAME); DOM.sinkEvents(windowBox, Event.ONCLICK | Event.ONCONTEXTMENU); DOM.appendChild(getElement(), windowBox); } windowCount = names.length; } if (uidl.hasAttribute(ATTRIBUTE_SC_WINDOW_MINIMZED)) { final int[] minimized = uidl.getIntArrayAttribute(ATTRIBUTE_SC_WINDOW_MINIMZED); final NodeList<Node> windowBoxes = getElement().getChildNodes(); for (int i = 0; i < windowBoxes.getLength(); i++) { final Element windowBox = (Element) windowBoxes.getItem(i); windowBox.setClassName(minimized[i] == 1 ? WINDOWBOX_CLASSNAME_MINIMIZED : WINDOWBOX_CLASSNAME); } } }
From source file:org.nsesa.editor.gwt.amendment.client.amendment.DefaultAmendmentManager.java
License:EUPL
/** * Save a list of amendment containers to the backend. * * @param toSave the amendment container DTOs to save *//*ww w. ja v a2s . co m*/ protected void saveAmendmentContainers(final AmendmentContainerDTO... toSave) { final ServiceFactory serviceFactory = documentController.getServiceFactory(); final ClientFactory clientFactory = documentController.getClientFactory(); // serialize amendable widget into XML content for (final AmendmentContainerDTO amendment : toSave) { if (amendment.getRoot() == null) { // overlay is needed final Element span = DOM.createSpan(); span.setInnerHTML(amendment.getBody()); amendment.setRoot( documentController.getOverlayFactory().getAmendableWidget(span.getFirstChildElement())); } amendment.setBody(formatter.format(amendment.getRoot())); amendment.setDocumentID(documentController.getDocument().getDocumentID()); // do some checks to make sure all fields are set if (amendment.getAmendmentContainerID() == null) throw new NullPointerException( "No id set before sending to the backend. This will cause problems."); if (amendment.getRevisionID() == null) throw new NullPointerException( "No revision id set before sending to the backend. This will cause problems."); } serviceFactory.getGwtAmendmentService().saveAmendmentContainers(clientFactory.getClientContext(), new ArrayList<AmendmentContainerDTO>(Arrays.asList(toSave)), new AsyncCallback<AmendmentContainerDTO[]>() { @Override public void onFailure(final Throwable caught) { documentEventBus.fireEvent( new CriticalErrorEvent("Could not save amendment: " + caught.getMessage(), caught)); if (caught instanceof ValidationException) { LOG.log(Level.SEVERE, "Could not save amendment: " + caught.getMessage(), caught); } } @Override public void onSuccess(final AmendmentContainerDTO[] result) { mergeAmendmentContainerDTOs(result); } }); }