use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ScopeImpl method layoutVertical.
/**
* Sets the x and y positions of the activities
* At the start: startXLeft=0, startYTop=0
* centreOfMyLayout- center of the the SVG
*
* @param startXLeft x-coordinate
* @param startYTop y-coordinate
*/
public void layoutVertical(int startXLeft, int startYTop) {
// Aligns the activities to the center of the layout
int centreOfMyLayout = startXLeft + (getDimensions().getWidth() / 2);
int xLeft = 0;
int yTop = 0;
int endXLeft = 0;
int endYTop = 0;
int centerNHLayout = startXLeft + (getCoreDimensions().getWidth() / 2);
// Set the dimensions
getDimensions().setXLeft(startXLeft);
getDimensions().setYTop(startYTop);
// Set the xLeft and yTop of the core dimensions
getCoreDimensions().setXLeft(startXLeft + (getXSpacing() / 2));
getCoreDimensions().setYTop(startYTop + (getYSpacing() / 2));
/* Checks whether its a simple layout i.e. whether the subActivities are any handlers
if so --> true , else --> false
*/
if (isSimpleLayout()) {
// Positioning the startIcon
xLeft = centreOfMyLayout - (getStartIconWidth() / 2);
yTop = startYTop + (getYSpacing() / 2);
// Positioning the endIcon
endXLeft = centreOfMyLayout - (getEndIconWidth() / 2);
endYTop = startYTop + getDimensions().getHeight() - getEndIconHeight() - (getYSpacing() / 2);
} else {
// Positioning the startIcon
xLeft = centerNHLayout - (getStartIconWidth() / 2) + (getXSpacing() / 2);
yTop = getCoreDimensions().getYTop() + (getYSpacing() / 2);
// Positioning the endIcon
endXLeft = centerNHLayout - (getEndIconWidth() / 2) + (getXSpacing() / 2);
endYTop = getCoreDimensions().getYTop() + getCoreDimensions().getHeight() - getEndIconHeight() - (getYSpacing() / 2);
}
ActivityInterface activity = null;
Iterator<ActivityInterface> itr = getSubActivities().iterator();
int childYTop = 0;
int childXLeft = 0;
/* Checks whether its a simple layout i.e. whether the subActivities are any handlers
if so --> true , else --> false
*/
if (isSimpleLayout()) {
// Adjusting the childXLeft and childYTop positions
childYTop = yTop + getStartIconHeight() + (getYSpacing() / 2);
childXLeft = startXLeft + (getXSpacing() / 2);
} else {
// Adjusting the childXLeft and childYTop positions
childYTop = getCoreDimensions().getYTop() + getStartIconHeight() + (getYSpacing() / 2);
childXLeft = getCoreDimensions().getXLeft() + (getXSpacing() / 2);
}
// Iterates through the subActivities
while (itr.hasNext()) {
activity = itr.next();
// Checks whether the activity is of any handler type
if (activity instanceof FaultHandlerImpl || activity instanceof TerminationHandlerImpl || activity instanceof CompensationHandlerImpl || activity instanceof EventHandlerImpl) {
} else if (activity instanceof RepeatUntilImpl || activity instanceof ForEachImpl || activity instanceof WhileImpl || activity instanceof IfImpl) {
/* If the activity inside Scope activity is an instance of ForEach, Repeat Until, While or If activity,
then increase the yTop position of start icon of those activities , as the start icon is placed
on the scope/box which contains the subActivities.This requires more spacing, so the yTop of the
activity following it i.e. the activity after it is also increased.
*/
int x = childYTop + (getYSpacing() / 2);
// Sets the xLeft and yTop position of the iterated activity
activity.layout(childXLeft, x);
// Calculate the yTop position of the next activity
childXLeft += activity.getDimensions().getWidth();
} else {
// Sets the xLeft and yTop position of the iterated activity
activity.layout(childXLeft, childYTop);
// Calculate the yTop position of the next activity
childXLeft += activity.getDimensions().getWidth();
}
}
// Process Handlers
itr = getSubActivities().iterator();
// Adjusting the childXLeft and childYTop positions
childXLeft = startXLeft + getCoreDimensions().getWidth();
childYTop = yTop + getHandlerAdjustment();
// Iterates through the subActivities
while (itr.hasNext()) {
activity = itr.next();
// Checks whether the activity is of any handler type
if (activity instanceof FaultHandlerImpl || activity instanceof TerminationHandlerImpl || activity instanceof CompensationHandlerImpl || activity instanceof EventHandlerImpl) {
// Sets the xLeft and yTop position of the iterated activity
activity.layout(childXLeft, childYTop);
childXLeft += activity.getDimensions().getWidth();
}
}
// Sets the xLeft and yTop positions of the start icon
setStartIconXLeft(xLeft);
setStartIconYTop(yTop);
// Sets the xLeft and yTop positions of the end icon
setEndIconXLeft(endXLeft);
setEndIconYTop(endYTop);
// Sets the xLeft and yTop positions of the start icon text
setStartIconTextXLeft(startXLeft + BOX_MARGIN);
setStartIconTextYTop(startYTop + BOX_MARGIN + BPEL2SVGFactory.TEXT_ADJUST);
}
use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ProcessImpl method getLinkArrows.
/**
* Gets the Link arrow coordinates when there is a FLOW activity in the process
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the process
* @return An element which contains the link arrow coordinates of the Process
*/
private Element getLinkArrows(SVGDocument doc) {
Element group = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
// Checks whether the any links exist
if (links != null && !links.isEmpty()) {
// Returns a collection-view of the map with the link names, sources(starting activity) and the target
// (ending activity)
Set linksSet = links.entrySet();
Iterator linksIterator = linksSet.iterator();
// Iterates through the links
while (linksIterator.hasNext()) {
Map.Entry<String, Link> link = (Map.Entry<String, Link>) linksIterator.next();
// Gets the source/start activity of the link
ActivityInterface startActivity = link.getValue().getSource();
// Gets the target/end activity of the link
ActivityInterface endActivity = link.getValue().getTarget();
// Get the link name
String linkName = link.getKey();
// Check if the source and the target of the link contains a value
if (endActivity != null && startActivity != null) {
// Define the link flow/path by giving the coordinates of the start and end activity
group.appendChild(drawLink(doc, startActivity.getExitArrowCoords().getXLeft(), startActivity.getExitArrowCoords().getYTop(), endActivity.getEntryArrowCoords().getXLeft(), endActivity.getEntryArrowCoords().getYTop(), startActivity.getStartIconWidth(), link.getKey(), linkName));
}
}
}
return group;
}
use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ProcessImpl method getExitArrowCoords.
/**
* At the start: xLeft= xLeft of startIcon + (width of startIcon)/2, yTop= yTop of startIcon + height of startIcon
* Calculates the coordinates of the arrow which leaves an activity
*
* @return coordinates/exit point of the exit arrow for the activities
*/
@Override
public SVGCoordinates getExitArrowCoords() {
int xLeft = getStartIconXLeft() + (getStartIconWidth() / 2);
int yTop = getStartIconYTop() + getStartIconHeight();
if (!layoutManager.isVerticalLayout()) {
xLeft = getStartIconXLeft() + getStartIconWidth();
yTop = getStartIconYTop() + (getStartIconHeight() / 2);
}
// Returns the calculated coordinate points of the exit arrow
SVGCoordinates coords = new SVGCoordinates(xLeft, yTop);
return coords;
}
use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ProcessImpl method layoutVertical.
/**
* Sets the x and y positions of the activities
* At the start: startXLeft=0, startYTop=0
* centreOfMyLayout- center of the the SVG
*
* @param startXLeft x-coordinate
* @param startYTop y-coordinate
*/
public void layoutVertical(int startXLeft, int startYTop) {
// Aligns the activities to the center of the layout
int centreOfMyLayout = startXLeft + (dimensions.getWidth() / 2);
// Positioning the startIcon
int xLeft = centreOfMyLayout - (getStartIconWidth() / 2);
int yTop = startYTop + (getYSpacing() / 2);
// Positioning the endIcon
int endXLeft = centreOfMyLayout - (getEndIconWidth() / 2);
int endYTop = startYTop + dimensions.getHeight() - getEndIconHeight() - (getYSpacing() / 2);
ActivityInterface activity = null;
Iterator<ActivityInterface> itr = getSubActivities().iterator();
// Adjusting the childXLeft and childYTop positions
int childYTop = yTop + getStartIconHeight() + (getYSpacing() / 2);
int childXLeft = startXLeft + (getXSpacing() / 2);
// Iterate through the subActivities
while (itr.hasNext()) {
activity = itr.next();
// Sets the xLeft and yTop position of the iterated activity
activity.layout(childXLeft, childYTop);
childYTop += activity.getDimensions().getHeight();
}
// Sets the xLeft and yTop positions of the start icon
setStartIconXLeft(xLeft);
setStartIconYTop(yTop);
// Sets the xLeft and yTop positions of the end icon
setEndIconXLeft(endXLeft);
setEndIconYTop(endYTop);
// Sets the xLeft and yTop positions of the SVG of the process after setting the dimensions
getDimensions().setXLeft(startXLeft);
getDimensions().setYTop(startYTop);
}
use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ProcessImpl method layoutHorizontal.
/**
* Sets the x and y positions of the activities
* At the start: startXLeft=0, startYTop=0
*
* @param startXLeft x-coordinate
* @param startYTop y-coordinate
* centreOfMyLayout- center of the the SVG
*/
private void layoutHorizontal(int startXLeft, int startYTop) {
// Aligns the activities to the center of the layout
int centreOfMyLayout = startYTop + (dimensions.getHeight() / 2);
// Positioning the startIcon
int xLeft = startXLeft + (getYSpacing() / 2);
int yTop = centreOfMyLayout - (getStartIconHeight() / 2);
// Positioning the endIcon
int endXLeft = startXLeft + dimensions.getWidth() - getEndIconWidth() - (getYSpacing() / 2);
int endYTop = centreOfMyLayout - (getEndIconHeight() / 2);
ActivityInterface activity = null;
Iterator<ActivityInterface> itr = getSubActivities().iterator();
// Adjusting the childXLeft and childYTop positions
int childXLeft = xLeft + getStartIconWidth() + (getYSpacing() / 2);
int childYTop = startYTop + (getXSpacing() / 2);
// Iterates through all the subActivities
while (itr.hasNext()) {
activity = itr.next();
// Sets the xLeft and yTop position of the iterated activity
activity.layout(childXLeft, childYTop);
childXLeft += activity.getDimensions().getWidth();
}
// Sets the xLeft and yTop positions of the start icon
setStartIconXLeft(xLeft);
setStartIconYTop(yTop);
// Sets the xLeft and yTop positions of the end icon
setEndIconXLeft(endXLeft);
setEndIconYTop(endYTop);
// Sets the xLeft and yTop positions of the SVG of the process after setting the dimensions
getDimensions().setXLeft(startXLeft);
getDimensions().setYTop(startYTop);
}
Aggregations