Package com.founder.fix.fixflow.core.impl.flowgraphics.svg.to

Examples of com.founder.fix.fixflow.core.impl.flowgraphics.svg.to.SvgLineTo


    String id = getBaseElement(bpmnEdge.getBpmnElement()).getId();
    String label = ((FlowElement) getBaseElement(bpmnEdge.getBpmnElement())).getName();
    // line.setLineType(LineType.ConditionalFlow);

    SvgLineTo line = new SvgLineTo();

    SequenceFlow sequenceFlow = (SequenceFlow) getBaseElement(bpmnEdge.getBpmnElement());

    line.setLineType(LineType.SequenceFlow);

    if (sequenceFlow.getConditionExpression() != null) {
      line.setLineType(LineType.ConditionalFlow);
    }

    if (sequenceFlow.getTargetRef() instanceof Activity) {
      Activity activity = (Activity) sequenceFlow.getTargetRef();
      if (activity.getDefault() != null && activity.getDefault().equals(sequenceFlow)) {
        line.setLineType(LineType.DefaultFlow);
      }
    }

    if (sequenceFlow.getTargetRef() instanceof Gateway) {
      if (sequenceFlow.getTargetRef() instanceof ComplexGateway) {
        ComplexGateway complexGateway = (ComplexGateway) sequenceFlow.getTargetRef();
        if (complexGateway.getDefault() != null && complexGateway.getDefault().equals(sequenceFlow)) {
          line.setLineType(LineType.DefaultFlow);
        }
        // ExclusiveGateway //InclusiveGateway
      }
      if (sequenceFlow.getTargetRef() instanceof ExclusiveGateway) {
        ExclusiveGateway exclusiveGateway = (ExclusiveGateway) sequenceFlow.getTargetRef();
        if (exclusiveGateway.getDefault() != null && exclusiveGateway.getDefault().equals(sequenceFlow)) {
          line.setLineType(LineType.DefaultFlow);
        }
        // ExclusiveGateway //InclusiveGateway
      }
      if (sequenceFlow.getTargetRef() instanceof InclusiveGateway) {
        InclusiveGateway inclusiveGateway = (InclusiveGateway) sequenceFlow.getTargetRef();
        if (inclusiveGateway.getDefault() != null && inclusiveGateway.getDefault().equals(sequenceFlow)) {
          line.setLineType(LineType.DefaultFlow);
        }
        // ExclusiveGateway //InclusiveGateway
      }
    }

    line.setId(id);
    line.setLabel(label);
    List<SvgPoint> svgPointList = new ArrayList<SvgPoint>();
    for (Point point : pointList) {
      SvgPoint svgPoint = line.new SvgPoint();
      svgPoint.setX(point.getX());
      svgPoint.setY(point.getY());
      svgPointList.add(svgPoint);
    }
    line.setSvgPointList(svgPointList);

    String lines = FlowSvgUtil.getSvgComponent(line);

    return lines;
  }
View Full Code Here


  private static String start_def = "{start_def}";
 
  public String createComponent(SvgBaseTo svgTo) {
    String result = null;
    try {
      SvgLineTo lineTo = (SvgLineTo)svgTo;
      InputStream in = SvgBench.class.getResourceAsStream(comPath);
      Document doc = XmlUtil.read(in);
      String str = doc.getRootElement().asXML();
      str = FlowSvgUtil.replaceAll(str, id, lineTo.getId());
      str = FlowSvgUtil.replaceAll(str, text, lineTo.getLabel());
      List<SvgPoint> pointList = lineTo.getSvgPointList();
      StringBuffer pointPath = new StringBuffer();
      String textx = null;
      String texty = null;
      String startconRef = none;
      String startdefRef = none;
     
      int size = pointList.size();
      for(int i=0;i<size;i++){
        if(i==0){
          pointPath.append("M");
        }else{
          pointPath.append("L");
        }

        SvgPoint point = pointList.get(i);
        float x = point.getX();
        float y = point.getY();
        x = x-2;
        y = y-2;
        pointPath.append(x);
        pointPath.append(" ");
        pointPath.append(y);
      }
     
      int textLength = lineTo.getLabel()==null?0:lineTo.getLabel().length();
      SvgPoint svgPoint = CaclModel.caclCenterPoint(lineTo);
      textx = StringUtil.getString(svgPoint.getX()-textLength*6.9/2);
      texty = StringUtil.getString(svgPoint.getY()-20);
     
//      if(size!=0 && size%2==0){
//        SvgPoint leftPoint = pointList.get(size/2-1);
//        SvgPoint rightPoint = pointList.get(size/2);
//        textx = String.valueOf((leftPoint.getX()+rightPoint.getX())/2);
//        texty = String.valueOf((leftPoint.getY()+rightPoint.getY())/2);
//      }else{
//        int position = size/2;
//        SvgPoint middlePoint = pointList.get(position);
//        textx = String.valueOf(middlePoint.getX());
//        texty = String.valueOf(middlePoint.getY());
//      }
     
      str = FlowSvgUtil.replaceAll(str, path, pointPath.toString());
      str = FlowSvgUtil.replaceAll(str, text_x, textx);
      str = FlowSvgUtil.replaceAll(str, text_y, texty);
     
      if(lineTo.getLineType().equals(LineType.DefaultFlow)){
        startdefRef = "";
      }else if(lineTo.getLineType().equals(LineType.ConditionalFlow)){
        startconRef = "";
      }
      str = FlowSvgUtil.replaceAll(str, start_con, startconRef);
      str = FlowSvgUtil.replaceAll(str, start_def, startdefRef);
     
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.flowgraphics.svg.to.SvgLineTo

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.