Package org.w3c.dom

Examples of org.w3c.dom.Element


        return coords;
    }

    public Element getSVGString(SVGDocument doc) {

        Element group1 = null;
        group1 = doc.createElementNS("http://www.w3.org/2000/svg", "g");
        group1.setAttributeNS(null, "id", getLayerId());
        if (isAddOpacity()) {
            group1.setAttributeNS(null, "style", "opacity:" + getOpacity());
        }
        group1.appendChild(getBoxDefinition(doc));
        group1.appendChild(getImageDefinition(doc));
        //Get sub activities
        group1.appendChild(getSubActivitiesSVGString(doc));
        group1.appendChild(getArrows(doc));

        return group1;
    }
View Full Code Here


        return group;
    }

    protected Element getArrows(SVGDocument doc) {
        if (subActivities != null) {
            Element subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");
            org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface prevActivity = null;
            org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface activity = null;
            String id = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myExitCoords = getEndIconEntryArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartEventCoords = getStartEventCoords();
            SVGCoordinates myStartTerminationCoords = getStartTerminationCoords();
            SVGCoordinates myStartCompensationCoords = getStartCompensationCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartFaultCoords = getStartFaultCoords();
            SVGCoordinates activityEntryCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates activityExitCoords = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                activityEntryCoords = activity.getEntryArrowCoords();
                activityExitCoords = activity.getExitArrowCoords();
                id = getId() + "-" + activity.getId();
                if (activity instanceof FaultHandlerImpl) {
                    subGroup.appendChild(getArrowDefinition(doc, myStartFaultCoords.getXLeft(),
                        myStartFaultCoords.getYTop(), activityEntryCoords.getXLeft(),
                        activityEntryCoords.getYTop(), id, activity, activity));
                } else if (activity instanceof TerminationHandlerImpl) {
                    subGroup.appendChild(getArrowDefinition(doc, myStartTerminationCoords.getXLeft(),
                        myStartTerminationCoords.getYTop(), activityEntryCoords.getXLeft(),
                        activityEntryCoords.getYTop(), id, activity, activity));
                } else if (activity instanceof CompensationHandlerImpl) {
                    subGroup.appendChild(getArrowDefinition(doc, myStartCompensationCoords.getXLeft(),
                        myStartCompensationCoords.getYTop(), activityEntryCoords.getXLeft(),
                        activityEntryCoords.getYTop(), id, activity, activity));
                } else if (activity instanceof EventHandlerImpl) {
                    subGroup.appendChild(getArrowDefinition(doc, myStartEventCoords.getXLeft(),
                        myStartEventCoords.getYTop(), activityEntryCoords.getXLeft(),
                        activityEntryCoords.getYTop(), id, activity, activity));
                } else {
                    subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(),
                        myStartCoords.getYTop(), activityEntryCoords.getXLeft(),
                        activityEntryCoords.getYTop(), id, activity, activity));
                    subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                        activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                        myExitCoords.getYTop(), id, activity, activity));
                }
                prevActivity = activity;
            }
View Full Code Here

    }

    @Override

    public Element getSVGString(SVGDocument doc) {
        Element group = null;
        group = doc.createElementNS("http://www.w3.org/2000/svg", "g");
        group.setAttributeNS(null, "id", getLayerId());
        if (isAddOpacity()) {
          double op=getOpacity();
         
            group.setAttributeNS(null, "style", "opacity:" + getOpacity());
            group.setAttributeNS(null, "onmouseover", "this.style.opacity=1;this.filters.alpha.opacity=100");
            group.setAttributeNS(null, "onmouseout", "this.style.opacity=" + op + ";this.filters.alpha.opacity=40");
            group.setAttributeNS("xlink", "title", getActivityInfoString());
        }

        // Add border on failed state, to show the red boundary indicating an error has occurred
        if (getState() == ActivityState.Failed) {
          group.appendChild(getBoxDefinition(doc));
        }
       
        group.appendChild(getImageDefinition(doc));
        group.appendChild(getStartImageText(doc));

        return group;
    }
View Full Code Here

            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartElseCoords = getStartIconElseArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates activityEntryCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates activityExitCoords = null;
            Iterator<ActivityInterface> itr = subActivities.iterator();
            Element subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");
            while (itr.hasNext()) {
                activity = itr.next();
                activityEntryCoords = activity.getEntryArrowCoords();
                activityExitCoords = activity.getExitArrowCoords();

                if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
                    if (prevActivity != null && prevActivity instanceof ElseIfImpl) {
                        exitCoords = ((ElseIfInterface) prevActivity).getNextElseExitArrowCoords();
//                        activityEntryCoords = activity.getEntryArrowCoords();
                        id = prevActivity.getId() + "-" + activity.getId();

                        subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                            exitCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                        subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                            activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                            myExitCoords.getYTop(), id, prevActivity, activity));

                    } else {
//                        activityEntryCoords = activity.getEntryArrowCoords();
                        subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(),
                            myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                        subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                            activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                            myExitCoords.getYTop(), id, prevActivity, activity));

                    }
                } else {
                    if (prevActivity != null) {
                        exitCoords = prevActivity.getExitArrowCoords();
//                        activityEntryCoords = activity.getEntryArrowCoords();
//                        activityExitCoords = activity.getExitArrowCoords();
                        id = prevActivity.getId() + "-" + activity.getId();
                        subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                            exitCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                    } else {
//                        activityEntryCoords = activity.getEntryArrowCoords();
                        subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(),
                            myStartCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, this, activity));
                        subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                            activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                            myExitCoords.getYTop(), id, this, activity));

                    }
                }
