View Full Version : Converter in Grid Cell

28 Jan 2016, 2:57 AM
Hello there,
in our framework we have an untyped model in which all values are represented as Strings. Now I try to create a Grid with custom rendering and editing.

For example a boolean value is represented via true = "true" / false = ! true

To implement editing was easy:

public static class G_BooleanConverter implements Converter<String, Boolean> {

private final String trueString;
private final String falseString;

public G_BooleanConverter() {
this("true", "false");

public G_BooleanConverter(String trueString, String falseString) {
this.trueString = trueString;
this.falseString = falseString;

public String convertFieldValue(Boolean object) {
return (object != null && object) ? trueString : falseString;

public Boolean convertModelValue(String object) {
return object != null && object.equals(trueString);

editing.addEditor(colConfig, new G_BooleanConverter(), new CheckBox());

But how can I tell implement a custom renderer? I'd like to use 'CheckboxCell', but I can not because my ColumnConfig is of type 'ColumnConfig<G_Data, String>'..

Is it possible to use the converter in any kind?

At the moment I implemented a complete new implemention which basically is a copy of 'CheckboxCell' but extends 'ValueBaseInputCell<String>' and takes the converter to convert String to Boolean and vice versa.

The problem is that
- I can't derive from 'CheckboxCell' which means I have to copy all the code
- I'd have to do the same for all other primitive types like Date, Integer, Double.

Is there a better way to solve my problem?

Edit: I just got a mail that there was a reply to this thread which I unfortunately can not see in the thread. Just to make it clear:

I know that i could say 'columnconfig.setCell(...)'. But here is my problem. I only have a ColumnConfig<G_Data, String> which would result in setCell(Cell<String>).

But what I'd like to do is something like setCell(Converter<String,Boolean>, Cell<Boolean>)

Best regards,