List of usage examples for com.google.gwt.dom.client Node removeFromParent
@Override
public void removeFromParent()
From source file:client.net.sf.saxon.ce.dom.HTMLWriter.java
License:Mozilla Public License
/** * Start of an element./*from w ww . j av a 2s . c om*/ */ public void startElement(int nameCode, int properties) throws XPathException { String localName = namePool.getLocalName(nameCode); String prefix = namePool.getPrefix(nameCode); String uri = namePool.getURI(nameCode); // TODO: For XML Writer it should write prefixes in a // way compliant with the XSLT2.0 specification - using xsl:output attributes Element element = null; if (uri != null && !uri.isEmpty()) { if (mode == WriteMode.XML && !prefix.equals("")) { element = createElementNS(document, uri, prefix + ":" + localName); } else { // no svg specific prefix now used, for compliance with HTML5 element = createElementNS(document, uri, localName); } } // if there's no namespace - or no namespace support if (element == null) { element = document.createElement(localName); } // special case for html element: write to the document node Controller controller = pipe.getController(); if (controller != null && controller.getApiCommand() == APIcommand.UPDATE_HTML && (localName.equals("html") || localName.equals("head") || localName.equals("body"))) { if (localName.equals("html")) { element = (Element) document.getFirstChild(); } else { element = (Element) document.getElementsByTagName(localName.toUpperCase()).getItem(0); NodeList<Node> nodes = element.getChildNodes(); for (int n = 0; n < nodes.getLength(); n++) { Node node = nodes.getItem(n); node.removeFromParent(); } } currentNode = element; level++; return; } if (nextSibling != null && level == 0) { currentNode.insertBefore(element, nextSibling); } else { try { currentNode.appendChild(element); } catch (JavaScriptException err) { if (uri.equals(NamespaceConstant.IXSL)) { XPathException xpe = new XPathException( "Error on adding IXSL element to the DOM, the IXSL namespace should be added to the 'extension-element-prefixes' list."); throw (xpe); } else { throw (new XPathException(err.getMessage())); } } catch (Exception exc) { XPathException xpe = new XPathException( "Error on startElement in HTMLWriter for element '" + localName + "': " + exc.getMessage()); throw (xpe); } } currentNode = element; level++; }
From source file:com.bearsoft.gwt.ui.XElement.java
/** * Removes a mask over this element to disable user interaction. * //from w w w .j a v a 2s . com */ public final void unmask() { NodeList<Node> nl = getChildNodes(); for (int i = nl.getLength() - 1; i >= 0; i--) { Node n = nl.getItem(i); if (Element.is(n) && Element.as(n).getClassName() != null && Element.as(n).hasClassName("p-mask")) { n.removeFromParent(); } } }
From source file:com.mashery.examples.api.client.weatherbug.WeatherBugOverlayView.java
License:Open Source License
@Override public void onAdd() { Document doc = Document.get(); DivElement div = doc.createDivElement(); div.getStyle().setBorderStyle(BorderStyle.NONE); div.getStyle().setBorderWidth(0d, Unit.PX); div.getStyle().setPosition(Position.ABSOLUTE); div.getStyle().setOpacity(0.4d);// w ww. j a v a 2s . c o m this.div = div; getPanes().getOverlayLayer().appendChild(div); boundsChangedListener = Event.addListener(getMap(), "bounds_changed", new EventCallback() { @Override public void callback() { WeatherBugOverlayView.this.draw(); } }); zoomChangedListener = Event.addListener(getMap(), "zoom_changed", new EventCallback() { @Override public void callback() { for (Node child = WeatherBugOverlayView.this.div.getFirstChild(); child != null;) { Node node = child; child = child.getNextSibling(); node.removeFromParent(); } tiles.clear(); } }); }
From source file:org.eclipse.che.ide.console.OutputConsoleViewImpl.java
License:Open Source License
@Override public void print(final String text, boolean carriageReturn, String color) { if (this.carriageReturn) { Node lastChild = consoleLines.getElement().getLastChild(); if (lastChild != null) { lastChild.removeFromParent(); }//w w w .j a v a 2 s .c o m } this.carriageReturn = carriageReturn; final SafeHtml colorOutput = new SafeHtml() { @Override public String asString() { if (Strings.isNullOrEmpty(text)) { return " "; } String encoded = SafeHtmlUtils.htmlEscape(text); if (delegate != null) { if (delegate.getCustomizer() != null) { if (delegate.getCustomizer().canCustomize(encoded)) { encoded = delegate.getCustomizer().customize(encoded); } } } for (final Pair<RegExp, String> pair : output2Color) { final MatchResult matcher = pair.first.exec(encoded); if (matcher != null) { return encoded.replaceAll(matcher.getGroup(1), "<span style=\"color: " + pair.second + "\">" + matcher.getGroup(1) + "</span>"); } } return encoded; } }; PreElement pre = DOM.createElement("pre").cast(); pre.setInnerSafeHtml(colorOutput); if (color != null) { pre.getStyle().setColor(color); } consoleLines.getElement().appendChild(pre); followOutput(); }
From source file:org.eclipse.che.ide.extension.machine.client.outputspanel.console.OutputConsoleViewImpl.java
License:Open Source License
@Override public void print(String text, boolean cr) { if (carriageReturn) { Node lastChild = consoleLines.getElement().getLastChild(); if (lastChild != null) { lastChild.removeFromParent(); }//from w w w . jav a2 s . com } carriageReturn = cr; PreElement pre = DOM.createElement("pre").cast(); pre.setInnerText(text.isEmpty() ? " " : text); consoleLines.getElement().appendChild(pre); followOutput(); }
From source file:org.freemedsoftware.gwt.client.screen.ClaimsManager.java
License:Open Source License
public void addExistingSearchCriteria(String k, String name, String value) { Label lbName = new Label(name); lbName.setStyleName(AppConstants.STYLE_LABEL_LARGE_BOLD); Label lbVal = new Label(value); final String key = k; final CustomButton remove = new CustomButton("X"); remove.addClickHandler(new ClickHandler() { @Override// w ww .ja va 2 s. com public void onClick(ClickEvent event) { Node tempNode = remove.getElement(); while (!tempNode.getNodeName().equals("TR")) { tempNode = tempNode.getParentNode(); } tempNode.removeFromParent(); if (key.equals("facility")) { lblFacility.setVisible(true); facilityWidget.clear(); facilityWidget.setVisible(true); } if (key.equals("provider")) { lblProvider.setVisible(true); provWidget.clear(); provWidget.setVisible(true); } if (key.equals("plan")) { lblPlanName.setVisible(true); planWidget.clear(); planWidget.setVisible(true); } if (key.equals("payer")) { lblPayer.setVisible(true); payerWidget.clear(); payerWidget.setVisible(true); } if (key.equals("first_name")) { lblName.setVisible(true); txtFirstName.setText(""); txtFirstName.setVisible(true); } if (key.equals("last_name")) { lblName.setVisible(true); txtLastName.setText(""); txtLastName.setVisible(true); } if (key.equals("patient")) { lbPatientWidget.setVisible(true); patientWidget.clear(); patientWidget.setVisible(true); } if (key.equals("aging")) { panelAging.setVisible(true); lblAging.setVisible(true); rb120Plus.setVisible(true); rb120Plus.setValue(false); rb91To120.setVisible(true); rb91To120.setValue(false); rb61To90.setVisible(true); rb61To90.setValue(false); rb31To60.setVisible(true); rb31To60.setValue(false); rb0To30.setVisible(true); rb0To30.setValue(false); rbNoSearch.setVisible(true); rbNoSearch.setValue(false); } if (key.equals("billed")) { statusHp.setVisible(true); lblBillingStatus.setVisible(true); rbQueued.setVisible(true); rbQueued.setValue(false); rbBilled.setVisible(true); rbBilled.setValue(false); } if (key.equals("date")) { dateBox.getTextBox().setText(""); lblDateOfService.setVisible(true); dateBox.setVisible(true); } if (key.equals("zerobalance")) { cbShowZeroBalance.setValue(false); cbShowZeroBalance.setVisible(true); } if (key.equals("week")) { cbWholeWeek.setValue(false); cbWholeWeek.setVisible(true); } if (key.equals("tag")) { tagWidget.setVisible(true); lbTagSearch.setVisible(true); tagWidget.clear(); } // parentTR = tempNode; // parentTableBody.removeChild(parentTR); refreshSearch(); } }); int rc = existingCriteriaTable.getRowCount(); existingCriteriaTable.setWidget(rc, 0, lbName); existingCriteriaTable.setWidget(rc, 1, lbVal); existingCriteriaTable.setWidget(rc, 2, remove); }
From source file:org.openelis.ui.widget.tree.Tree.java
License:Open Source License
/** * Method will remove the passed node form the tree model and refresh the * view.// w w w. j a v a2 s .com * * @param node */ public void removeNode(Node node) { if (!isDisplayed(node)) { if (fireBeforeRowDeletedEvent(-1, node)) { node.removeFromParent(); } fireRowDeletedEvent(-1, node); } else { removeNodeAt(nodeIndex.get(node).index); } }
From source file:org.rstudio.core.client.dom.DomUtils.java
License:Open Source License
private static int trimLines(NodeList<Node> nodes, final int linesToTrim) { if (nodes == null || nodes.getLength() == 0 || linesToTrim == 0) return 0; int linesLeft = linesToTrim; Node node = nodes.getItem(0); while (node != null && linesLeft > 0) { switch (node.getNodeType()) { case Node.ELEMENT_NODE: if (((Element) node).getTagName().equalsIgnoreCase("br")) { linesLeft--;//www .j av a 2 s.com node = removeAndGetNext(node); continue; } else { int trimmed = trimLines(node.getChildNodes(), linesLeft); linesLeft -= trimmed; if (!node.hasChildNodes()) node = removeAndGetNext(node); continue; } case Node.TEXT_NODE: String text = ((Text) node).getData(); Match lastMatch = null; Match match = NEWLINE.match(text, 0); while (match != null && linesLeft > 0) { lastMatch = match; linesLeft--; match = match.nextMatch(); } if (linesLeft > 0 || lastMatch == null) { node = removeAndGetNext(node); continue; } else { int index = lastMatch.getIndex() + 1; if (text.length() == index) node.removeFromParent(); else ((Text) node).deleteData(0, index); break; } } } return linesToTrim - linesLeft; }
From source file:org.rstudio.core.client.dom.DomUtils.java
License:Open Source License
private static Node removeAndGetNext(Node node) { Node next = node.getNextSibling(); node.removeFromParent(); return next;//from w w w . j a va 2s . com }
From source file:org.uberfire.ext.security.management.client.screens.home.EntitiesManagementHomeView.java
License:Apache License
private void removeChildrenElements(final Element element) { checkNotNull("element", element); final int c = element.getChildCount(); for (int x = 0; x < c; x++) { final Node e = element.getChild(x); e.removeFromParent(); }//from w w w . j a v a 2 s.co m }