Example usage for com.google.gwt.dom.client Element toString

List of usage examples for com.google.gwt.dom.client Element toString

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.eternach.client.RichOptionGroupWidget.java

License:Apache License

public TooltipInfo getTooltipInfo(final Element element) {
    Element lookupElement = element;
    while (lookupElement != getWidget().getElement()) {
        if (elementsToDescription.containsKey(lookupElement)) {
            return new TooltipInfo(elementsToDescription.get(lookupElement));
        }/*from www. j a v a2 s  .  c  om*/
        lookupElement = lookupElement.getParentElement();
        VConsole.error(element.toString());
    }
    return null;
}

From source file:com.horaz.client.model.BaseModel.java

License:Open Source License

/**
 * reads data from form elements/*  ww w.  jav  a 2 s .c  o m*/
 * @param form
 * @throws ValidationException if validation fails
 */
public void setFields(FormElement form) throws ValidationException {
    for (ModelField fld : getStructure()) {
        Element elm = form.getElements().getNamedItem(fld.name);
        if (elm == null) {
            continue;
        }
        // get values
        Object value;
        if (elm instanceof InputElement) {
            value = ((InputElement) elm).getValue();
        } else if (elm instanceof TextAreaElement) {
            value = ((TextAreaElement) elm).getValue();
        } else {
            // TODO vervollstndigen
            value = elm.toString();
        }
        if (fld.validation != null) {
            if (!fld.validation.validate(value)) {
                throw new ValidationException(fld);
            }
        }
        fields.put(fld.name, value);
    }
}

From source file:com.vaadin.client.MeasuredSize.java

License:Apache License

private void debugSizeChange(Element element, String sizeChangeType, String changedFrom, String changedTo) {
    if (debugSizeChanges) {
        getLogger().info(sizeChangeType + " has changed from " + changedFrom + " to " + changedTo + " for "
                + element.toString());
    }/*from  w  ww .  j a  v a  2 s .co  m*/
}

From source file:org.waveprotocol.wave.client.common.util.DomHelper.java

License:Apache License

/**
 * @param element/*from   w ww  . java  2 s.c om*/
 * @return editability in terms of content-editable only (ignore tag names)
 */
public static ElementEditability getContentEditability(Element element) {
    String editability = null;
    if (UserAgent.isSafari()) {
        JsoView style = JsoView.as(element.getStyle());
        editability = style.getString(WEBKIT_USER_MODIFY);
        if ("read-write-plaintext-only".equalsIgnoreCase(editability)
                || "read-write".equalsIgnoreCase(editability)) {
            return ElementEditability.EDITABLE;
        } else if (editability != null && !editability.isEmpty()) {
            return ElementEditability.NOT_EDITABLE;
        }

        // NOTE(danilatos): The css property overrides the contentEditable attribute.
        // Still keep going just to check the content editable prop, if no css property set.
    }
    try {
        editability = element.getAttribute("contentEditable");
    } catch (JavaScriptException e) {
        String elementString = "<couldn't get element string>";
        String elementTag = "<couldn't get element tag>";
        try {
            elementString = element.toString();
        } catch (Exception exception) {
        }
        try {
            elementTag = element.getTagName();
        } catch (Exception exception) {
        }

        StringBuilder sb = new StringBuilder();
        sb.append("Couldn't get the 'contentEditable' attribute for element '");
        sb.append(elementString).append("' tag name = ").append(elementTag);
        throw new RuntimeException(sb.toString(), e);
    }
    if (editability == null || editability.isEmpty()) {
        return ElementEditability.NEUTRAL;
    } else {
        return "true".equalsIgnoreCase(editability) ? ElementEditability.EDITABLE
                : ElementEditability.NOT_EDITABLE;
    }
}

From source file:rocket.dom.client.Dom.java

License:Apache License

/**
 * This method is smart in that it tests the tag type of the given element
 * and reads the appropriate attribute that contains the textual value of
 * this element. This is the value that would have been submitted for this
 * field if its parent form was submitted.
 * /* w  w  w  . ja va  2  s  . co m*/
 * @param element
 * @return
 */
public static String getFormSubmitValue(final Element element) {
    Checker.notNull("parameter:element", element);

    String value = null;
    while (true) {
        final String tagName = element.getTagName();
        if (DomConstants.LISTBOX_TAG.equals(tagName)) {
            value = element.getAttribute(DomConstants.VALUE);
            break;
        }
        if (DomConstants.TEXTAREA_TAG.equals(tagName)) {
            value = element.getInnerText();
            break;
        }

        if (DomConstants.INPUT_TAG.equals(tagName)) {
            value = element.getAttribute(DomConstants.VALUE);
            break;
        }

        throw new UnsupportedOperationException(
                "Cannot get the formSubmitValue for the element, element: " + element.toString());
    }

    return value;
}