Examples of DOMRefPosition


Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

          }
          index++;
          child = next;
        }
        if (node.getPosOffsets()[0] <= 0) {
          setOperationPosition(new DOMRefPosition(first, false));
        } else {
          setOperationPosition(new DOMRefPosition(last, true));
        }
      } else {
        setOperationPosition(new DOMRefPosition(node.getNode(), false));
      }
      result = EditHelper.deleteNode(node.getNode());
    }
    return result;
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

    Node result = null;
    if (!isTableComponents(node)
        || !new IETablePositionRule(null).isInValidTable(node
            .getNode())) {
      // it's not table components.
      setOperationPosition(new DOMRefPosition(node.getNode(), false));
      result = EditHelper.deleteNode(node.getNode());
    }
    return result;

  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

          offsets[1] -= offsets[0] > 0 ? offsets[0] : 0;
        }
      } else {
        // setOperationPosition(new DOMRefPosition(currentNode, false));
        if (currentNode.getPreviousSibling() != null) {
          setOperationPosition(new DOMRefPosition(currentNode
              .getPreviousSibling(), true));
        } else {
          setOperationPosition(new DOMPosition(currentNode
              .getParentNode(), 0));
        }
      }
      // right index
      if (location2 >= EditHelper.IN_MIDDLE) {
        IDOMPosition position = new DOMPosition(currentNode, offsets[1]);
        position = DOMPositionHelper.splitText(position);
        second = position.getPreviousSiblingNode();
      }
      return second != null ? (Text) EditHelper.deleteNode(second) : null;
    }
        setOperationPosition(new DOMRefPosition(currentNode, false));
        return (Text) EditHelper.deleteNode(currentNode);
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

      position = EditHelper.splitNode(position);
      if (old == position) {
        int pos = EditHelper.getLocation(position);
        switch (pos) {
        case -1:
          position = new DOMRefPosition(position.getContainerNode(),
              false);
          break;
        case 1:
          position = new DOMRefPosition(position.getContainerNode(),
              true);
        }
      }
      Node containerBackup = container;
      container = container.getParentNode();
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

                ((Element) parentNode)
                    .getAttribute(IHTMLConstants.ATTR_ALIGN))) {
          ((Element) parentNode)
              .removeAttribute(IHTMLConstants.ATTR_ALIGN);
          IDOMPosition startPos = new DOMPosition(parentNode, 0);
          IDOMPosition endPos = new DOMRefPosition(endNode, true);
          return new DOMRange(startPos, endPos);
        }
        // else replace the align attribute
        /**
         * this._applyingNode.appendChild(startNode);
         * parentNode.getParentNode().replaceChild(this._applyingNode,
         * parentNode);
         */
        String align = this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN);
        ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN,
            align);

        IDOMPosition startPos = new DOMPosition(parentNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endNode, true);
        return new DOMRange(startPos, endPos);
      }
    } else {
      if (parentNode != null
          && parentNode.getNodeName().equalsIgnoreCase(
              IHTMLConstants.TAG_P)
          && parentNode.getChildNodes().getLength() == len) {
        if (this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN)
            .equals(
                ((Element) parentNode)
                    .getAttribute(IHTMLConstants.ATTR_ALIGN))) {
          ((Element) parentNode)
              .removeAttribute(IHTMLConstants.ATTR_ALIGN);
          IDOMPosition startPos = new DOMPosition(parentNode, 0);
          IDOMPosition endPos = new DOMRefPosition(endNode, true);
          return new DOMRange(startPos, endPos);
        }

        /**
         * Node sibling = startNode.getNextSibling();
         * this._applyingNode.appendChild(startNode); Node
         * endNodeSibling = endNode.getNextSibling(); while (sibling !=
         * null && startNode != endNode && sibling != endNodeSibling) {
         * Node tempNode = sibling.getNextSibling();
         * this._applyingNode.appendChild(sibling); sibling = tempNode; }
         * parentNode.getParentNode().replaceChild(this._applyingNode,
         * parentNode);
         */
        String align = this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN);
        ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN,
            align);

        IDOMPosition startPos = new DOMPosition(parentNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endNode, true);
        return new DOMRange(startPos, endPos);
      }
    }
    return null;
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

        if (startContainer instanceof Text) {
          // if the start offset is 0,then skip split the Text
          if (start.getOffset() > 0) {
            startContainer = ((Text) startContainer).splitText(start
                .getOffset());
            start = new DOMRefPosition(startContainer, false);
          }
        } else {
          startContainer = start.getNextSiblingNode();
        }
        if (endContainer instanceof Text) {
          if (end.getOffset() > 0) {
            endContainer = ((Text) endContainer).splitText(end
                .getOffset());
            endContainer = endContainer.getPreviousSibling();
          } else {
            endContainer = endContainer.getPreviousSibling();
          }
        } else {
          endContainer = end.getPreviousSiblingNode();
        }

        // now the startContainer and the endContainer should share the same
        // parent
        Element newNode = createStyleElement();
        startContainer.getParentNode()
            .insertBefore(newNode, startContainer);

        Node sibling = startContainer.getNextSibling();
        newNode.appendChild(startContainer);
        Node endNodeSibling = endContainer.getNextSibling();
        while (sibling != null && startContainer != endContainer
            && sibling != endNodeSibling) {
          Node tempNode = sibling.getNextSibling();
          newNode.appendChild(sibling);
          sibling = tempNode;
        }

        IDOMPosition startPos = new DOMPosition(newNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endContainer, true);
        return new DOMRange(startPos, endPos);
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

          } else {
            break;
          }
        }
        if (child != null) {
          return new DOMRefPosition(child, false);
        }
        return new DOMPosition(parent, parent.getChildNodes()
            .getLength());
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

        if (node == originalContainer) {
          if (nextSibling == null) {
            return new DOMRefPosition2(ele, true);
          } else if (nextSibling.getParentNode() == ele) {
            // next sibling is not in header part
            return new DOMRefPosition(nextSibling, false);
          } else {
            return new DOMPosition(ele, 0);
          }
        }
                return position;
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

              .getLocalName().equals(IJSFConstants.TAG_VIEW) || container
              .getLocalName().equalsIgnoreCase(
                  IHTMLConstants.TAG_HTML)))) {
        return container;
      }
      position = new DOMRefPosition(container, forward);
      sResult = findInlineSiblings(position, result, forward);
      container = container.getParentNode();
    }
    return sResult;
  }
View Full Code Here

Examples of org.eclipse.jst.pagedesigner.dom.DOMRefPosition

    IDOMPosition p1, p2;
    Node r1 = getParagraphNodes(position, tempResult, true);
    if (EditModelQuery.isChild(r1, position.getContainerNode())) {
      p1 = new DOMPosition(r1, r1.getChildNodes().getLength());
    } else {
      p1 = new DOMRefPosition(r1, false);
    }

    Node r2 = getParagraphNodes(position, tempResult, false);
    if (EditModelQuery.isChild(r2, position.getContainerNode())) {
      p2 = new DOMPosition(r2, 0);
    } else {
      p2 = new DOMRefPosition(r2, true);
    }
    return new Paragraph(p1, p2);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.