All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yaoqiang.bpmn.model.elements.bpmndi.BPMNEdge Maven / Gradle / Ivy

package org.yaoqiang.bpmn.model.elements.bpmndi;

import java.awt.Point;
import java.util.ArrayList;
import java.util.List;

import org.yaoqiang.bpmn.model.elements.XMLAttribute;
import org.yaoqiang.bpmn.model.elements.XMLCollection;
import org.yaoqiang.bpmn.model.elements.XMLComplexElement;
import org.yaoqiang.bpmn.model.elements.XMLElement;

/**
 * BPMNEdge
 * 
 * @author Shi Yaoqiang([email protected])
 */
public class BPMNEdge extends XMLComplexElement {

	private static final long serialVersionUID = 7326356879770991639L;

	public BPMNEdge(BPMNEdges parent) {
		super(parent);
	}

	protected void fillStructure() {
		XMLAttribute attrId = new XMLAttribute(this, "id");
		XMLAttribute attrBpmnElement = new XMLAttribute(this, "bpmnElement");
		XMLAttribute attrSourceElement = new XMLAttribute(this, "sourceElement");
		XMLAttribute attrTargetElement = new XMLAttribute(this, "targetElement");
		XMLAttribute attrMessageVisibleKind = new XMLAttribute(this, "messageVisibleKind");
		Waypoints refWaypoints = new Waypoints(this);
		BPMNLabel refBPMNLabel = new BPMNLabel(this);

		add(attrId);
		add(attrBpmnElement);
		add(attrSourceElement);
		add(attrTargetElement);
		add(attrMessageVisibleKind);
		add(refWaypoints);
		add(refBPMNLabel);

	}
	
	public BPMNEdges getParent() {
		return (BPMNEdges) parent;
	}
	
	public final String getId() {
		return get("id").toValue();
	}

	public final String getBpmnElement() {
		return get("bpmnElement").toValue();
	}

	public final String getSourceElement() {
		return get("sourceElement").toValue();
	}
	
	public final String getTargetElement() {
		return get("targetElement").toValue();
	}
	
	public final String getMessageVisibleKind() {
		return get("messageVisibleKind").toValue();
	}
	
	public List getWaypoints() {
		List waypoints = ((XMLCollection) get("Waypoints")).getXMLElements();
		Point point = null;
		List points = new ArrayList();
		for (XMLElement p : waypoints) {
			point = new Point();
			point.setLocation(((Waypoint) p).getX(), ((Waypoint) p).getY());
			points.add(point);
		}
		return points;
	}

	public final BPMNLabel getBPMNLabel() {
		return (BPMNLabel) get("BPMNLabel");
	}
	
	public final Bounds getLabelBounds() {
		return (Bounds)getBPMNLabel().get("Bounds");
	}
	
	public final void setBpmnElement(String bpmnElement) {
		set("bpmnElement", bpmnElement);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy