Problem using DateCellEditor [message #1701736] |
Wed, 15 July 2015 05:52  |
Eclipse User |
|
|
|
Hi,
I am trying to show a date editor in one of the columns in my NAT UI.
I have included the following in my code :
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
new DateCellEditor(),DisplayMode.EDIT, DATE_LABEL);
On clicking that particular cell, i get a calendar instance to choose a date from.
I can easily choose different dates from it. But the moment i shift to any other cell, the date cell value becomes empty.
i have a check in setDataValue() :
if (userValue == null)
super.setDataValue(columnIndex, rowIndex, "");
else
super.setDataValue(columnIndex, rowIndex, userValue.toString());
I am not sure why the userValue is null always in this case.
Am i missing anything here?
Attached are 2 screenshots for the same.
How can i set this selected date in the date column?
|
|
|
|
Re: Problem using DateCellEditor [message #1701832 is a reply to message #1701745] |
Thu, 16 July 2015 02:06   |
Eclipse User |
|
|
|
Hello Dirk,
I am already using a DefaultDateDisplayConverter.
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultDateDisplayConverter(),DisplayMode.NORMAL,
DATE_LABEL);
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
new DefaultDateDisplayConverter(),DisplayMode.EDIT,
DATE_LABEL);
But it displays message : Cannot format given Object as a Date at org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter canonicalToDisplayValue.
if i double click a particular cell to edit and enter nothing , the pointer gets stuck in that cell when i try to shift to another cell. For this I am overriding the setDataValue to check for blank data
if (userEnteredValue == null)
super.setDataValue(columnIndex, rowIndex, "");
else
super.setDataValue(columnIndex, rowIndex, userEnteredValue.toString());
I am not sure what is missing.
On digging more into the code, i see that null value is passed as date to DateCellEditor , I don't know why. As on the UI , I am able to see the selected date.
|
|
|
|
|
Re: Problem using DateCellEditor [message #1701840 is a reply to message #1701839] |
Thu, 16 July 2015 03:15  |
Eclipse User |
|
|
|
Sigh ... for such things converters should be used. But if you like it more to override internal methods to achieve behavior that can be configured, go ahead and loose the ability to update and get bugfixes and new features in the future.
I really don't understand why most of the cases reported here in the forum use overriding in favor of configuration.
|
|
|
Powered by
FUDForum. Page generated in 0.25424 seconds