diff options
author | Céline Janssens | 2014-09-25 13:53:34 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-09-25 15:03:34 +0000 |
commit | 84b7754d168b0ae91f06faf45d4356f5d9b38111 (patch) | |
tree | 2a994a3cd4282bd9fcc1053c1c395a4e4c00ea0b /plugins/infra | |
parent | 77daacb6e47f3da75f212e9888a9818cc79d936f (diff) | |
download | org.eclipse.papyrus-84b7754d168b0ae91f06faf45d4356f5d9b38111.tar.gz org.eclipse.papyrus-84b7754d168b0ae91f06faf45d4356f5d9b38111.tar.xz org.eclipse.papyrus-84b7754d168b0ae91f06faf45d4356f5d9b38111.zip |
440230: [All Diagrams] Add Margins to the Labels
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440230
- Allow 4 sides Labe lMargin instead of vertical and horizontal only
Change-Id: I1970e2317ce6c3c5708bad3a880ea4abf9c04018
Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net>
Diffstat (limited to 'plugins/infra')
3 files changed, 52 insertions, 15 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java index 208b2876c81..c7815db0d5a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java @@ -8,7 +8,7 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation - * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net + * Céline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440230 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 443235 * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - text alignment implementation * @@ -52,12 +52,22 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart { /** * CSS Integer property to define the horizontal Label Margin */ - static final String X_MARGIN_PROPERTY = "xMarginLabel"; //$NON-NLS$ + static final String TOP_MARGIN_PROPERTY = "TopMarginLabel"; //$NON-NLS$ /** * CSS Integer property to define the vertical Label Margin */ - static final String Y_MARGIN_PROPERTY = "yMarginLabel"; //$NON-NLS$ + static final String LEFT_MARGIN_PROPERTY = "LeftMarginLabel"; //$NON-NLS$ + + /** + * CSS Integer property to define the horizontal Label Margin + */ + static final String BOTTOM_MARGIN_PROPERTY = "BottomMarginLabel"; //$NON-NLS$ + + /** + * CSS Integer property to define the vertical Label Margin + */ + static final String RIGHT_MARGIN_PROPERTY = "RightMarginLabel"; //$NON-NLS$ /** The Constant TEXT_ALIGNMENT. */ private static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS$ @@ -355,22 +365,26 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart { public void refreshLabelMargin() { IFigure figure = null; - int horizontalMargin = DEFAULT_MARGIN; - int verticalMargin = DEFAULT_MARGIN; + int leftMargin = DEFAULT_MARGIN; + int rightMargin = DEFAULT_MARGIN; + int topMargin = DEFAULT_MARGIN; + int bottomMargin = DEFAULT_MARGIN; Object model = this.getModel(); if (model instanceof View) { - horizontalMargin = NotationUtils.getIntValue((View) model, Y_MARGIN_PROPERTY, DEFAULT_MARGIN); - verticalMargin = NotationUtils.getIntValue((View) model, X_MARGIN_PROPERTY, DEFAULT_MARGIN); + leftMargin = NotationUtils.getIntValue((View) model, LEFT_MARGIN_PROPERTY, DEFAULT_MARGIN); + rightMargin = NotationUtils.getIntValue((View) model, RIGHT_MARGIN_PROPERTY, DEFAULT_MARGIN); + topMargin = NotationUtils.getIntValue((View) model, TOP_MARGIN_PROPERTY, DEFAULT_MARGIN); + bottomMargin = NotationUtils.getIntValue((View) model, BOTTOM_MARGIN_PROPERTY, DEFAULT_MARGIN); } figure = ((GraphicalEditPart) this).getFigure(); if (figure instanceof IPapyrusWrappingLabel) { - ((IPapyrusWrappingLabel) figure).setMarginLabel(verticalMargin,horizontalMargin); + ((IPapyrusWrappingLabel) figure).setMarginLabel(leftMargin, topMargin, rightMargin, bottomMargin); } } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/IPapyrusWrappingLabel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/IPapyrusWrappingLabel.java index 1c1c8def10d..1aa7ead09c7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/IPapyrusWrappingLabel.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/IPapyrusWrappingLabel.java @@ -31,4 +31,16 @@ public interface IPapyrusWrappingLabel extends IFigure { */
void setMarginLabel(int xMargin , int yMargin);
-}
+
+
+
+
+ /**
+ * Set the margin of the Label in the horizontal direction and vertical Direction
+ * @param xMargin Horizontal Margin
+ * @param yMargin Vertical Margin
+ *
+ */
+ void setMarginLabel(int leftMargin , int topMargin, int rightMargin, int bottomMargin);
+
+}
\ No newline at end of file diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java index 0a47beb6bf0..f7eb0c705a6 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java @@ -88,20 +88,31 @@ public class PapyrusWrappingLabel extends WrappingLabel implements IPapyrusWrapp /**
* @see org.eclipse.papyrus.infra.gmfdiag.common.figure.IPapyrusWrappingLabel#setMarginLabel(int, int)
*
- * @param xMargin Horizontal margin
- * @param yMargin Vertical margin
+ * @param xMargin Vertical margin
+ * @param yMargin Horizontal margin
*/
@Override
public void setMarginLabel(int xMargin, int yMargin) {
- MarginBorder mb = new MarginBorder(xMargin, yMargin, xMargin, yMargin);
+ this.setMarginLabel(xMargin, yMargin , xMargin, yMargin);
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.figure.IPapyrusWrappingLabel#setMarginLabel(int, int, int, int)
+ *
+ * @param leftMargin
+ * @param topMargin
+ * @param rightMargin
+ * @param bottomMargin
+ */
+ @Override
+ public void setMarginLabel(int leftMargin, int topMargin, int rightMargin, int bottomMargin) {
+ MarginBorder mb = new MarginBorder(topMargin, leftMargin, bottomMargin, rightMargin);
this.setBorder(mb);
repaint();
revalidate();
-
-
-
}
|