Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cdo/bundles/org.eclipse.papyrus.infra.gmfdiag.css.cdo/src/org/eclipse/papyrus/infra/gmfdiag/css/cdo/CSSShapeStyleImpl.java')
-rw-r--r--plugins/cdo/bundles/org.eclipse.papyrus.infra.gmfdiag.css.cdo/src/org/eclipse/papyrus/infra/gmfdiag/css/cdo/CSSShapeStyleImpl.java422
1 files changed, 422 insertions, 0 deletions
diff --git a/plugins/cdo/bundles/org.eclipse.papyrus.infra.gmfdiag.css.cdo/src/org/eclipse/papyrus/infra/gmfdiag/css/cdo/CSSShapeStyleImpl.java b/plugins/cdo/bundles/org.eclipse.papyrus.infra.gmfdiag.css.cdo/src/org/eclipse/papyrus/infra/gmfdiag/css/cdo/CSSShapeStyleImpl.java
new file mode 100644
index 00000000..067556a2
--- /dev/null
+++ b/plugins/cdo/bundles/org.eclipse.papyrus.infra.gmfdiag.css.cdo/src/org/eclipse/papyrus/infra/gmfdiag/css/cdo/CSSShapeStyleImpl.java
@@ -0,0 +1,422 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.cdo;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.emf.cdo.gmf.notation.impl.ShapeStyleImpl;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSShapeStyle;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSShapeStyleDelegate;
+
+public class CSSShapeStyleImpl extends ShapeStyleImpl implements CSSShapeStyle {
+
+ protected ExtendedCSSEngine engine;
+
+ private CSSShapeStyle shapeStyle;
+
+ protected CSSShapeStyle getShapeStyle() {
+ if (shapeStyle == null) {
+ shapeStyle = new CSSShapeStyleDelegate(this, getEngine());
+ }
+ return shapeStyle;
+ }
+
+ protected ExtendedCSSEngine getEngine() {
+ if (engine == null) {
+ engine = ((CSSDiagram) findView().getDiagram()).getEngine();
+ }
+ return engine;
+ }
+
+ protected View findView() {
+ EObject parent = eContainer();
+ while (!(parent instanceof View) && parent != null) {
+ parent = parent.eContainer();
+ }
+
+ if (parent != null) {
+ return (View) parent;
+ }
+
+ return null;
+ }
+
+
+ // ////////////////////////////////////////
+ // Forwards accesses to CSS properties //
+ // ////////////////////////////////////////
+
+
+ @Override
+ public int getCSSFontColor() {
+ int value = super.getFontColor();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_FontColor(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSFontColor();
+ }
+ }
+
+ @Override
+ public java.lang.String getCSSFontName() {
+ java.lang.String value = super.getFontName();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_FontName(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSFontName();
+ }
+ }
+
+ @Override
+ public int getCSSFontHeight() {
+ int value = super.getFontHeight();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_FontHeight(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSFontHeight();
+ }
+ }
+
+ @Override
+ public boolean isCSSBold() {
+ boolean value = super.isBold();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_Bold(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().isCSSBold();
+ }
+ }
+
+ @Override
+ public boolean isCSSItalic() {
+ boolean value = super.isItalic();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_Italic(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().isCSSItalic();
+ }
+ }
+
+ @Override
+ public boolean isCSSUnderline() {
+ boolean value = super.isUnderline();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_Underline(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().isCSSUnderline();
+ }
+ }
+
+ @Override
+ public boolean isCSSStrikeThrough() {
+ boolean value = super.isStrikeThrough();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFontStyle_StrikeThrough(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().isCSSStrikeThrough();
+ }
+ }
+
+ @Override
+ public java.lang.String getCSSDescription() {
+ java.lang.String value = super.getDescription();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getDescriptionStyle_Description(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSDescription();
+ }
+ }
+
+ @Override
+ public int getCSSFillColor() {
+ int value = super.getFillColor();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFillStyle_FillColor(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSFillColor();
+ }
+ }
+
+ @Override
+ public int getCSSTransparency() {
+ int value = super.getTransparency();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFillStyle_Transparency(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSTransparency();
+ }
+ }
+
+ @Override
+ public org.eclipse.gmf.runtime.notation.datatype.GradientData getCSSGradient() {
+ org.eclipse.gmf.runtime.notation.datatype.GradientData value = super.getGradient();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getFillStyle_Gradient(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSGradient();
+ }
+ }
+
+ @Override
+ public int getCSSLineColor() {
+ int value = super.getLineColor();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getLineStyle_LineColor(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSLineColor();
+ }
+ }
+
+ @Override
+ public int getCSSLineWidth() {
+ int value = super.getLineWidth();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getLineStyle_LineWidth(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSLineWidth();
+ }
+ }
+
+ @Override
+ public int getCSSRoundedBendpointsRadius() {
+ int value = super.getRoundedBendpointsRadius();
+
+ if (ForceValueHelper.isSet(findView(), this, NotationPackage.eINSTANCE.getRoundedCornersStyle_RoundedBendpointsRadius(), value)) {
+ return value;
+ } else {
+ return getShapeStyle().getCSSRoundedBendpointsRadius();
+ }
+ }
+
+
+ @Override
+ public int getFontColor() {
+ return getCSSFontColor();
+ }
+
+ @Override
+ public java.lang.String getFontName() {
+ return getCSSFontName();
+ }
+
+ @Override
+ public int getFontHeight() {
+ return getCSSFontHeight();
+ }
+
+ @Override
+ public boolean isBold() {
+ return isCSSBold();
+ }
+
+ @Override
+ public boolean isItalic() {
+ return isCSSItalic();
+ }
+
+ @Override
+ public boolean isUnderline() {
+ return isCSSUnderline();
+ }
+
+ @Override
+ public boolean isStrikeThrough() {
+ // return super.isStrikeThrough();
+ return isCSSStrikeThrough();
+ }
+
+ @Override
+ public java.lang.String getDescription() {
+ // return super.getDescription();
+ return getCSSDescription();
+ }
+
+ @Override
+ public int getFillColor() {
+ return getCSSFillColor();
+ }
+
+ @Override
+ public int getTransparency() {
+ return getCSSTransparency();
+ }
+
+ @Override
+ public org.eclipse.gmf.runtime.notation.datatype.GradientData getGradient() {
+ return getCSSGradient();
+ }
+
+ @Override
+ public int getLineColor() {
+ return getCSSLineColor();
+ }
+
+ @Override
+ public int getLineWidth() {
+ return getCSSLineWidth();
+ }
+
+ @Override
+ public int getRoundedBendpointsRadius() {
+ return getCSSRoundedBendpointsRadius();
+ }
+
+
+
+ // //////////////////////////////////////////////
+ // Implements a setter for each CSS property //
+ // //////////////////////////////////////////////
+
+ @Override
+ public void setFontColor(int value) {
+ super.setFontColor(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_FontColor();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setFontName(java.lang.String value) {
+ super.setFontName(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_FontName();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setFontHeight(int value) {
+ super.setFontHeight(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_FontHeight();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setBold(boolean value) {
+ super.setBold(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_Bold();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setItalic(boolean value) {
+ super.setItalic(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_Italic();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setUnderline(boolean value) {
+ super.setUnderline(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_Underline();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setStrikeThrough(boolean value) {
+ super.setStrikeThrough(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFontStyle_StrikeThrough();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setDescription(java.lang.String value) {
+ super.setDescription(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getDescriptionStyle_Description();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setFillColor(int value) {
+ super.setFillColor(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFillStyle_FillColor();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setTransparency(int value) {
+ super.setTransparency(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFillStyle_Transparency();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setGradient(org.eclipse.gmf.runtime.notation.datatype.GradientData value) {
+ super.setGradient(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getFillStyle_Gradient();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setLineColor(int value) {
+ super.setLineColor(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getLineStyle_LineColor();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setLineWidth(int value) {
+ super.setLineWidth(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getLineStyle_LineWidth();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ @Override
+ public void setRoundedBendpointsRadius(int value) {
+ super.setRoundedBendpointsRadius(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getRoundedCornersStyle_RoundedBendpointsRadius();
+ ForceValueHelper.setValue(findView(), feature, value);
+ }
+
+ // ////////////////////////////////
+ // Implements the unset method //
+ // ////////////////////////////////
+
+ @Override
+ public void eUnset(int featureId) {
+ super.eUnset(featureId);
+
+ EStructuralFeature feature = eClass().getEStructuralFeature(featureId);
+ ForceValueHelper.unsetValue(findView(), feature);
+ }
+
+
+}

Back to the top