Package net.sf.basedb.core
Class Coloring
java.lang.Object
net.sf.basedb.core.Coloring
- All Implemented Interfaces:
AccessControlled
This class keeps coloring information for items which can be colored when values
are displayed in a client application. Color values are calculated by a
ColorGenerator
based on this coloring information and the colors
specified by user settings.- Version:
- 2.0
- Author:
- nicklas
- See Also:
- Last modified
- $Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionColoring()
Create a new independent coloring object.Coloring
(ColoringData data, AccessControlled item) Create Coloring object which links to an existing item. -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkPermission
(Permission permission) Check if the logged in user has the desired permission on the item, otherwise throw an exception.Get the value that represents the maximum value.Get the value that represents the midpoint value.Get the value that represents the minimum value.Get the logged in user's permissions on the item.boolean
hasPermission
(Permission permission) Check if the logged in user has the desired permission on the item.boolean
If we should take the logarithm of values before the color is generated or not.boolean
If this item should be colored or not.void
setLogarithmic
(boolean logarithmic) Specify if we should take the logarithm of values before the color is generated or not.void
setMaxValue
(Float maxValue) Set the value that represents the maximum value.void
setMidValue
(Float midValue) Set the value that represents the midpoint value.void
setMinValue
(Float minValue) Set the value that represents the minimum value.void
setUsingColors
(boolean useColors) Specifiy if colors should be used when displaying values for this item or not.(package private) void
validate()
Check that all values has been specified and that minValue <= midValue >= maxValue.
-
Field Details
-
data
-
item
-
-
Constructor Details
-
Coloring
Coloring(ColoringData data, AccessControlled item) Create Coloring object which links to an existing item.- Parameters:
data
- The coloring dataitem
- The access controlled item
-
Coloring
public Coloring()Create a new independent coloring object.
-
-
Method Details
-
checkPermission
Description copied from interface:AccessControlled
Check if the logged in user has the desired permission on the item, otherwise throw an exception.- Specified by:
checkPermission
in interfaceAccessControlled
- Parameters:
permission
- Permission the user should have.- Throws:
PermissionDeniedException
- If the user doesn't have the requested permission
-
getPermissions
Description copied from interface:AccessControlled
Get the logged in user's permissions on the item.- Specified by:
getPermissions
in interfaceAccessControlled
-
hasPermission
Description copied from interface:AccessControlled
Check if the logged in user has the desired permission on the item.- Specified by:
hasPermission
in interfaceAccessControlled
- Parameters:
permission
- The permission to check if the user has.- Returns:
- TRUE if the user has the permission, FALSE otherwise
-
validate
Check that all values has been specified and that minValue <= midValue >= maxValue.- Throws:
InvalidDataException
-
isUsingColors
public boolean isUsingColors()If this item should be colored or not. If this method returns FALSE, the rest of the properties on this object are ignored.- Returns:
- TRUE if colors should be used, FALSE otherwise
-
setUsingColors
public void setUsingColors(boolean useColors) Specifiy if colors should be used when displaying values for this item or not.- Parameters:
useColors
- TRUE to use colors, FALSE otherwise
-
isLogarithmic
public boolean isLogarithmic()If we should take the logarithm of values before the color is generated or not.- Returns:
- TRUE to calculate the logarithm, FALSE to leave the value as is
-
setLogarithmic
public void setLogarithmic(boolean logarithmic) Specify if we should take the logarithm of values before the color is generated or not.- Parameters:
logarithmic
- TRUE to calculate the logarithm, FALSE to leave the value as is
-
getMinValue
Get the value that represents the minimum value. All values below this will get the same color.- Returns:
- The min value
-
setMinValue
Set the value that represents the minimum value. All values below this will get the same color.- Parameters:
minValue
- Value to set.
-
getMidValue
Get the value that represents the midpoint value.- Returns:
- The midpoint value
-
setMidValue
Set the value that represents the midpoint value.- Parameters:
midValue
- The midpoint value
-
getMaxValue
Get the value that represents the maximum value. All values above this will get the same color.- Returns:
- The max value
-
setMaxValue
Set the value that represents the maximum value. All values above this will get the same color.- Parameters:
maxValue
- The value to set.
-