Thursday, November 19, 2015

ADF InputColor Component

When you need to pick a color from a popup you can deal with ADF component called af:InputColor.
Use Case
Need coloring a number values according to specific ranges.
Example: 
Numbers between 0 and 50 will be colored with black.
Implementations
Create a table that saves the desired color for each specific range.
Because the InputColor  component needs a value of type Color, create a transient attribute with type java.awt.Color , you will change the type at XML level manually:
When page loads you will need to get a color object, so convert the color string to object of type color.
When you set color object you will need to convert the chose color object to string and set the color string to be saved in the database after commit.

Drag and drop the InputColor component and set it's value to the color object attribute.

The result will looks like this:

No comments:

Post a Comment

java - fill distinct objects in ArrayList

If you have a list that contains some objects that it is considered as duplication when two or three fields of these objects are equal. How ...