|
|
Re: Support for color selection in a cell ? [message #1067044 is a reply to message #1066749] |
Fri, 05 July 2013 15:08 |
Cedric Moonen Messages: 274 Registered: August 2009 |
Senior Member |
|
|
Hi Dirk,
Thanks for the useful help. I'm almost done with this, this was in fact easier than expected. I am able to show the color dialog on click and I am also able to fill the background color with a custom cell painter.
However, I'm now stuck with a small problem: in the AbstractDialogCellEditor class, the RGB color returned by my editor is converted to a string because of this code:
@Override
public Object getCanonicalValue(IEditErrorHandler conversionErrorHandler) {
Object canonicalValue;
try {
if (this.displayConverter != null) {
//always do the conversion to check for valid entered data
canonicalValue = this.displayConverter.displayToCanonicalValue(
this.layerCell, this.configRegistry, getEditorValue());
} else {
canonicalValue = getEditorValue();
}
//if the conversion succeeded, remove error rendering if exists
conversionErrorHandler.removeError(this);
} catch (ConversionFailedException e) {
// conversion failed
conversionErrorHandler.displayError(this, e);
throw e;
} catch (Exception e) {
// conversion failed
conversionErrorHandler.displayError(this, e);
throw new ConversionFailedException(e.getMessage(), e);
}
return canonicalValue;
}
The displayConverter is a DefaultDisplayConverter. Looking at the code, if this displayConverter would be null, this would solve my problem (the getEditorValue() method returns the RGB object).
I tried to attach a null display converter in my edit configuration but that doesn't work:
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER, null, DisplayMode.EDIT,
COLOR_FIELD_NAME);
How can I correct that ?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03858 seconds