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

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

Introduction

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

Prototype

@Override
    public void setInnerText(String text) 

Source Link

Usage

From source file:cc.kune.gxtbinds.client.actions.gxtui.AbstractGxtMenuItemGui.java

License:GNU Affero Public License

/**
 * Creates the short cut./*from   w  w w  .  ja va2 s .c o  m*/
 * 
 * @param key
 *          the key
 * @param style
 *          the style
 * @return the string
 */
private String createShortCut(final KeyStroke key, final String style) {
    // See: https://yui-ext.com/forum/showthread.php?t=5762
    final Element keyLabel = DOM.createSpan();
    keyLabel.setId(style);
    keyLabel.setInnerText(key.toString());
    return keyLabel.getString();
}

From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.model.PropertyTypeModel.java

License:Apache License

private static String rerenderTypes(String commaValues) {
    String[] tokens = commaValues.split(",");
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < tokens.length; i++) {
        final Element div = DOM.createDiv();
        div.setInnerText(tokens[i].trim());
        sb.append(div.getString());//from  w  w w .  j  a  va 2  s .c om
    }
    String newValue = sb.toString();
    return newValue;
}

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);
    DOM.setElementProperty(anchor, "href", "#");
    String link = DOM.toString(anchor);
    boolean isValid = entity.getInvalidation() == null;
    if (isValid) {
        return link;
    }/* w  w w . ja  va  2 s. c  o  m*/
    Element div = DOM.createDiv();
    div.setAttribute("class", "invalid");
    div.setInnerHTML(link);
    return DOM.toString(div);
}

From source file:co.fxl.gui.gwt.GWTDisplay.java

License:Open Source License

void addStyle(String text) {
    Element bodyElement = RootPanel.getBodyElement();
    Element newChild = DOM.createElement("style");
    newChild.setInnerText(text);
    com.google.gwt.dom.client.Element parentElement = bodyElement.getParentElement();
    parentElement.insertBefore(newChild, bodyElement);
    styles.add(newChild);//from   w ww .j a va  2 s .c om
    Log.instance().debug("Adding style: " + text);
}

From source file:com.alkacon.forms.client.ComplexTypeRenderer.java

License:Open Source License

/**
 * @see com.alkacon.forms.client.I_EntityRenderer#render(com.alkacon.vie.shared.I_Entity, com.google.gwt.user.client.Element)
 *//*w w w  . ja v  a 2 s .  c  om*/
public void render(I_Entity entity, Element context) {

    Element result = DOM.createDiv();
    result.addClassName(ENTITY_CLASS);
    result.setAttribute("typeof", Vie.removePointyBrackets(entity.getTypeName()));
    result.setAttribute("about", Vie.removePointyBrackets(entity.getId()));
    I_Type entityType = m_vie.getType(entity.getTypeName());
    List<String> attributeNames = entityType.getAttributeNames();
    for (String attributeName : attributeNames) {
        I_Type attributeType = entityType.getAttributeType(attributeName);
        I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
        Element label = DOM.createDiv();
        label.setInnerText(m_widgetService.getAttributeLabel(attributeName));
        label.addClassName(LABEL_CLASS);
        label.setTitle(m_widgetService.getAttributeHelp(attributeName));
        result.appendChild(label);
        renderer.render(entity, attributeName, result, entityType.getAttributeMinOccurrence(attributeName),
                entityType.getAttributeMaxOccurrence(attributeName));
    }
    context.appendChild(result);
}

From source file:com.alkacon.forms.client.ComplexTypeRenderer.java

License:Open Source License

/**
 * @see com.alkacon.forms.client.I_EntityRenderer#render(com.alkacon.vie.shared.I_Entity, java.lang.String, com.google.gwt.user.client.Element, int, int)
 *//*from ww  w  .j  a v  a2s  .  com*/
public void render(I_Entity parentEntity, String attributeName, Element context, int minOccurrence,
        int maxOccurrence) {

    I_EntityAttribute attribute = parentEntity.getAttribute(attributeName);
    Element holderDiv = DOM.createDiv();
    holderDiv.addClassName(WIDGET_HOLDER_CLASS);
    if (attribute.isSimpleValue()) {
        for (int i = 0; i < attribute.getSimpleValues().size(); i++) {
            String value = attribute.getSimpleValues().get(i);
            Element valueDiv = DOM.createDiv();
            valueDiv.setAttribute("property", Vie.removePointyBrackets(attributeName));
            valueDiv.setInnerText(value);
            holderDiv.appendChild(valueDiv);
            context.appendChild(holderDiv);
            m_widgetService.getAttributeWidget(attributeName).initWidget(valueDiv, parentEntity, attributeName,
                    i);
        }
    } else {
        for (I_Entity entity : attribute.getComplexValues()) {
            holderDiv.setAttribute("rel", attributeName);
            render(entity, holderDiv);
        }
    }
}

From source file:com.eduworks.russel.ui.client.pagebuilder.screen.GroupScreen.java

License:Apache License

private void makeOption(final String val, String elementName) {
    Element e = DOM.getElementById(elementName);
    Element a = DOM.createOption();
    a.setInnerText(val);
    e.appendChild(a);//  ww w . j a  va 2  s . c o  m
}

From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java

License:Apache License

/**
 * display Renders the Utility screen using appropriate templates and sets up handlers
 *//* ww w .  ja  v  a  2  s. c  om*/
public void display() {
    if (source == null || source == "")
        return;

    if (DOM.getElementById("permissionModal") == null)
        PageAssembler.inject("flowContainer", "x",
                new HTML(Russel.htmlTemplates.getPermissionManagementPanelWidget().getText()), true);
    PageAssembler.openPopup("permissionModal");

    DOM.getElementById(SOURCE_TYPE).setInnerText(type);
    DOM.getElementById(SOURCE).setInnerText(source);

    if (type.equals(TYPE_RESOURCE)) {
        hide("optionService");
        hide("stdPermissionTitle");
        show("resourcePermissionTitle");
        show("resourceShareWith");
    }

    DOM.getElementById("permissionGroup").removeAllChildren();
    DOM.getElementById("permissionResource").removeAllChildren();
    DOM.getElementById("permissionSearch").removeAllChildren();
    DOM.getElementById("permissionService").removeAllChildren();
    DOM.getElementById("permissionUser").removeAllChildren();

    PageAssembler.attachHandler("resourceShareWith", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            final Element e = DOM.getElementById("resourceShareWith");
            final String s = e.getInnerText();
            RusselApi.toggleResourceSearch(source,
                    DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
                    s.equals("Searchable") ? true : false, new ESBCallback<ESBPacket>() {
                        @Override
                        public void onSuccess(ESBPacket esbPacket) {
                            Element e = DOM.getElementById("resourceShareWith");
                            if (!s.equals("Searchable")) {
                                PageAssembler.addClass(e.getId(), "blue");
                                PageAssembler.removeClass(e.getId(), "white");
                            } else {
                                PageAssembler.removeClass(e.getId(), "blue");
                                PageAssembler.addClass(e.getId(), "white");
                            }
                            e.setInnerText(s.equals("Searchable") ? "Unsearchable" : "Searchable");
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                        }
                    });
        }
    });

    PageAssembler.attachHandler("r-apply", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            PageAssembler.closePopup("permissionModal");
        }
    });

    PageAssembler.attachHandler("r-cancel", Event.ONCLICK, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            PageAssembler.closePopup("permissionModal");
        }
    });

    RusselApi.getServicePermissions(new ESBCallback<ESBPacket>() {
        @Override
        public void onSuccess(ESBPacket esbPacket) {
            fillServicePermissions(esbPacket.getObject("obj"));
            fillTarget();
        }

        @Override
        public void onFailure(Throwable caught) {
        }
    });

    PageAssembler.attachHandler("destinationType", Event.ONCHANGE, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            fillTarget();
        }
    });

    PageAssembler.attachHandler("destination", Event.ONCHANGE, new EventCallback() {
        @Override
        public void onEvent(Event event) {
            togglePermissions();
        }
    });
}

