Issue 153: Decorate (chain) Cell Editors Easily
Status:  WontFix
Owner:
Closed:  Mar 2011
Project Member Reported by jeff.johnston.mn@gmail.com, Oct 11, 2008
The CellEditors are very easy to decorate, but in the api there is no easy
(or obvious) way to take advantage of that. I would like to exploit that
pattern as much as possible.

Nov 5, 2008
#1 bgo...@e1b.org
It might be worth considering to build support for delegation into the CellEditor
interface (i.e., add a getDelegate() method or something like that).  Implementors of
getValue() could then choose whether or not to utilize the delegate, and how to
handle the case when no delegate is available.  I suspect that even most of the
default cell editors would enjoy increased functionality by being able to delegate
getValue() instead of just using ItemUtils.getProperty().

Another solution might be to have a subinterface of CellEditor called
DecoratedCellEditor or something like that, that adds support for getDelegate() (or
whatever the method name ends up being), and then user code can easily tell whether
or not the editor supports the decorator pattern.
Nov 6, 2008
Project Member #2 jeff.johnston.mn@gmail.com
The most consistent way to handle it would be to have a CellEditorSupport interface
that has getters and setters of a CellEditor. The AbstractCellEditor would implement
this interface, which is what most CellEditor's should be using. The work involved
would be in injecting each CellEditor into the next and in correct order. It would
also have to make sure that the SupportUtils is injecting the classes that are being
requested (as you pointed out).

Its kind of interesting that a CellEditor could have CellEditorSupport but it also
shows how well the decorator pattern works.

Nov 7, 2008
#3 bgo...@e1b.org
Right on... and then you could decorate columns like this:

Utils.decorateCellEditor(column, wrapper);

the code in decorateCellEditor might be something like:

CellEditor original = column.getCellRenderer().getCellEditor();
SupportUtils.setCellEditor(wrapper, original);
column.getCellRenderer().setCellEditor(wrapper);


(just an example, might have bugs!)

Anyhow, placing method(s) like this in the API and/or on the table facade might be
really helpful.

Mar 10, 2011
Project Member #4 jeff.johnston.mn@gmail.com
I still like the idea, but I do not think realistically that I will get to it...
Status: WontFix