Class: ColorAttributeGroupHandler

Oracle® JavaScript Extension Toolkit (JET)
5.0.0

E90577-01

QuickNav

ColorAttributeGroupHandler extends oj.AttributeGroupHandler

Version:
  • 5.0.0
Since:
  • 1.2
Module:
  • ojdvt-base

Constructor

new ColorAttributeGroupHandler(matchRules)

Creates a color attribute group handler that will generate color attribute values.
Parameters:
Name Type Argument Description
matchRules Object.<string, string> <optional>
A map of key value pairs for categories and the matching attribute value e.g. {"soda" : "#336699", "water" : "#CC3300", "iced tea" : "#F7C808"}. Attribute values listed in the matchRules object will be reserved only for the matching categories when getAttributeValue is called. Note that not all colors in the default color ramp will meet minimum contrast requirements for text.

Methods

(static) createAttrDiv() → {jQuery}

Creates an element and appends a div for each style class
Returns:
The jQuery element containing divs for each style class
Type
jQuery

(static) processAttrDiv(attrGpsDiv) → {void}

Processes the colors for each div on the given element
Parameters:
Name Type Description
attrGpsDiv jQuery The jQuery element containing divs for each style class
Returns:
Type
void

addMatchRule(category, attributeValue) → {void}

Reserves an attribute value for the given category. All match rules should be added before any category assignments are done with the getValue API.
Parameters:
Name Type Description
category string Used for checking inputs to getAttributeValue against when assigning an attribute value
attributeValue * The attribute value to assign for inputs matching the given category e.g. "square" or "circle"
Inherited From:
Returns:
Type
void

getCategoryAssignments() → {Array.<Object.<string, *>>}

Returns the current list of assigned categories as an array of objects with "category" and "value" keys. Note that match rules are not reflected in category assignments.
Inherited From:
Returns:
The current list of category and value pairings
Type
Array.<Object.<string, *>>

getValue(category) → {*}

Assigns the given category an attribute value. Will consistently return the same attribute value for equal categories.
Parameters:
Name Type Description
category string The category to assign
Inherited From:
Returns:
The attribute value for the category
Type
*

getValueRamp() → {Array.<string>}

Returns the array of possible color values for this attribute group handler.
Returns:
The array of color values
Type
Array.<string>