diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/ElementEditPartBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/ElementEditPartBase.java index de0ff191659d0c2e13ff6595e2046cfa9bb6238f..9f8ed8c56a6d068baa81a042c25b4f0cac841018 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/ElementEditPartBase.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/ElementEditPartBase.java @@ -94,6 +94,24 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam return LayoutDataUtils.getNodeBounds(modelElement); } + /** {@inheritDoc} */ + @Override + protected Rectangle determineLabelFigureBounds() { + Rectangle textBounds = labelFigure.getTextBounds(); + Rectangle labelBounds = determineBaseFigureBounds(); + labelBounds.y += (labelBounds.height - textBounds.height) / 2; + labelBounds.x += 2 * DefaultLayoutConstants.DEFAULT_SHAPE_INSETS; + labelBounds.width -= 4 * DefaultLayoutConstants.DEFAULT_SHAPE_INSETS; + labelBounds.height = textBounds.height; + return labelBounds; + } + + /** {@inheritDoc} */ + @Override + protected String determineLabelFigureText() { + return modelElement.getName(); + } + /** {@inheritDoc} */ @Override protected void createEditPolicies() { @@ -123,16 +141,6 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam + ": " + modelElement.getComment(), 100); baseFigure.setToolTip(new Label(tooltipText)); - // center label on base figure with insets - labelFigure.setText(modelElement.getName()); - Rectangle textBounds = labelFigure.getTextBounds(); - Rectangle labelBounds = new Rectangle(baseFigure.getBounds()); - labelBounds.y += (labelBounds.height - textBounds.height) / 2; - labelBounds.x += 2 * DefaultLayoutConstants.DEFAULT_SHAPE_INSETS; - labelBounds.width -= 4 * DefaultLayoutConstants.DEFAULT_SHAPE_INSETS; - labelBounds.height = textBounds.height; - labelFigure.setBounds(labelBounds); - for (EditPart child : (List<EditPart>) getChildren()) { child.refresh(); } diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/figure/PrettyRoundedRectangle.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/figure/PrettyRoundedRectangle.java index 6f535092b6a0a4ac08d56e418ec39d33b42ae377..f60cc2ff4f2eb319df8b3f6f6605af6c897b5cb6 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/figure/PrettyRoundedRectangle.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/figure/PrettyRoundedRectangle.java @@ -99,7 +99,7 @@ public class PrettyRoundedRectangle extends Shape { /** Returns a copy of the bounds cropped by the insets. */ protected Rectangle getCroppedBounds() { - return bounds.getCropped(insets); + return bounds.getShrinked(insets); } /** diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/layout/constants/DefaultLayoutConstants.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/layout/constants/DefaultLayoutConstants.java index 233c35a0818b4b346d46c04a5f0e0988b4626f32..b3a2504a3d5ac3f73477036fa289f16d033118fd 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/layout/constants/DefaultLayoutConstants.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/layout/constants/DefaultLayoutConstants.java @@ -60,4 +60,7 @@ public final class DefaultLayoutConstants { // connector default constants /** The size of a default connector. */ public static final int DEFAULT_CONNECTOR_SIZE = 2 * DEFAULT_GRID_SIZE; + + /** The default position offset of a shape. */ + public static final int DEFAULT_SHAPE_OFFSET = 2 * DEFAULT_GRID_SIZE; }