modify gradient architecture: gradient data are hold in mm now
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/internal/services/impl/GaServiceImpl.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/internal/services/impl/GaServiceImpl.java
index d5a6f4b..5dcaa66 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/internal/services/impl/GaServiceImpl.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/internal/services/impl/GaServiceImpl.java
@@ -29,6 +29,7 @@
import org.eclipse.graphiti.mm.datatypes.Point;
import org.eclipse.graphiti.mm.pictograms.AbstractStyle;
import org.eclipse.graphiti.mm.pictograms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.AdaptedGradientColoredAreas;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.Ellipse;
import org.eclipse.graphiti.mm.pictograms.Font;
@@ -1486,34 +1487,6 @@
* (non-Javadoc)
*
* @see
- * org.eclipse.graphiti.services.IGaService#setRenderingStyle(org.eclipse
- * .graphiti.mm.pictograms.AbstractStyle, java.lang.String)
- */
- public void setRenderingStyle(AbstractStyle abstractStyle, String id) {
- // is the ID supported?
- boolean idSupported = false;
- for (int i = 0; i < IPredefinedRenderingStyle.ALL_IDS.length; i++) {
- if (IPredefinedRenderingStyle.ALL_IDS[i].equals(id)) {
- idSupported = true;
- }
- }
- if (!idSupported) {
- throw new IllegalArgumentException("The ID '" + id + "' is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // set the RenderingStyle with ID
- RenderingStyle renderingStyle = abstractStyle.getRenderingStyle();
- if (renderingStyle == null) {
- renderingStyle = PictogramsFactory.eINSTANCE.createRenderingStyle();
- abstractStyle.setRenderingStyle(renderingStyle);
- }
- renderingStyle.setPredefinedStyleId(id);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
* org.eclipse.graphiti.services.IGaLayoutService#setSizeOfGraphicsAlgorithm
* (org.eclipse.graphiti.mm.pictograms.GraphicsAlgorithm, int, int)
*/
@@ -1532,5 +1505,21 @@
public void setWidth(GraphicsAlgorithm ga, int width) {
ga.setWidth(width);
}
-
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.services.IGaService#setRenderingStyle(org.eclipse.graphiti.mm.pictograms.AbstractStyle, org.eclipse.graphiti.mm.pictograms.AdaptedGradientColoredAreas)
+ */
+ public void setRenderingStyle(AbstractStyle abstractStyle, AdaptedGradientColoredAreas adaptedGradientColoredAreas) {
+ if (adaptedGradientColoredAreas != null && adaptedGradientColoredAreas.getAdaptedGradientColoredAreas() != null &&!adaptedGradientColoredAreas.getAdaptedGradientColoredAreas().isEmpty()) {
+ // set the RenderingStyle with AdaptedGradientColoredAreas
+ RenderingStyle renderingStyle = abstractStyle.getRenderingStyle();
+ if (renderingStyle == null) {
+ renderingStyle = PictogramsFactory.eINSTANCE.createRenderingStyle();
+ abstractStyle.setRenderingStyle(renderingStyle);
+ }
+ renderingStyle.setAdaptedGradientColoredAreas(adaptedGradientColoredAreas);
+ }else{
+ throw new IllegalArgumentException("Object AdaptedGradientColoredAreas is null or empty"); //$NON-NLS-1$
+ }
+ }
}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/services/IGaService.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/services/IGaService.java
index f98107e..ce75ce9 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/services/IGaService.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/services/IGaService.java
@@ -18,6 +18,7 @@
import org.eclipse.graphiti.mm.datatypes.Color;
import org.eclipse.graphiti.mm.pictograms.AbstractStyle;
import org.eclipse.graphiti.mm.pictograms.AbstractText;
+import org.eclipse.graphiti.mm.pictograms.AdaptedGradientColoredAreas;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.Font;
import org.eclipse.graphiti.mm.pictograms.GraphicsAlgorithm;
@@ -29,7 +30,6 @@
import org.eclipse.graphiti.mm.pictograms.Style;
import org.eclipse.graphiti.mm.pictograms.StyleContainer;
import org.eclipse.graphiti.util.IColorConstant;
-import org.eclipse.graphiti.util.IPredefinedRenderingStyle;
/**
* The interface IGaService provides convenient services for the creation and
@@ -293,8 +293,8 @@
*
* @param abstractStyle
* The AbstractStyle for which to set the RenderingStyle.
- * @param id
- * The ID of the RenderingStyle.
+ * @param adaptedGradientColoredAreas
+ * The {@link AdaptedGradientColoredAreas} gradient colored areas.
*/
- public void setRenderingStyle(AbstractStyle abstractStyle, String id);
+ public void setRenderingStyle(AbstractStyle abstractStyle, AdaptedGradientColoredAreas adaptedGradientColoredAreas);
}
diff --git a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/util/IPredefinedRenderingStyle.java b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/util/IPredefinedRenderingStyle.java
index d6d35a6..fbaae8d 100644
--- a/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/util/IPredefinedRenderingStyle.java
+++ b/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/util/IPredefinedRenderingStyle.java
@@ -15,13 +15,13 @@
*******************************************************************************/
package org.eclipse.graphiti.util;
+import org.eclipse.graphiti.services.IGaService;
+
/**
* The IDs of the predefined rendering styles. See
- * {@link GaUtil#setRenderingStyle(org.eclipse.graphiti.mm.pictograms.AbstractStyle, String)}
- * .
+ * {@link IGaService#setRenderingStyle(AbstractStyle, org.eclipse.graphiti.mm.pictograms.AdaptedGradientColoredAreas)}.
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ *
*/
public interface IPredefinedRenderingStyle {
@@ -56,9 +56,28 @@
public static final String SILVER_WHITE_GLOSS_ID = "silver-white-gloss"; //$NON-NLS-1$
/**
- * All IDs.
+ * The style-adaptation to use for default elements.
*/
- public static final String[] ALL_IDS = new String[] { BLUE_WHITE_GLOSS_ID, BLUE_WHITE_ID, LIGHT_YELLOW_ID, LIGHT_GRAY_ID,
- COPPER_WHITE_GLOSS_ID, SILVER_WHITE_GLOSS_ID };
+ public static final int STYLE_ADAPTATION_DEFAULT = 0;
+
+ /**
+ * The style-adaptation to use for primary selected elements.
+ */
+ public static final int STYLE_ADAPTATION_PRIMARY_SELECTED = 1;
+
+ /**
+ * The style-adaptation to use for secondary selected elements.
+ */
+ public static final int STYLE_ADAPTATION_SECONDARY_SELECTED = 2;
+
+ /**
+ * The style-adaptation to use to indicate that an action is allowed.
+ */
+ public static final int STYLE_ADAPTATION_ACTION_ALLOWED = 3;
+
+ /**
+ * The style-adaptation to use to indicate that an action is forbidden.
+ */
+ public static final int STYLE_ADAPTATION_ACTION_FORBIDDEN = 4;
}