org.eclipse.graphiti.util
Class PredefinedColoredAreas

java.lang.Object
  extended by 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 with IGaService.setRenderingStyle(AbstractStyle, AdaptedGradientColoredAreas) . The AdaptedGradientColoredAreas gradient definitions are retrieved by getter methods defined here, like getBlueWhiteGlossAdaptions(). Clients may create their own gradient definition by overriding PredefinedColoredAreas for gradient definitions and IPredefinedRenderingStyle for corresponding ID's. Simply follow straightforward the example #getBlueWhiteGlossAdaptions(). It is recommended to support at least {@link #STYLE_ADAPTATION_DEFAULT}, {@link #STYLE_ADAPTATION_PRIMARY_SELECTED}, {@link #STYLE_ADAPTATION_SECONDARY_SELECTED} as visual states.

See Also:
IGaService.setRenderingStyle(AbstractStyle, AdaptedGradientColoredAreas), IPredefinedRenderingStyle, IGradientType

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
PredefinedColoredAreas()
           
 
Method Summary
protected static void addGradientColoredArea( gcas, java.lang.String colorStart, int locationValueStart, LocationType locationTypeStart, java.lang.String colorEnd, int locationValueEnd, LocationType locationTypeEnd)
           
static AdaptedGradientColoredAreas getAdaptedGradientColoredAreas(java.lang.String id)
          Get AdaptedGradientColoredAreas by id.
static AdaptedGradientColoredAreas getBlueWhiteAdaptions()
           
private static GradientColoredAreas getBlueWhiteDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.
private static GradientColoredAreas getBlueWhiteGlossActionAllowedAreas()
          The color-areas, which are used for elements where an action is allowed with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.
private static GradientColoredAreas getBlueWhiteGlossActionForbiddenAreas()
          The color-areas, which are used for elements where an action is forbidden with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.
static AdaptedGradientColoredAreas getBlueWhiteGlossAdaptions()
           
private static GradientColoredAreas getBlueWhiteGlossDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.
private static GradientColoredAreas getBlueWhiteGlossPrimarySelectedAreas()
          The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.
private static GradientColoredAreas getBlueWhiteGlossSecondarySelectedAreas()
          The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.
private static GradientColoredAreas getBlueWhitePrimarySelectedAreas()
          The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.
private static GradientColoredAreas getBlueWhiteSecondarySelectedAreas()
          The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.
static AdaptedGradientColoredAreas getCopperWhiteGlossAdaptions()
           
private static GradientColoredAreas getCopperWhiteGlossDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.COPPER_WHITE_GLOSS_ID.
static AdaptedGradientColoredAreas getLightGrayAdaptions()
           
private static GradientColoredAreas getLightGrayDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.
private static GradientColoredAreas getLightGrayPrimarySelectedAreas()
          The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.
private static GradientColoredAreas getLightGraySecondarySelectedAreas()
          The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.
static AdaptedGradientColoredAreas getLightYellowAdaptions()
           
private static GradientColoredAreas getLightYellowDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.
private static GradientColoredAreas getLightYellowPrimarySelectedAreas()
          The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.
private static GradientColoredAreas getLightYellowSecondarySelectedAreas()
          The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.
static int getLocation(GradientColoredLocation gradientColoredLocation, int length, double zoom)
          Returns the location for the given length and zoom-factor.
static AdaptedGradientColoredAreas getSilverWhiteGlossAdaptions()
           
private static GradientColoredAreas getSilverWhiteGlossDefaultAreas()
          The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.SILVER_WHITE_GLOSS_ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredefinedColoredAreas

public PredefinedColoredAreas()
Method Detail

getBlueWhiteGlossDefaultAreas

private static GradientColoredAreas getBlueWhiteGlossDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.


getBlueWhiteGlossPrimarySelectedAreas

private static GradientColoredAreas getBlueWhiteGlossPrimarySelectedAreas()
The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.


getBlueWhiteGlossSecondarySelectedAreas

private static GradientColoredAreas getBlueWhiteGlossSecondarySelectedAreas()
The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.


getBlueWhiteGlossActionAllowedAreas

private static GradientColoredAreas getBlueWhiteGlossActionAllowedAreas()
The color-areas, which are used for elements where an action is allowed with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.


getBlueWhiteGlossActionForbiddenAreas

