use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-business-process by wso2.
the class ScopeImpl method getStartFaultCoords.
/**
* At the start: xLeft=0, yTop=0
* Calculates the coordinates of the start arrow of the FaultHandler
*
* @return coordinates of the start arrow of the FaultHandler
*/
protected SVGCoordinates getStartFaultCoords() {
int xLeft = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = getCoreDimensions().getXLeft() + getCoreDimensions().getWidth();
yTop = getCoreDimensions().getYTop() + (getHandlerIconHeight() * 3) + (getHandlerConnectorSpacing() * 4) + (getYSpacing() / 2);
} else {
xLeft = getCoreDimensions().getXLeft() + (getHandlerIconWidth() * 3) + (getHandlerConnectorSpacing() * 4) + (getYSpacing() / 2);
yTop = getCoreDimensions().getYTop() + getCoreDimensions().getHeight();
}
// Returns the calculated coordinate points of the start arrow of the FaultHandler
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 ScopeImpl method getExitArrowCoords.
/**
* At the start: xLeft=0, yTop=0
* 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 = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = getEndIconXLeft() + (getEndIconWidth() / 2);
yTop = getEndIconYTop() + getEndIconHeight();
} else {
xLeft = getEndIconXLeft() + getEndIconWidth();
yTop = getEndIconYTop() + (getEndIconHeight() / 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 ScopeImpl method getEndIconEntryArrowCoords.
/**
* At the start: xLeft=0, yTop=0
* Calculates the coordinates of the arrow which enters the end icon
*
* @return coordinates of the entry arrow for the end icon
* After Calculations(Vertical Layout): xLeft= Xleft of Icon + (width of icon)/2 , yTop= Ytop of the Icon
*/
protected SVGCoordinates getEndIconEntryArrowCoords() {
int xLeft = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = getEndIconXLeft() + (getEndIconWidth() / 2);
yTop = getEndIconYTop();
} else {
xLeft = getEndIconXLeft();
yTop = getEndIconYTop() + (getEndIconHeight() / 2);
}
// Returns the calculated coordinate points of the entry arrow of the endIcon
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 ScopeImpl method getStartCompensationCoords.
/**
* At the start: xLeft=0, yTop=0
* Calculates the coordinates of the start arrow of the CompensationHandler
*
* @return coordinates of the start arrow of the CompensationHandler
*/
protected SVGCoordinates getStartCompensationCoords() {
int xLeft = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = getCoreDimensions().getXLeft() + getCoreDimensions().getWidth();
yTop = getCoreDimensions().getYTop() + (getHandlerIconHeight() * 2) + (getHandlerConnectorSpacing() * 3) + (getYSpacing() / 2);
} else {
xLeft = getCoreDimensions().getXLeft() + (getHandlerIconWidth() * 2) + (getHandlerConnectorSpacing() * 3) + (getYSpacing() / 2);
yTop = getCoreDimensions().getYTop() + getCoreDimensions().getHeight();
}
// Returns the calculated coordinate points of the start arrow of the CompensationHandler
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 ScopeImpl method getDimensions.
/**
* At the start: width=0, height=0
*
* @return dimensions of the composite activity i.e. the final width and height after doing calculations by
* iterating
* through the dimensions of the subActivities
*/
@Override
public SVGDimension getDimensions() {
if (dimensions == null) {
int width = 0;
int height = 0;
int coreWidth = 0;
int coreHeight = 0;
int conWidth = 0;
int conHeight = 0;
// Set the dimensions at the start to (0,0)
dimensions = new SVGDimension(coreWidth, coreHeight);
coreDimensions = new SVGDimension(coreWidth, coreHeight);
conditionalDimensions = new SVGDimension(conWidth, conHeight);
// Dimensons of the subActivities
SVGDimension subActivityDim = null;
ActivityInterface activity = null;
// Iterates through the subActivites inside the composite activity
Iterator<ActivityInterface> itr = getSubActivities().iterator();
while (itr.hasNext()) {
activity = itr.next();
// Gets the dimensions of each subActivity separately
subActivityDim = activity.getDimensions();
/*Checks whether the subActivity is any of the handlers i.e. FaultHandler, TerminationHandler,
CompensateHandler
or EventHandler
*/
if (activity instanceof FaultHandlerImpl || activity instanceof TerminationHandlerImpl || activity instanceof CompensationHandlerImpl || activity instanceof EventHandlerImpl) {
if (subActivityDim.getHeight() > conHeight) {
// height of the icon is added to the conditional height
conHeight = subActivityDim.getHeight();
}
// width of the subActivities added to the conditional width
conWidth += subActivityDim.getWidth();
} else if (activity instanceof RepeatUntilImpl || activity instanceof ForEachImpl || activity instanceof WhileImpl || activity instanceof IfImpl) {
/* If the activity is an instance of ForEach, Repeat Until, While or If activity,
ySpacing = 70 is also added to the core height of the composite activity as the start icons
of those activities are placed on the scope of the composite activity, so it requires more spacing.
*/
if (subActivityDim.getWidth() > coreWidth) {
// width of the subActivities added to the core width
coreWidth = subActivityDim.getWidth();
}
coreHeight += subActivityDim.getHeight() + getYSpacing();
} else {
// If the subActivites are not instances of any handlers
if (subActivityDim.getWidth() > coreWidth) {
// width of the subActivities added to the core width
coreWidth = subActivityDim.getWidth();
}
// height of the subActivities added to the core height
coreHeight += subActivityDim.getHeight();
}
}
// Spacing the core height by adding ySpacing + startIcon height + endIcon height
coreHeight += getYSpacing() + getStartIconHeight() + getEndIconHeight();
// Check if its a simple layout
if (!isSimpleLayout()) {
coreWidth += getXSpacing();
}
conHeight += getHandlerAdjustment();
// Setting the core dimensions after calculations
coreDimensions.setHeight(coreHeight);
coreDimensions.setWidth(coreWidth);
// Setting the conditional dimensions after calculations
conditionalDimensions.setHeight(conHeight);
conditionalDimensions.setWidth(conWidth);
// Checks if the core height is greater than the conditional height
if (coreHeight > conHeight) {
height = coreHeight;
} else {
height = conHeight;
}
// core width and conditional width is added to the final width of the composite activity
width = coreWidth + conWidth;
// Get the final height and width by adding Xspacing and Yspacing
height += getYSpacing();
width += getXSpacing();
// Set the Calculated dimensions for the SVG height and width
dimensions.setWidth(width);
dimensions.setHeight(height);
}
return dimensions;
}
Aggregations