@Override public void initializeClaimedElement() { if (renderable != null) { renderable.initializeClaimedElement(); } else { elementToWrap.getParentNode().replaceChild(widget.getElement(), elementToWrap); } }
private static Element getFirstAncestorWithListener(Event evt) { Element curElem = evt.getCurrentEventTarget().cast(); while (curElem != null && getEventListener(curElem) == null) { curElem = curElem.getParentNode().cast(); } return curElem; }
public void setCaption( FieldSetElement fieldset, Element legend, @IsSafeHtml String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
@Override public void onRemove(Object3D object) { if (element.getParentNode() != null) { element.getParentNode().removeChild(element); } } });
hiddenDiv.appendChild(element); wrapInitializationCallback.execute(); element.getParentNode().removeChild(element);
@Override public void initializeClaimedElement() { if (renderable != null) { renderable.initializeClaimedElement(); } else { elementToWrap.getParentNode().replaceChild(widget.getElement(), elementToWrap); } }
@Override public void initializeClaimedElement() { if (renderable != null) { renderable.initializeClaimedElement(); } else { elementToWrap.getParentNode().replaceChild(widget.getElement(), elementToWrap); } }
@PatchMethod static void replaceNode(UIObject uiObject, Element node, Element newNode) { Node parent = node.getParentNode(); if (parent != null) { parent.insertBefore(newNode, node); parent.removeChild(node); } }
@PatchMethod static void replaceNode(UIObject uiObject, Element node, Element newNode) { Node parent = node.getParentNode(); if (parent != null) { parent.insertBefore(newNode, node); parent.removeChild(node); } }
private static Element getFirstAncestorWithListener(Event evt) { Element curElem = evt.getCurrentEventTarget().cast(); while (curElem != null && getEventListener(curElem) == null) { curElem = curElem.getParentNode().cast(); } return curElem; }
private static Element getFirstAncestorWithListener(Event evt) { Element curElem = evt.getCurrentEventTarget().cast(); while (curElem != null && getEventListener(curElem) == null) { curElem = curElem.getParentNode().cast(); } return curElem; }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
private GQuery parentsUntil(Predicate predicate) { JsNodeArray result = JsNodeArray.create(); for (Element e : elements) { int i = 0; Node par = e.getParentNode(); while (par != null && par != document) { if (predicate.f(par, i)) { break; } result.addNode(par); par = par.getParentNode(); i++; } } return new GQuery(unique(result)).setPreviousObject(this); }
private void loadAnalyticsScript() { ScriptElement script = Document.get().createScriptElement(); script.setSrc(GoogleAnalyticsImpl.SCRIPT_URL); script.setType("text/javascript"); script.setAttribute("async", "true"); Element firstScript = Document.get().getElementsByTagName("script").getItem(0); firstScript.getParentNode().insertBefore(script, firstScript); }
private void checkAnchorPanel() { if (anchorPanel == null) { anchorPanel = new CustomFlowPanel(anchor); int anchorIdx = -1; Node parent = anchor.getParentNode(); if (parent != null && parent == getElement()) { for (int i = 0; i < parent.getChildCount(); i++) { if (parent.getChild(i) == anchor) { anchorIdx = i; break; } } } if (anchorIdx >= 0) insert(anchorPanel, anchorIdx); else add(anchorPanel); } if (controlGroupRoot != null && controlGroupRoot.getParent() != anchorPanel) { anchorPanel.add(controlGroupRoot); } }
private void checkAnchorPanel() { if (anchorPanel == null) { anchorPanel = new CustomFlowPanel(anchor); int anchorIdx = -1; Node parent = anchor.getParentNode(); if (parent != null && parent == getElement()) { for (int i = 0; i < parent.getChildCount(); i++) { if (parent.getChild(i) == anchor) { anchorIdx = i; break; } } } if (anchorIdx >= 0) insert(anchorPanel, anchorIdx); else add(anchorPanel); } if (controlGroupRoot != null && controlGroupRoot.getParent() != anchorPanel) { anchorPanel.add(controlGroupRoot); } }
private void checkAnchorPanel() { if (anchorPanel == null) { anchorPanel = new CustomFlowPanel(anchor); int anchorIdx = -1; Node parent = anchor.getParentNode(); if (parent != null && parent == getElement()) { for (int i = 0; i < parent.getChildCount(); i++) { if (parent.getChild(i) == anchor) { anchorIdx = i; break; } } } if (anchorIdx >= 0) insert(anchorPanel, anchorIdx); else add(anchorPanel); } if (controlGroupRoot != null && controlGroupRoot.getParent() != anchorPanel) { anchorPanel.add(controlGroupRoot); } }
@PatchMethod static Element getNextSiblingElement(Object domImpl, Element elem) { Node parent = elem.getParentNode(); if (parent == null) { return null; } NodeList<Node> list = parent.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node current = list.getItem(i); if (current.equals(elem) && i < list.getLength() - 1) { while (i < list.getLength() - 1) { i++; if (list.getItem(i).getNodeType() == Node.ELEMENT_NODE) { return list.getItem(i).cast(); } } } } return null; }
@PatchMethod static Element getNextSiblingElement(Object domImpl, Element elem) { Node parent = elem.getParentNode(); if (parent == null) { return null; } NodeList<Node> list = parent.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node current = list.getItem(i); if (current.equals(elem) && i < list.getLength() - 1) { while (i < list.getLength() - 1) { i++; if (list.getItem(i).getNodeType() == Node.ELEMENT_NODE) { return list.getItem(i).cast(); } } } } return null; }