View Full Code Here

   *
   * @param o the object that is serialized into XML
   * @throws Exception if post-processing fails
   */
  protected void writePostProcess(Object o) throws Exception {
    Element         root;
    NodeList        list;
    Element         conns;
    Element         child;
    int             i;

    // since not all BeanConnections get saved to XML (e.g., MetaBeans in the
    // UserToolBar) if one saves a layout, the numbering in the Vector of the
    // BeanConnections is not correct. The "name" attribute of the nodes has
    // to be modified
    if (getDataType() == DATATYPE_LAYOUT) {
      root  = m_Document.getDocument().getDocumentElement();
      conns = (Element) root.getChildNodes().item(INDEX_BEANCONNECTIONS);
      list  = conns.getChildNodes();
      for (i = 0; i < list.getLength(); i++) {
        child = (Element) list.item(i);
        child.setAttribute(ATT_NAME, "" + i);
      }
    }
  }
View Full Code Here

   * @see #m_BeanInstances
   */
  protected Document readPreProcess(Document document) throws Exception {
    NodeList        list;
    int             i;
    Element         node;
    String          clsName;
    Vector          children;
    int             id;
    int             n;
    Element         child;
   
    m_BeanInstances   = new Vector();
    m_BeanInstancesID = new Vector();
   
    // get all BeanInstance nodes
    list    = document.getElementsByTagName("*");
    clsName = BeanInstance.class.getName();
    for (i = 0; i < list.getLength(); i++) {
      node = (Element) list.item(i);
     
      // is it a BeanInstance?
      if (node.getAttribute(ATT_CLASS).equals(clsName)) {
        children = XMLDocument.getChildTags(node);
        id       = m_BeanInstancesID.size();
       
        // get id-tag (if available)
        for (n = 0; n < children.size(); n++) {
          child = (Element) children.get(n);
          if (child.getAttribute(ATT_NAME).equals(VAL_ID))
            id = readIntFromXML((Element) child);
        }
       
        m_BeanInstancesID.add(new Integer(id));
      }
View Full Code Here

   * @throws Exception if the DOM creation fails
   */
  public Element writeColor(Element parent, Object o, String name)
    throws Exception {
   
    Element     node;
    Color       color;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), name);
View Full Code Here

   * @throws Exception if instantiation fails
   */
  public Object readColor(Element node) throws Exception {
    Object      result;
    Vector      children;
    Element     child;
    int         i;
    int         red;
    int         green;
    int         blue;
    String      name;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), node.getAttribute(ATT_NAME));

    m_CurrentNode = node;
   
    result   = null;
    children = XMLDocument.getChildTags(node);
    red      = 0;
    green    = 0;
    blue     = 0;

    for (i = 0; i < children.size(); i++) {
      child = (Element) children.get(i);
      name  = child.getAttribute(ATT_NAME);

      if (name.equals(VAL_RED))
        red = readIntFromXML(child);
      else if (name.equals(VAL_GREEN))
        green = readIntFromXML(child);
View Full Code Here

   * @throws Exception if the DOM creation fails
   */
  public Element writeDimension(Element parent, Object o, String name)
      throws Exception {
   
    Element     node;
    Dimension   dim;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), name);
View Full Code Here

   * @throws Exception if instantiation fails
   */
  public Object readDimension(Element node) throws Exception {
    Object      result;
    Vector      children;
    Element     child;
    int         i;
    double      width;
    double      height;
    String      name;

    // for debugging only
    if (DEBUG)
       trace(new Throwable(), node.getAttribute(ATT_NAME));

    m_CurrentNode = node;
   
    result   = null;
    children = XMLDocument.getChildTags(node);
    width    = 0;
    height   = 0;

    for (i = 0; i < children.size(); i++) {
      child = (Element) children.get(i);
      name  = child.getAttribute(ATT_NAME);

      if (name.equals(VAL_WIDTH))
        width = readDoubleFromXML(child);
      else if (name.equals(VAL_HEIGHT))
        height = readDoubleFromXML(child);
View Full Code Here

TOP

Related Classes of org.w3c.dom.Element

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.