package com.vci.client.workflow.editor.shape;
|
|
import java.awt.Rectangle;
|
import java.util.Map;
|
|
import com.mxgraph.canvas.mxGraphics2DCanvas;
|
import com.mxgraph.shape.mxBasicShape;
|
import com.mxgraph.swing.util.mxSwingConstants;
|
import com.mxgraph.util.mxConstants;
|
import com.mxgraph.view.mxCellState;
|
|
public class mxTaskShape extends mxBasicShape {
|
|
public void paintShape(mxGraphics2DCanvas canvas, mxCellState state)
|
{
|
Map<String, Object> style = state.getStyle();
|
|
Rectangle tmp = state.getRectangle();
|
int pad = 0;
|
int radius = 0;
|
try {
|
pad = Integer.parseInt((String) style.get("padding"));
|
radius = Integer.parseInt((String) style.get("radius"));
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
int x = tmp.x + pad;
|
int y = tmp.y + pad;
|
int w = tmp.width - pad * 2;
|
int h = tmp.height - pad * 2;
|
boolean shadow = hasShadow(canvas, state);
|
int shadowOffsetX = shadow ? mxConstants.SHADOW_OFFSETX : 0;
|
int shadowOffsetY = shadow ? mxConstants.SHADOW_OFFSETY : 0;
|
if(canvas.getGraphics().hitClip(x, y, w + shadowOffsetX, h + shadowOffsetY))
|
{
|
if(shadow)
|
{
|
canvas.getGraphics().setColor(mxSwingConstants.SHADOW_COLOR);
|
canvas.getGraphics().fillRoundRect(x + mxConstants.SHADOW_OFFSETX, y + mxConstants.SHADOW_OFFSETY, w, h, radius, radius);
|
}
|
if(configureGraphics(canvas, state, true))
|
canvas.getGraphics().fillRoundRect(x, y, w, h, radius, radius);
|
if(configureGraphics(canvas, state, false))
|
canvas.getGraphics().drawRoundRect(x, y, w, h, radius, radius);
|
}
|
}
|
|
}
|