To color-code a particular cell in a table, put a BlockPanel in the
cell (and the rest of the content of the cell in the BlockPanel), and
bind the BlockPanel’s (expert Display) CSS Style property value to a
getter in your page bean that returns a css declaration like
“background-color: green;”.
For example, in your page bean you could create the following getter,
which looks up the task search results provider, and gets the value of
the current row’s “taskPriority” property value (or some arbitrary row
property value), and returns a css declaration based on that value:
public String getTaskPriorityStyle() {
ITableContentProvider provider = getTaskSearchProvider();
int taskPriority = provider.getValue(“taskPriority”;
if (taskPriority == 1) {
return “background-color: #fcc;”; // red
} else if (taskPriority == 2) {
return “background-color: #ffc;”; // yellow
} else if (taskPriority == 3) {
return “background-color: #cfc;”; // green
}
return “”;
}
You’d bind this to the BlockPanel’s CSS Style property value.
To color-code a particular row in a table, bind the table’s (expert
Display) Custom Row CSS Class property value to a getter in your page
bean that returns a css class name; define those custom class names in a
custom .css file your create somewhere within the WebContent directory
of the project; and include that .css file onto the page via an (Output
category) Include Stylesheet control.}
For example, in your page bean you could create the following getter,
which looks up the task search results provider, and gets the value of
the current row’s “taskPriority” property value (or some arbitrary row
property value), and returns a css class name (that you invent) based on
that value:
public String getTaskPriorityClass() {
ITableContentProvider provider = getTaskSearchProvider();
int taskPriority = provider.getValue(“taskPriority”;
if (taskPriority == 1) {
return “priority-high”;
} else if (taskPriority == 2) {
return “priority-medium”;
} else if (taskPriority == 3) {
return “priority-low”;
}
return “”;
}
You’d bind this to the table’s Custom Row CSS Class property value.
Then, you’d create a custom .css file, say
“/WebContent/MyTaskInboxResults/custom.css”, and declare some css rules
that style those classes:
…priority-high {
background-color: #fcc; /* red /
}
…priority-medium {
background-color: #ffc; / yellow /
}
…priority-low {
background-color: #cfc; / green */
}
Finally, you’d include that file onto the page with an IncludeStylesheet
control which has its value property set to
“/WebContent/MyTaskInboxResults/custom.css”.