
Changing look of header cell for current day
I want to change the text color and background color of the upper header for the multiple days, one-day per column configuration variant of the DateArea control.
I'm using the DataAreaBean approach (without a visual interface, but handwritten configuration).
I have derived form GridCellDecorator and added this new decorator (with layer 50) to the header. In paintCell I get the date of the cell via
Code:
Calendar cellDate = grid.getTrackedGrid().getDateRangeForCell(r, c).getStart();
and check the date against the current day. In the case that we have to draw the header cell for the current day I can now paint my own background via
Code:
setColor(...); fillRect(...)
(likely overwriting the default header background). I'm sure that I can also draw text using the text color I want, however I assume that I have to implement all the header magic like using the best fitting header label on my own - which of course I would like to avoid. It seems like Decorator in this case is OK for additional drawing below or above existing drawings, but not for modifying existing drawing code.
Is there another way to link into rendering of headers and changing colors without loosing above functionality of the existing rendeirng/layouting code?