Class Coloring

java.lang.Object
net.sf.basedb.core.Coloring
All Implemented Interfaces:
AccessControlled

public class Coloring
extends Object
implements 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:
ColorGenerator
Last modified
$Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
  • Field Details

  • Constructor Details

    • Coloring

      Coloring​(ColoringData data, AccessControlled item)
      Create Coloring object which links to an existing item.
      Parameters:
      data - The coloring data
      item - The access controlled item
    • Coloring

      public Coloring()
      Create a new independent coloring object.
  • Method Details

    • checkPermission

      public void checkPermission​(Permission permission) throws PermissionDeniedException
      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 interface AccessControlled
      Parameters:
      permission - Permission the user should have.
      Throws:
      PermissionDeniedException - If the user doesn't have the requested permission
    • getPermissions

      public Set<Permission> getPermissions()
      Description copied from interface: AccessControlled
      Get the logged in user's permissions on the item.
      Specified by:
      getPermissions in interface AccessControlled
    • hasPermission

      public boolean hasPermission​(Permission permission)
      Description copied from interface: AccessControlled
      Check if the logged in user has the desired permission on the item.
      Specified by:
      hasPermission in interface AccessControlled
      Parameters:
      permission - The permission to check if the user has.
      Returns:
      TRUE if the user has the permission, FALSE otherwise
    • validate

      void validate() throws InvalidDataException
      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

      public Float getMinValue()
      Get the value that represents the minimum value. All values below this will get the same color.
      Returns:
      The min value
    • setMinValue

      public void setMinValue​(Float minValue)
      Set the value that represents the minimum value. All values below this will get the same color.
      Parameters:
      minValue - Value to set.
    • getMidValue

      public Float getMidValue()
      Get the value that represents the midpoint value.
      Returns:
      The midpoint value
    • setMidValue

      public void setMidValue​(Float midValue)
      Set the value that represents the midpoint value.
      Parameters:
      midValue - The midpoint value
    • getMaxValue

      public Float getMaxValue()
      Get the value that represents the maximum value. All values above this will get the same color.
      Returns:
      The max value
    • setMaxValue

      public void setMaxValue​(Float maxValue)
      Set the value that represents the maximum value. All values above this will get the same color.
      Parameters:
      maxValue - The value to set.