List of usage examples for com.google.gwt.user.client Element hasAttribute
@Override
public boolean hasAttribute(String name)
From source file:com.github.gwtbootstrap.client.ui.base.PlaceholderHelper.java
License:Apache License
/** * Get a placeholder attribute (HTML5) from the element. * <p>//from www . j a va 2s . c o m * If the element don't have placeholder attribute,This return empty string. * </p> * @param element the element * @return placeholder attribute. */ public String getPlaceholder(Element element) { return element.hasAttribute(Constants.PLACEHOLDER) ? element.getAttribute(Constants.PLACEHOLDER) : ""; }
From source file:com.github.gwtbootstrap.client.ui.CheckBox.java
License:Apache License
protected CheckBox(Element elem) { super(DOM.createLabel()); assert elem.hasAttribute("type") : "The elem should has type attributes"; //TODO 2012/05/06 ohashi keisuke. ugly code...... if (Constants.CHECKBOX.toLowerCase().equals(elem.getAttribute("type").toLowerCase())) { this.setStyleName(Constants.CHECKBOX); } else if (Constants.RADIO.toLowerCase().equals(elem.getAttribute("type").toLowerCase())) { this.setStyleName(Constants.RADIO); }//from www . ja v a2 s. c om inputElem = InputElement.as(elem); spanElem = Document.get().createSpanElement(); getElement().appendChild(inputElem); getElement().appendChild(spanElem); String uid = DOM.createUniqueId(); inputElem.setPropertyString("id", uid); asLabel().setHtmlFor(uid); directionalTextHelper = new DirectionalTextHelper(spanElem, false); setTabIndex(0); }
From source file:com.qualogy.qafe.mgwt.client.ui.renderer.AbstractEditableComponentRenderer.java
License:Apache License
private void resetInlineStyle(Element element) { if (element == null) { return;//from www. j a v a 2 s.c o m } String inlineStyleInit = element.getPropertyString(QAMLConstants.INTERNAL_STYLE_INIT); if ((inlineStyleInit == null) || (inlineStyleInit.length() == 0)) { inlineStyleInit = QAMLConstants.INTERNAL_EMPTY; if (element.hasAttribute(QAMLConstants.INTERNAL_STYLE)) { inlineStyleInit = element.getAttribute(QAMLConstants.INTERNAL_STYLE); } element.setPropertyString(QAMLConstants.INTERNAL_STYLE_INIT, inlineStyleInit); } else { if (QAMLConstants.INTERNAL_EMPTY.equals(inlineStyleInit)) { inlineStyleInit = ""; } element.setAttribute(QAMLConstants.INTERNAL_STYLE, inlineStyleInit); } }
From source file:com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper.java
License:Open Source License
protected void initDragStartMode() { Element div = getElement(); if (dragStartMode == HTML5) { if (dragStartElement == null) { dragStartElement = getDragStartElement(); dragStartElement.setPropertyBoolean(DRAGGABLE, true); VConsole.log("draggable = " + dragStartElement.getPropertyBoolean(DRAGGABLE)); hookHtml5DragStart(dragStartElement); VConsole.log("drag start listeners hooked."); }//from ww w . jav a2 s. c om } else { dragStartElement = null; if (div.hasAttribute(DRAGGABLE)) { div.removeAttribute(DRAGGABLE); } } }
From source file:org.bonitasoft.forms.client.view.common.DOMUtils.java
License:Open Source License
private boolean isContainHeadNode(final Element headElement, final HeadNode headNode) { boolean isContained = false; final Map<String, String> attributeMap = headNode.getAttributes(); final String headInnerHtml = headNode.getInnerHtml(); final int childrenCount = DOM.getChildCount(headElement); for (int i = 0; i < childrenCount; i++) { final Element childElement = DOM.getChild(headElement, i); boolean isSameNode = true; int theIndex = 0; if (headNode.getTagName() != null && headNode.getTagName().equalsIgnoreCase(childElement.getTagName())) { final String childElementValue = childElement.getInnerHTML(); boolean innerHtml = false; if (headInnerHtml == null && childElementValue == null) { innerHtml = true;/*from w w w . j a v a 2 s . co m*/ } else if (headInnerHtml != null && childElementValue != null) { if (headInnerHtml.equals(childElementValue)) { innerHtml = true; } } if (innerHtml) { for (final Entry<String, String> attributeEntry : attributeMap.entrySet()) { if (!isSameNode) { break; } final String attributeKey = attributeEntry.getKey(); final String attribeteValue = attributeEntry.getValue(); if (childElement.hasAttribute(attributeKey)) { final String childElementAttributeValue = childElement.getAttribute(attributeKey); isSameNode = childElementAttributeValue.equals(attribeteValue); if (isSameNode) { theIndex++; } } } } if (theIndex == attributeMap.size()) { isContained = true; break; } } } return isContained; }
From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.Module.java
License:Open Source License
protected Module(String id, String path, Element divElement, MainModule mainModule) { super();//from w w w.ja v a2 s . c o m this.id = id; this.path = path; // we test for presence of attributes since the getAttribute method will never return null if the // attribute doesn't exist. See http://code.google.com/p/google-web-toolkit/issues/detail?id=1770 if (divElement.hasAttribute("nodetypes")) { nodeTypes = divElement.getAttribute("nodetypes"); } listLimit = !"".equals(DOM.getElementAttribute(divElement, "listlimit")) ? Integer.parseInt(DOM.getElementAttribute(divElement, "listlimit")) : -1; if (divElement.hasAttribute("referenceTypes")) { referenceTypes = divElement.getAttribute("referenceTypes"); if ("none".equals(referenceTypes)) { referenceTypes = ""; } } else { referenceTypes = null; } if (divElement.hasAttribute("scriptInfo")) { scriptInfo = divElement.getAttribute("scriptInfo"); } if (divElement.hasAttribute("sourceInfo")) { sourceInfo = divElement.getAttribute("sourceInfo"); } this.mainModule = mainModule; }
From source file:org.jahia.ajax.gwt.client.widget.edit.mainarea.Module.java
License:Open Source License
protected Module(String id, String path, Element divElement, MainModule mainModule, Layout layout) { super(layout); this.id = id; this.path = path; // we test for presence of attributes since the getAttribute method will never return null if the // attribute doesn't exist. See http://code.google.com/p/google-web-toolkit/issues/detail?id=1770 if (divElement.hasAttribute("nodetypes")) { nodeTypes = divElement.getAttribute("nodetypes"); }/*from ww w . j av a2 s . c o m*/ listLimit = !"".equals(DOM.getElementAttribute(divElement, "listlimit")) ? Integer.parseInt(DOM.getElementAttribute(divElement, "listlimit")) : -1; if (divElement.hasAttribute("referenceTypes")) { referenceTypes = divElement.getAttribute("referenceTypes"); if ("none".equals(referenceTypes)) { referenceTypes = ""; } } else { referenceTypes = null; } if (divElement.hasAttribute("scriptInfo")) { scriptInfo = divElement.getAttribute("scriptInfo"); } this.mainModule = mainModule; }