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

Source Code of com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgIntermediateErrorEventComponent

/**
* Copyright 1996-2013 Founder International Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author kenshin
*/
package com.founder.fix.fixflow.core.impl.flowgraphics.svg.component;

import java.io.InputStream;

import org.dom4j.Document;
import org.dom4j.DocumentException;

import com.founder.fix.fixflow.core.exception.FixFlowException;
import com.founder.fix.fixflow.core.impl.flowgraphics.svg.FlowSvgUtil;
import com.founder.fix.fixflow.core.impl.flowgraphics.svg.SvgBench;
import com.founder.fix.fixflow.core.impl.flowgraphics.svg.to.SvgBaseTo;
import com.founder.fix.fixflow.core.impl.flowgraphics.svg.to.SvgIntermediateErrorEventTo;
import com.founder.fix.fixflow.core.impl.util.StringUtil;
import com.founder.fix.fixflow.core.impl.util.XmlUtil;

public class SvgIntermediateErrorEventComponent implements ISvgComponent {

  private static String comPath = "/svgcomponent/IntermediateErrorEvent.xml";
 
  public String createComponent(SvgBaseTo svgTo) {
    String result = null;
    try {
      SvgIntermediateErrorEventTo stevent = (SvgIntermediateErrorEventTo)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;
  }

}
TOP

Related Classes of com.founder.fix.fixflow.core.impl.flowgraphics.svg.component.SvgIntermediateErrorEventComponent

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.