Package org.eclipse.graphiti.util
Class PredefinedColoredAreas
- java.lang.Object
-
- org.eclipse.graphiti.util.PredefinedColoredAreas
-
- All Implemented Interfaces:
IPredefinedRenderingStyle
public class PredefinedColoredAreas extends java.lang.Object implements IPredefinedRenderingStyle
Predefined gradient color-areas to be used in GFFigureUtil with method paintColorFlow(..). This class comprises the definitions for predefined gradients and their adaptations for one or more visual states:IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED,IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED,IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_ALLOWED,IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_FORBIDDEN. Gradient definitions have corresponding ID's:IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID,IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID,IPredefinedRenderingStyle.BLUE_WHITE_ID,IPredefinedRenderingStyle.LIGHT_YELLOW_ID,IPredefinedRenderingStyle.LIGHT_GRAY_ID,IPredefinedRenderingStyle.COPPER_WHITE_GLOSS_ID,IPredefinedRenderingStyle.SILVER_WHITE_GLOSS_ID. A Gradient definition for a shape can be set as a rendering style withIGaService.setRenderingStyle(AbstractStyle, AdaptedGradientColoredAreas). TheAdaptedGradientColoredAreasgradient definitions are retrieved by getter methods defined here, likegetBlueWhiteGlossAdaptions(). Clients may create their own gradient definition by overridingPredefinedColoredAreasfor gradient definitions andIPredefinedRenderingStylefor corresponding ID's. Simply follow straightforward the examplegetBlueWhiteGlossAdaptions(). It is recommended to support at leastIPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED,IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTEDas visual states.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.graphiti.util.IPredefinedRenderingStyle
BLUE_WHITE_GLOSS_ID, BLUE_WHITE_ID, COPPER_WHITE_GLOSS_ID, LIGHT_GRAY_ID, LIGHT_YELLOW_ID, SILVER_WHITE_GLOSS_ID, STYLE_ADAPTATION_ACTION_ALLOWED, STYLE_ADAPTATION_ACTION_FORBIDDEN, STYLE_ADAPTATION_DEFAULT, STYLE_ADAPTATION_PRIMARY_SELECTED, STYLE_ADAPTATION_SECONDARY_SELECTED
-
-
Constructor Summary
Constructors Constructor Description PredefinedColoredAreas()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidaddGradientColoredArea(org.eclipse.emf.common.util.EList<GradientColoredArea> gcas, java.lang.String colorStart, int locationValueStart, LocationType locationTypeStart, java.lang.String colorEnd, int locationValueEnd, LocationType locationTypeEnd)protected static GradientColoredAreacreateGradientColoredArea(java.lang.String colorStart, int locationValueStart, LocationType locationTypeStart, java.lang.String colorEnd, int locationValueEnd, LocationType locationTypeEnd)static AdaptedGradientColoredAreasgetAdaptedGradientColoredAreas(java.lang.String id)GetAdaptedGradientColoredAreasby id.static AdaptedGradientColoredAreasgetBlueWhiteAdaptions()static AdaptedGradientColoredAreasgetBlueWhiteGlossAdaptions()static AdaptedGradientColoredAreasgetCopperWhiteGlossAdaptions()static AdaptedGradientColoredAreasgetLightGrayAdaptions()static AdaptedGradientColoredAreasgetLightYellowAdaptions()static intgetLocation(GradientColoredLocation gradientColoredLocation, int length, double zoom)Returns the location for the given length and zoom-factor.static AdaptedGradientColoredAreasgetSilverWhiteGlossAdaptions()
-
-
-
Method Detail
-
getBlueWhiteGlossAdaptions
public static AdaptedGradientColoredAreas getBlueWhiteGlossAdaptions()
- Returns:
AdaptedGradientColoredAreascolor-areas forIPredefinedRenderingStyle.BLUE_WHITE_GLOSS_IDwith the adaptations:IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED,IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED,IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_ALLOWED,IPredefinedRenderingStyle.STYLE_ADAPTATION_ACTION_FORBIDDEN.
-
getBlueWhiteAdaptions
public static AdaptedGradientColoredAreas getBlueWhiteAdaptions()
-
getLightYellowAdaptions
public static AdaptedGradientColoredAreas getLightYellowAdaptions()
-
getLightGrayAdaptions
public static AdaptedGradientColoredAreas getLightGrayAdaptions()
- Returns:
AdaptedGradientColoredAreascolor-areas forIPredefinedRenderingStyle.LIGHT_GRAY_IDwith the adaptations:IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT,IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED.
-
getCopperWhiteGlossAdaptions
public static AdaptedGradientColoredAreas getCopperWhiteGlossAdaptions()
- Returns:
AdaptedGradientColoredAreascolor-areas forIPredefinedRenderingStyle.COPPER_WHITE_GLOSS_IDwith the adaptationIPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT.
-
getSilverWhiteGlossAdaptions
public static AdaptedGradientColoredAreas getSilverWhiteGlossAdaptions()
- Returns:
AdaptedGradientColoredAreascolor-areas forIPredefinedRenderingStyle.SILVER_WHITE_GLOSS_IDwith the adaptationIPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT.
-
getAdaptedGradientColoredAreas
public static AdaptedGradientColoredAreas getAdaptedGradientColoredAreas(java.lang.String id)
GetAdaptedGradientColoredAreasby id. The id should be defined inIPredefinedRenderingStyleor in an extension. This is a helper method for tests etc. Please use methods likegetBlueWhiteGlossAdaptions()to set the rendering style withIGaService.setRenderingStyle(AbstractStyle, AdaptedGradientColoredAreas). Clients should override this method, if they have own gradient definitions and id's.- Parameters:
id- The id which designates a correspondingAdaptedGradientColoredAreasobject.- Returns:
- the corresponding
AdaptedGradientColoredAreasobject or null, if id is not defined.
-
addGradientColoredArea
protected static void addGradientColoredArea(org.eclipse.emf.common.util.EList<GradientColoredArea> gcas, java.lang.String colorStart, int locationValueStart, LocationType locationTypeStart, java.lang.String colorEnd, int locationValueEnd, LocationType locationTypeEnd)
-
createGradientColoredArea
protected static GradientColoredArea createGradientColoredArea(java.lang.String colorStart, int locationValueStart, LocationType locationTypeStart, java.lang.String colorEnd, int locationValueEnd, LocationType locationTypeEnd)
- Since:
- 0.10
-
getLocation
public static int getLocation(GradientColoredLocation gradientColoredLocation, int length, double zoom)
Returns the location for the given length and zoom-factor. The location is calculated from the location-value and location-type in relation to the given length and zoom-factor.The idea is, that the location-type specifies how to interpret the location-value in relation to the length. For example if the location-type is "relative" and the location-value is "40", then this means, that the location is at 40% of the length. So for a length of 200 the location would be 80.
- Parameters:
length- The length, for which to calculate the location.zoom- The zoom-factor, which to use on the location-value.- Returns:
- The location for the given length and zoom-factor.
-
-