int actH = GraphUtilities.getGraphController().getGraphSettings().getActivityHeight();
int shadowWidth = GraphUtilities.getGraphController().getGraphSettings().getShadowWidth();
boolean showShadow = GraphUtilities.getGraphController().getGraphSettings().isShadowEnabled();
GraphActivityInterface gact = (GraphActivityInterface) view.getCell();
Activity act = (Activity) gact.getUserObject();
boolean frontJoin = false;
if (XMLUtil.isANDTypeSplitOrJoin(act, 1)) {
frontJoin = true;
}
boolean backJoin = false;
if (XMLUtil.isANDTypeSplitOrJoin(act, 0)) {
backJoin = true;
}
Color bckgC = getFillColor();
if (selected) {
bckgC = GraphUtilities.getGraphController().getGraphSettings().getSelectedActivityColor();
}
// CUSTOM
String displayName = getDisplayName();
Dimension dim = DefaultGraphActivityRenderer.calculateWidthAndHeight(displayName, actW, actH);
actW = (int)dim.getWidth();
actH = (int)dim.getHeight();
int actType = act.getActivityType();
if (actType == XPDLConstants.ACTIVITY_TYPE_ROUTE) {
g.setColor(bordercolor);
boolean inclusive = act.isAndTypeJoin() || act.isAndTypeSplit();
String gatewayImage = (inclusive) ? "/org/enhydra/jawe/images/gateway_inclusive.gif" : "/org/enhydra/jawe/images/gateway_exclusive.gif";
g.drawImage(new ImageIcon(getClass().getResource(gatewayImage)).getImage(), 10, 0, null);
if (selected) {
// draw border
g.setColor(Color.LIGHT_GRAY);
((Graphics2D) g).setStroke(borderStroke);
g.drawRoundRect(0, 0, actW - 1 - shadowWidth, actH - 1 - shadowWidth + 2, arc, arc);
}
return;
} else {
Rectangle tempClipRect = new Rectangle(0, 0, actW, actH);
g.setClip(tempClipRect);
}
// CUSTOM
// fill activity
g.setColor(bckgC);
g.fillRoundRect(0, 0, actW - shadowWidth, actH - shadowWidth, arc, arc);
// drawing panel
super.setOpaque(false);
Graphics gl = g.create(5, 5, actW - 9 - shadowWidth, actH - 9 - shadowWidth);
Rectangle panelRect = new Rectangle(0, 0, actW - 9 - shadowWidth, actH - 9 - shadowWidth);
super.setBounds(panelRect);
graph.setHighlightColor(bckgC);
setBorder(BorderFactory.createLineBorder(bckgC, 0));
super.paint(gl);
setBorder(BorderFactory.createLineBorder(bordercolor, 0));
setForeground(bordercolor);
// display limit
String limit = act.getLimit();
if (limit != null && limit.trim().length() > 0) {
WorkflowProcess process = (WorkflowProcess)act.getParent().getParent();
String durationUnit = process.getProcessHeader().getDurationUnit();
if (durationUnit == null) {
durationUnit = "";
} else {
durationUnit = durationUnit.toLowerCase();
}
g.setColor(Color.GRAY);
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 8));
g.drawString(limit + durationUnit, 5, 35);
}
// shadow
if (showShadow) {
g.setColor(new Color(192, 192, 192));
((Graphics2D) g).setStroke(new BasicStroke(shadowWidth,
BasicStroke.CAP_BUTT,
BasicStroke.JOIN_ROUND));
g.drawLine(shadowWidth, actH - shadowWidth, actW - shadowWidth, actH - shadowWidth);
if (!backJoin) {
g.drawLine(actW - shadowWidth,
actH - shadowWidth,
actW - shadowWidth,
shadowWidth);
}
}
// draw border
g.setColor(bordercolor);
((Graphics2D) g).setStroke(borderStroke);
g.drawRoundRect(0, 0, actW - 1 - shadowWidth, actH - 1 - shadowWidth, arc, arc);
// add > to front
Color gCol = GraphUtilities.getGraphController().getGraphSettings().getBackgroundColor();
if (frontJoin) {
g.setColor(gCol);
int[] x = {
0, 4, 0
};
int[] y = {
arc, actH / 2, actH - arc
};
g.fillPolygon(x, y, 3);
g.setColor(bordercolor);
((Graphics2D) g).setStroke(borderStroke);
g.drawLine(x[0], y[0], x[1], y[1]);
g.drawLine(x[1], y[1], x[2], y[2]);
}
// add > to back
if (backJoin) {
g.setColor(gCol);
// clean
int[] x = {
actW - shadowWidth - 4,
actW,
actW,
actW - shadowWidth - 4,
actW - shadowWidth
};
int[] y = {
0, 0, actH, actH, actH / 2
};
g.fillPolygon(x, y, 5);
g.setColor(new Color(192, 192, 192));
((Graphics2D) g).setStroke(new BasicStroke(shadowWidth,
BasicStroke.CAP_BUTT,
BasicStroke.JOIN_ROUND));
g.drawLine(x[0] + 1, y[0], x[4] + 1, y[4]);
g.drawLine(x[4] + 1, y[4], x[3] + 1, y[3] - shadowWidth);
g.setColor(bordercolor);
((Graphics2D) g).setStroke(borderStroke);
g.drawLine(x[0], y[0], x[4], y[4]);
g.drawLine(x[4], y[4], x[3], y[3] - shadowWidth);
}
int type = act.getActivityType();
if (type == XPDLConstants.ACTIVITY_TYPE_BLOCK && GraphUtilities.getGraphController().getGraphSettings().shouldDrawBlockLines()) {
g.setColor(bordercolor);
g.drawLine(3, 0, 3, actH - 2 - shadowWidth);
g.drawLine(actW - 4 - shadowWidth, 0, actW - 4 - shadowWidth, actH - 2 - shadowWidth);
} else if (type == XPDLConstants.ACTIVITY_TYPE_SUBFLOW && GraphUtilities.getGraphController().getGraphSettings().shouldDrawSubflowLines()) {