|Title|Table Decorators
|Date|14-Jun-2006 17:44:48 EEST
|JSPWiki version|2.4.x
|Submitter|Nascif Abousalh-Neto
|[Idea Category]|MarkupIdea
|Reference|
|[Idea Status]|NewIdea

The idea is to mix the functionality of BrushedTemplateZebraTables and BrushedTemplateGraphBars, to create markup that wraps around a table to "decorate" all the cells in a given column or columns. The columns could be specified by name or index.

You can use use BrushedTemplateGraphBars for that, but it has the inconvenient that you have to add the markup to every cell in the column to be decorated. 

Keeping the cells as "pure" data has the advantage of being able to use plugins to generate them (e.g. InsertPage, InsertAttachment) while deciding on how to present them on the current page. It separates the concerns of data and presentation.

Besides the above mentioned BrushedTemplateGraphBar (number -> vertical bar) we could also have:

|| Decorator || Arguments || Description
| ageBar | | Like the BrushedTemplateGraphBar, but provides a graphic display for the difference between the date in the cell and the current date. Could use different colors for dates in the future (e.g. deadlines) and dates in the past (e.g. age of a defect or task)
| percentageBar | | Similar to the ProgressBarPlugin. Cell value is taken as a percentage value, the decoration shows two concatenated bars, one green (percentage completed) and one red (remaining percentage)
| iconMap | <page> | assumes the page contains image attachments and that the cell value is the name of an attachment. Generates an image like [page/cellValue.png]
| gauge | <colors, thresholds | maps the value to a color based on the given thresholds. Great for project managers. For example, if the number is a percentage of your project completion, we would have: > 80 green, 20 - 80 yellow, <20 red
| translator | <translation table or function> | maps values, say capitalize the data, or converts numbers to strings: 0->High, 1->Medium, 2->Low.

Example:
{{{

%%DecoratedTable-ageBar:Created;percentageBar:Completed;iconMap(StatusTablePage):Status

|| Task || Owner || Created || Completed || Status
| Implement data layer | Nascif | 2006/06/01 | 10% | red
| User Interface | Dirk | 2006/05/12 | 100% | green
| Wiki engine | Janne | 2006/04/01 | 75% | yellow
%%

}}}