Package org.w3c.dom

Examples of org.w3c.dom.NodeList


            propertyNode.removeAttribute(map.item(i).getNodeName());
          }
        }

        if (!propertyNode.getAttribute("name").equals("border")) {
          NodeList children = propertyNode.getChildNodes();
          int length = children.getLength();
          for (int i = 0; i < length; i++) {
            propertyNode.removeChild(children.item(0));
          }
        }

        getPropertyAdapter().toDOM(event.getNewValue(), propertyNode);
View Full Code Here


    WidgetInfo info = userObject.widget.getWidgetInfo();

    if (info != null) {
      ArrayList properties = new ArrayList();
      NodeList childNodes = userObject.element.getChildNodes();

      for (int i = 0; i < childNodes.getLength(); i++) {
        Node node = childNodes.item(i);

        if (node.getNodeType() == Node.ELEMENT_NODE) {
          if (node.getNodeName().equals("property")) {
            properties.add(((Element) node).getAttribute("name"));
          } else if (node.getNodeName().equals("anchor")) {
View Full Code Here

        ((Dialog) object.widget).dispose();
      }
    }

    rootNode.removeAllChildren();
    NodeList children = document.getDocumentElement().getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
      Node node = (Node) children.item(i);

      if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("widget")) {
        traverseDocument((Element) node, rootNode);
      }
    }
View Full Code Here

    Widget widget = constructWidget(parent.widget, classAttribute, nameAttribute, presetAttribute);
    WidgetUserObject object = new WidgetUserObject(xmlNode, widget, newNode);
    newNode.setUserObject(object);
    newNode.setText(describeWidget(xmlNode));

    NodeList childNodes = xmlNode.getChildNodes();

    object.tableModel.addRow(new NameTableRow(object));
    Element anchorNode = XMLUtils.getChild(xmlNode, "anchor");

    if (anchorNode != null) {
      object.tableModel.addRow(new PropertyTableRow(object, null, anchorNode));
    }

    for (int o = 0; o < childNodes.getLength(); o++) {
      if (childNodes.item(o).getNodeName().equals("property")) {
        Element propertyNode = (Element) childNodes.item(o);
        String propertyName = propertyNode.getAttribute("name");
        Object propertyValue = pf.constructProperty(propertyNode);
        object.tableModel.addRow(new PropertyTableRow(object, propertyValue, propertyNode));
        widget.setProperty(propertyName, propertyValue);
      } else if (childNodes.item(o).getNodeName().equals("layout")) {
        Element layoutNode = (Element) childNodes.item(o);
        Object propertyValue = lf.constructLayout(widget, layoutNode);
        object.tableModel.addRow(new PropertyTableRow(object, propertyValue, layoutNode));
        widget.setProperty("layout", propertyValue);
      } else if (childNodes.item(o).getNodeName().equals("emit")) {
        Element emitNode = (Element) childNodes.item(o);
        String name = emitNode.getAttribute("name");
        TableRow row = new TableRow();
        row.setValue("event", emitNode.getAttribute("event"));
        row.setValue("name", name);
        row.setValue(
          "description",
          widget.getWidgetInfo().getEventEntry(emitNode.getAttribute("event")).getDescription());
        row.setValue("node", emitNode);

        object.eventModel.addRow(row);
      }
    }

    for (int i = 0; i < childNodes.getLength(); i++) {
      if (childNodes.item(i).getNodeName().equals("widget")) {
        Element childNode = (Element) childNodes.item(i);

        /* Get the child's anchor subnode */
        anchorNode = XMLUtils.getChild(childNode, "anchor");
        Widget childWidget = traverseDocument(childNode, newNode);

View Full Code Here

      parentWidget.addChild((Widget) temp.get(i), anchor);
    }

    /* Update XML - This is horrible */
    Element parentElement = (Element) object.element.getParentNode();
    NodeList nodes = parentElement.getChildNodes();
 
    Element lastWidget = null, beforeWidget = null;
 
    int distance = -1;
    for (int i=0; i<nodes.getLength(); i++) {
      Node node = nodes.item(i);
      if (node == object.element) {
        if (up) {
          beforeWidget = lastWidget;
          break;
        } else {
View Full Code Here

  private void refreshInternationalProperties(TreeItem treeItem) throws GUIException {
    WidgetUserObject object = (WidgetUserObject) treeItem.getUserObject();

    if (object.element != null) {
      NodeList nodes = object.element.getChildNodes();
      for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.item(i);
        if (node instanceof Element && node.getNodeName().equals("property")) {
          Element propertyNode = (Element) node;
          String type = propertyNode.getAttribute("type");
          String name = propertyNode.getAttribute("name");
          if (type.equals("") || type.equals("istring")) {
View Full Code Here

    activateType(dataModel.getValue("type").toString());
  }

  protected void doOK() throws GUIException {
    NodeList children = borderNode.getChildNodes();
    int length = children.getLength();
    for (int i = 0; i < length; i++) {
      borderNode.removeChild(children.item(0));
    }

    String type = dataModel.getValue("type").toString();
    borderNode.setAttribute("border", type);
    Document document = borderNode.getOwnerDocument();
View Full Code Here

  /**
   * @return Vector with Image objects for this Block.
   */
  public Vector images() {
    Node oImagesNode = null;
    NodeList oNodeList;
    Vector oLinkVctr;

    for (oImagesNode=oNode.getFirstChild(); oImagesNode!=null; oImagesNode=oImagesNode.getNextSibling())
      if (Node.ELEMENT_NODE==oImagesNode.getNodeType())
        if (oImagesNode.getNodeName().equals("images")) break;

    oNodeList = ((Element) oImagesNode).getElementsByTagName("image");

    oLinkVctr = new Vector(oNodeList.getLength());

    for (int i=0; i<oNodeList.getLength(); i++)
      oLinkVctr.add(new Image(oNodeList.item(i)));

    return oLinkVctr;
  } // images()
View Full Code Here

  /**
   * @return Vector with Paragraph objects for this Block.
   */
  public Vector<Paragraph> paragraphs() {
    Node oParagraphsNode = null;
    NodeList oNodeList;
    Vector oLinkVctr;

    for (oParagraphsNode=oNode.getFirstChild(); oParagraphsNode!=null; oParagraphsNode=oParagraphsNode.getNextSibling())
      if (Node.ELEMENT_NODE==oParagraphsNode.getNodeType())
        if (oParagraphsNode.getNodeName().equals("paragraphs")) break;

    oNodeList = ((Element) oParagraphsNode).getElementsByTagName("paragraph");

    oLinkVctr = new Vector<Paragraph>(oNodeList.getLength());

    for (int i=0; i<oNodeList.getLength(); i++)
      oLinkVctr.add(new Paragraph(oNodeList.item(i)));

    return oLinkVctr;
  } // paragraphs()
View Full Code Here

            buf.append(">");
            out.write(buf.toString().getBytes());
            buf = new StringBuffer(50);
            buf1.append("</").append(name).append(">");
            if (hasChilds) {
               NodeList childs = node.getChildNodes();
               for (int i=0; i < childs.getLength(); i++) {
                  Node child = childs.item(i);
                  write(out, child, offset + "  ");
               }
               buf.append(off);
            }
            buf.append(buf1);
View Full Code Here

TOP

Related Classes of org.w3c.dom.NodeList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.