diff options
Diffstat (limited to 'source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java')
| -rw-r--r-- | source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java b/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java deleted file mode 100644 index c4309ee..0000000 --- a/source/com/c2kernel/lifecycle/gui/view/ActivitySlotDefRenderer.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.c2kernel.lifecycle.gui.view;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.graph.model.Vertex;
-import com.c2kernel.graph.view.VertexRenderer;
-import com.c2kernel.lifecycle.ActivitySlotDef;
-import com.c2kernel.utils.Language;
-
-public class ActivitySlotDefRenderer implements VertexRenderer
-{
- private Paint mInactivePaint = new Color(255, 255, 255);
- private Paint mErrorPaint = new Color( 255, 50, 0 );
- private Paint mCompositePaint= new Color(200, 200, 255);
- private Paint mTextPaint = Color.black;
-
-
- @Override
- public void draw( Graphics2D g2d, Vertex vertex)
- {
- ActivitySlotDef activitySlotDef = ( ActivitySlotDef )vertex;
- boolean hasError = activitySlotDef.verify();
- boolean isComposite = false;
- isComposite = activitySlotDef.getIsComposite();
- GraphPoint centrePoint = activitySlotDef.getCentrePoint();
- int vertexHeight = activitySlotDef.getHeight();
- int vertexWidth = activitySlotDef.getWidth();
-
- String[] linesOfText = new String[2+(hasError?0:1)];
- FontMetrics metrics = g2d.getFontMetrics();
- int lineWidth = 0;
- int lineHeight = metrics.getHeight();
- int linesHeight = lineHeight * linesOfText.length;
- int linesStartY = centrePoint.y - linesHeight / 2 + lineHeight * 2 / 3;
- int x = 0;
- int y = 0;
- int i = 0;
-
- linesOfText[0]="("+activitySlotDef.getActivityDef()+")";
- linesOfText[1]=(String)activitySlotDef.getProperties().get("Name");
-
- if (!hasError)linesOfText[2]=Language.translate(activitySlotDef.getErrors());
-
- g2d.setPaint( !hasError ? mErrorPaint : isComposite ? mCompositePaint : mInactivePaint );
- g2d.fill3DRect
- (
- centrePoint.x - vertexWidth / 2,
- centrePoint.y - vertexHeight / 2,
- vertexWidth,
- vertexHeight,
- true
- );
-
- g2d.setPaint( mTextPaint );
-
- // Draw the lines of text
- for ( i = 0; i < linesOfText.length; i++ )
- {
- if (linesOfText[i] == null) linesOfText[i] = "";
- lineWidth = metrics.stringWidth( linesOfText[ i ] );
- x = centrePoint.x - lineWidth / 2;
- y = linesStartY + i * lineHeight;
- g2d.drawString( linesOfText[ i ], x, y );
- }
- }
-}
-
|