From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java

License:Apache License

private void checkShared() {
    RusselApi.checkSharedWith(source, DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
            new ESBCallback<ESBPacket>() {
                @Override//w w w . j  av  a 2  s  . com
                public void onSuccess(ESBPacket esbPacket) {
                    Element e = DOM.getElementById("resourceShareWith");
                    boolean b = Boolean.parseBoolean(esbPacket.getString("obj"));
                    if (!b) {
                        PageAssembler.addClass(e.getId(), "blue");
                        PageAssembler.removeClass(e.getId(), "white");
                    } else {
                        PageAssembler.removeClass(e.getId(), "blue");
                        PageAssembler.addClass(e.getId(), "white");
                    }
                    e.setInnerText(b ? "Unsearchable" : "Searchable");
                }

                @Override
                public void onFailure(Throwable caught) {
                }
            });
}

From source file:com.eduworks.russel.ui.client.pagebuilder.screen.PermissionScreen.java

License:Apache License

private void fillServicePermissions(JSONObject servicePermissions) {
    for (final String key : servicePermissions.keySet()) {
        String parentName = key.substring(0, 1).toUpperCase() + key.substring(1);
        Element e = DOM.getElementById("permission" + parentName);
        JSONArray permissions = JSONUtils.sort(servicePermissions.get(key).isArray());
        for (int i = 0; i < permissions.size(); i++) {
            final String permission = permissions.get(i).isString().stringValue();
            Element d = DOM.createDiv();
            Element l = DOM.createLabel();
            l.setInnerText(permission.replaceAll("_", " "));
            final Element c = DOM.createInputCheck();
            PageAssembler.attachHandler(c, Event.ONCHANGE, new EventCallback() {
                @Override//w w  w . java 2s  . co m
                public void onEvent(Event event) {
                    String destinationType = DOM.getElementById(DESTINATION_ENTITY_TYPE)
                            .getPropertyString("value");
                    if (!c.getPropertyBoolean("checked")) {
                        RusselApi.removePermission(permission, !type.equals(TYPE_RESOURCE) ? source
                                : destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
                                !type.equals(TYPE_RESOURCE) ? type : destinationType,
                                !type.equals(TYPE_RESOURCE) ? destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value")
                                        : source,
                                !type.equals(TYPE_RESOURCE) ? destinationType : type,
                                new ESBCallback<ESBPacket>() {
                                    @Override
                                    public void onSuccess(ESBPacket esbPacket) {
                                        c.setPropertyBoolean("checked", false);
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        c.setPropertyBoolean("checked", true);
                                    }
                                });
                    } else {
                        RusselApi.addPermission(permission, !type.equals(TYPE_RESOURCE) ? source
                                : destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value"),
                                !type.equals(TYPE_RESOURCE) ? type : destinationType,
                                !type.equals(TYPE_RESOURCE) ? destinationType.equalsIgnoreCase("service") ? key
                                        : DOM.getElementById(DESTINATION_ENTITY).getPropertyString("value")
                                        : source,
                                !type.equals(TYPE_RESOURCE) ? destinationType : type,
                                new ESBCallback<ESBPacket>() {
                                    @Override
                                    public void onSuccess(ESBPacket esbPacket) {
                                        c.setPropertyBoolean("checked", true);
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        c.setPropertyBoolean("checked", false);
                                    }
                                });
                    }
                }
            });
            c.setId(permission + parentName);
            d.appendChild(c);
            d.appendChild(l);
            d.appendChild(createBreak());
            e.appendChild(d);
        }
    }
}