private static GradientColoredAreas getBlueWhiteGlossActionForbiddenAreas()
The color-areas, which are used for elements where an action is forbidden with the ID IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID.


getBlueWhiteGlossAdaptions

public static AdaptedGradientColoredAreas getBlueWhiteGlossAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.BLUE_WHITE_GLOSS_ID with 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.

getBlueWhiteDefaultAreas

private static GradientColoredAreas getBlueWhiteDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.


getBlueWhitePrimarySelectedAreas

private static GradientColoredAreas getBlueWhitePrimarySelectedAreas()
The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.


getBlueWhiteSecondarySelectedAreas

private static GradientColoredAreas getBlueWhiteSecondarySelectedAreas()
The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.BLUE_WHITE_ID.


getBlueWhiteAdaptions

public static AdaptedGradientColoredAreas getBlueWhiteAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.BLUE_WHITE_ID with the adaptations: IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT, IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED, IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED.

getLightYellowDefaultAreas

private static GradientColoredAreas getLightYellowDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.


getLightYellowPrimarySelectedAreas

private static GradientColoredAreas getLightYellowPrimarySelectedAreas()
The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.


getLightYellowSecondarySelectedAreas

private static GradientColoredAreas getLightYellowSecondarySelectedAreas()
The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.LIGHT_YELLOW_ID.


getLightYellowAdaptions

public static AdaptedGradientColoredAreas getLightYellowAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.LIGHT_YELLOW_ID with the adaptations: IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT, IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED, IPredefinedRenderingStyle.STYLE_ADAPTATION_SECONDARY_SELECTED.

getLightGrayDefaultAreas

private static GradientColoredAreas getLightGrayDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.


getLightGrayPrimarySelectedAreas

private static GradientColoredAreas getLightGrayPrimarySelectedAreas()
The color-areas, which are used for primary selected elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.


getLightGraySecondarySelectedAreas

private static GradientColoredAreas getLightGraySecondarySelectedAreas()
The color-areas, which are used for secondary selected elements with the ID IPredefinedRenderingStyle.LIGHT_GRAY_ID.


getLightGrayAdaptions

public static AdaptedGradientColoredAreas getLightGrayAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.LIGHT_GRAY_ID with the adaptations: IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT, IPredefinedRenderingStyle.STYLE_ADAPTATION_PRIMARY_SELECTED.

getCopperWhiteGlossDefaultAreas

private static GradientColoredAreas getCopperWhiteGlossDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.COPPER_WHITE_GLOSS_ID.


getCopperWhiteGlossAdaptions

public static AdaptedGradientColoredAreas getCopperWhiteGlossAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.COPPER_WHITE_GLOSS_ID with the adaptation IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT.

getSilverWhiteGlossDefaultAreas

private static GradientColoredAreas getSilverWhiteGlossDefaultAreas()
The color-areas, which are used for default elements with the ID IPredefinedRenderingStyle.SILVER_WHITE_GLOSS_ID.


getSilverWhiteGlossAdaptions

public static AdaptedGradientColoredAreas getSilverWhiteGlossAdaptions()
Returns:
AdaptedGradientColoredAreas color-areas for IPredefinedRenderingStyle.SILVER_WHITE_GLOSS_ID with the adaptation IPredefinedRenderingStyle.STYLE_ADAPTATION_DEFAULT.

getAdaptedGradientColoredAreas

public static AdaptedGradientColoredAreas getAdaptedGradientColoredAreas(java.lang.String id)
Get AdaptedGradientColoredAreas by id. The id should be defined in IPredefinedRenderingStyle or in an extension. This is a helper method for tests etc. Please use methods like getBlueWhiteGlossAdaptions() to set the rendering style with IGaService.setRenderingStyle(AbstractStyle, AdaptedGradientColoredAreas) . Clients should override this method, if they have own gradient definitions and id's.

Parameters:
id - The id which designates a corresponding AdaptedGradientColoredAreas object.
Returns:
the corresponding AdaptedGradientColoredAreas object or null, if id is not defined.

addGradientColoredArea

protected static void addGradientColoredArea( gcas,
                                             java.lang.String colorStart,
                                             int locationValueStart,
                                             LocationType locationTypeStart,
                                             java.lang.String colorEnd,
                                             int locationValueEnd,
                                             LocationType locationTypeEnd)

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.


Copyright (c) SAP AG 2005, 2010.