List of usage examples for org.dom4j Document getRootElement
Element getRootElement();
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgIntermediateTimerEventComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;// w w w .j a v a2 s. co m try { SvgIntermediateTimerEventTo stevent = (SvgIntermediateTimerEventTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(stevent.getX())); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(stevent.getY())); str = FlowSvgUtil.replaceAll(str, id, stevent.getId()); str = FlowSvgUtil.replaceAll(str, text, stevent.getLabel()); str = FlowSvgUtil.replaceAll(str, inherit, stevent.getInherit()); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgLaneComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;/*from w w w .j a v a2 s . c o m*/ try { SvgLaneTo lane = (SvgLaneTo) svgTo; if (lane.isHorizontal()) { comPath = "/svgcomponent/lane.xml"; } else { comPath = "/svgcomponent/lane_h.xml"; } InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(lane.getX())); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(lane.getY())); str = FlowSvgUtil.replaceAll(str, id, lane.getId()); str = FlowSvgUtil.replaceAll(str, text, lane.getLabel()); str = FlowSvgUtil.replaceAll(str, width, StringUtil.getString(lane.getWidth())); str = FlowSvgUtil.replaceAll(str, hight, StringUtil.getString(lane.getHeight())); if (lane.isHorizontal()) { str = FlowSvgUtil.replaceAll(str, text_y, StringUtil.getString(lane.getHeight() / 2)); } else { str = FlowSvgUtil.replaceAll(str, text_x, StringUtil.getString(lane.getWidth() / 2)); } result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgLineComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;//from w w w. ja va2s. com 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); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgMessageComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;// w w w .ja v a 2 s. c o m try { SvgMessageTo stevent = (SvgMessageTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(stevent.getX())); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(stevent.getY())); str = FlowSvgUtil.replaceAll(str, id, stevent.getId()); str = FlowSvgUtil.replaceAll(str, text, stevent.getLabel()); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgMessageFlowComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;//w w w . ja v a 2 s . c o m try { SvgMessageFlowTo lineTo = (SvgMessageFlowTo) 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); str = FlowSvgUtil.replaceAll(str, start_con, startconRef); str = FlowSvgUtil.replaceAll(str, start_def, startdefRef); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgParallelGatewayComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;/*from w w w .j a v a2s . com*/ try { SvgParallelGatewayTo pGateTo = (SvgParallelGatewayTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(pGateTo.getX() + 2)); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(pGateTo.getY() + 2)); str = FlowSvgUtil.replaceAll(str, id, pGateTo.getId()); str = FlowSvgUtil.replaceAll(str, text, pGateTo.getLabel()); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgStartComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;// w w w. j a v a 2 s.c o m try { SvgStartTo startTo = (SvgStartTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(startTo.getX())); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(startTo.getY())); str = FlowSvgUtil.replaceAll(str, id, startTo.getId()); str = FlowSvgUtil.replaceAll(str, text, startTo.getLabel()); // str = FlowSvgUtil.replaceAll(str, cricle, StringUtil.getString((startTo.getHeight()-5)/2)); // str = FlowSvgUtil.replaceAll(str, text_local, StringUtil.getString(startTo.getHeight()/2+14)); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgStartTimerEventComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;/*www . j av a 2 s. co m*/ try { SvgStartTimerEventTo stevent = (SvgStartTimerEventTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(stevent.getX())); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(stevent.getY())); str = FlowSvgUtil.replaceAll(str, id, stevent.getId()); str = FlowSvgUtil.replaceAll(str, text, stevent.getLabel()); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgSubProcessComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;/*from w w w .j a v a 2s .co m*/ try { int loopx = 260; int loopy = 281; SvgSubProcessTo signavio = (SvgSubProcessTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); String loopStd = none; String loopPar = none; String loopSeq = none; str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(signavio.getX() - 2)); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(signavio.getY() - 2)); str = FlowSvgUtil.replaceAll(str, id, signavio.getId()); str = FlowSvgUtil.replaceAll(str, text, signavio.getLabel()); str = FlowSvgUtil.replaceAll(str, text_x, StringUtil.getString(signavio.getWidth() / 2)); str = FlowSvgUtil.replaceAll(str, text_y, StringUtil.getString(signavio.getHeight() / 2)); str = FlowSvgUtil.replaceAll(str, width, StringUtil.getString(signavio.getWidth())); str = FlowSvgUtil.replaceAll(str, hight, StringUtil.getString(signavio.getHeight())); str = FlowSvgUtil.replaceAll(str, loop_x, StringUtil.getString(signavio.getWidth() / 2 - loopx)); str = FlowSvgUtil.replaceAll(str, loop_y, StringUtil.getString(signavio.getHeight() - 7 - loopy)); str = FlowSvgUtil.replaceAll(str, adhoc, none); str = FlowSvgUtil.replaceAll(str, callActivity, none); if (signavio.getLoopType().equals(LoopType.StandardLoop)) { loopStd = ""; } else if (signavio.getLoopType().equals(LoopType.MultiInstanceLoopParallel)) { loopPar = ""; } else if (signavio.getLoopType().equals(LoopType.MultiInstanceLoopSequential)) { loopSeq = ""; } str = FlowSvgUtil.replaceAll(str, loop_std, loopStd); str = FlowSvgUtil.replaceAll(str, loop_par, loopPar); str = FlowSvgUtil.replaceAll(str, loop_seq, loopSeq); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }
From source file:com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgTaskComponent.java
License:Apache License
public String createComponent(SvgBaseTo svgTo) { String result = null;//from ww w.ja v a 2s . co m try { SvgTaskTo taskTo = (SvgTaskTo) svgTo; InputStream in = SvgBench.class.getResourceAsStream(comPath); Document doc = XmlUtil.read(in); String str = doc.getRootElement().asXML(); String taskBus = none; String taskScr = none; String taskUsr = none; String taskSev = none; String taskMeu = none; String taskSed = none; String taskRec = none; String loopStd = none; String loopPar = none; String loopSeq = none; str = FlowSvgUtil.replaceAll(str, local_x, StringUtil.getString(taskTo.getX() - 2)); str = FlowSvgUtil.replaceAll(str, local_y, StringUtil.getString(taskTo.getY() - 2)); str = FlowSvgUtil.replaceAll(str, id, taskTo.getId()); str = FlowSvgUtil.replaceAll(str, text, taskTo.getLabel()); str = FlowSvgUtil.replaceAll(str, text_x, StringUtil.getString(taskTo.getWidth() / 2)); str = FlowSvgUtil.replaceAll(str, text_y, StringUtil.getString(taskTo.getHeight() / 2)); str = FlowSvgUtil.replaceAll(str, width, StringUtil.getString(taskTo.getWidth())); str = FlowSvgUtil.replaceAll(str, hight, StringUtil.getString(taskTo.getHeight())); str = FlowSvgUtil.replaceAll(str, loop_x, StringUtil.getString(taskTo.getWidth() / 2 - 48)); str = FlowSvgUtil.replaceAll(str, loop_y, StringUtil.getString(taskTo.getHeight() - 80)); if (taskTo.getTaskType().equals(TaskType.BusinessRuleTask)) { taskBus = ""; } else if (taskTo.getTaskType().equals(TaskType.ScriptTask)) { taskScr = ""; } else if (taskTo.getTaskType().equals(TaskType.UserTask)) { taskUsr = ""; } else if (taskTo.getTaskType().equals(TaskType.ServiceTask)) { taskSev = ""; } else if (taskTo.getTaskType().equals(TaskType.ManualTask)) { taskMeu = ""; } else if (taskTo.getTaskType().equals(TaskType.SendTask)) { taskSed = ""; } else if (taskTo.getTaskType().equals(TaskType.ReceiveTask)) { taskRec = ""; } if (taskTo.getLoopType().equals(LoopType.StandardLoop)) { loopStd = ""; } else if (taskTo.getLoopType().equals(LoopType.MultiInstanceLoopParallel)) { loopPar = ""; } else if (taskTo.getLoopType().equals(LoopType.MultiInstanceLoopSequential)) { loopSeq = ""; } str = FlowSvgUtil.replaceAll(str, task_bus, taskBus); str = FlowSvgUtil.replaceAll(str, task_scr, taskScr); str = FlowSvgUtil.replaceAll(str, task_usr, taskUsr); str = FlowSvgUtil.replaceAll(str, task_sev, taskSev); str = FlowSvgUtil.replaceAll(str, task_send, taskSed); str = FlowSvgUtil.replaceAll(str, task_manual, taskMeu); str = FlowSvgUtil.replaceAll(str, task_receive, taskRec); str = FlowSvgUtil.replaceAll(str, loop_std, loopStd); str = FlowSvgUtil.replaceAll(str, loop_par, loopPar); str = FlowSvgUtil.replaceAll(str, loop_seq, loopSeq); result = str; } catch (DocumentException e) { throw new FixFlowException("", e); } return result; }