Commit 5625b20c authored by Florian Hölzl's avatar Florian Hölzl
Browse files

some improvement on lifeline handling

refs 820
parent 5b6011d3
......@@ -21,6 +21,7 @@ import static org.fortiss.af3.msc.utils.MSCLayoutConstants.MSC_OBJECT_HEADER_HEI
import static org.fortiss.af3.msc.utils.MSCLayoutConstants.MSC_OBJECT_Y;
import static org.fortiss.af3.msc.utils.MSCLayoutUtil.computeLifelineBounds;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_CONNECTOR_SIZE;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_INSETS;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.RectangleFigure;
......@@ -34,7 +35,7 @@ import org.fortiss.tooling.base.ui.editpart.figure.PrettyRoundedRectangle;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: BBBF812AD0ACC3CFA10FF5D0474E5552
* @ConQAT.Rating YELLOW Hash: B99E92E7989C98FAFC3BEF8C7FD7240A
*/
public class MSCObjectFigure extends Figure {
......@@ -83,7 +84,8 @@ public class MSCObjectFigure extends Figure {
java.awt.Rectangle llb =
computeLifelineBounds(new java.awt.Rectangle(rect.x, rect.y, rect.width,
rect.height));
lifelineFigure.setBounds(new Rectangle(llb.x, llb.y, llb.width, llb.height));
lifelineFigure.setBounds(new Rectangle(llb.x + DEFAULT_SHAPE_INSETS, llb.y, llb.width - 2 *
DEFAULT_SHAPE_INSETS, llb.height));
Rectangle mscObjectBounds = new Rectangle(headerX, headerY, headerWidth, rect.height);
super.setBounds(mscObjectBounds);
......
......@@ -61,16 +61,18 @@ import org.fortiss.tooling.base.utils.LayoutModelElementFactory;
* @author mou
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: F05E2BBD9D7EA16F51A43074E0324F1C
* @ConQAT.Rating YELLOW Hash: 9A59064ACEE8C8E1DC628E3FE7C4107A
*/
public class MSCLayoutUtil {
/** Computes the lifeline bounds. */
public static Rectangle computeLifelineBounds(Rectangle mscBounds) {
int lifelineX = mscBounds.getLocation().x + mscBounds.width / 2 - DEFAULT_GRID_SIZE / 2;
int lifelineX =
mscBounds.getLocation().x + mscBounds.width / 2 - DEFAULT_GRID_SIZE -
DEFAULT_SHAPE_INSETS;
int lifelineY = MSC_OBJECT_Y + MSC_OBJECT_HEADER_HEIGHT;
int lifelineWidth = DEFAULT_GRID_SIZE;
int lifelineWidth = 2 * (DEFAULT_GRID_SIZE + DEFAULT_SHAPE_INSETS);
int lifelineHeight = mscBounds.height - MSC_OBJECT_HEADER_HEIGHT;
if(lifelineHeight < MINIMUM_MSC_OBJECT_LIFELINE_HEIGHT) {
lifelineHeight = MINIMUM_MSC_OBJECT_LIFELINE_HEIGHT;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment