How to change Time in DateCellEditor Cell [message #1730200] |
Fri, 22 April 2016 09:40 |
Rashmi Tr Messages: 22 Registered: November 2011 |
Junior Member |
|
|
In my Date Cell I have format like dd.MM.yyyy HH:mm.
I added DateCellEditor to the cell. When I click on the Cell and without changing it with tab i go the next Cell then the Date was same but the Time was changed to the current Time. To Avoid this I extended DateCellEditor like below:
@Override
public void setEditorValue(java.lang.Object value) {
if (value instanceof Calendar) {
Calendar cal = (Calendar) value;
DateTime dateTime = getEditorControl();
dateTime.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
dateTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
}
}
@Override
public Object getEditorValue() {
DateTime dateTime = getEditorControl();
Calendar cal = Calendar.getInstance();
cal.set(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay(), dateTime.getHours(), dateTime.getMinutes(),
dateTime.getSeconds());
return cal;
}
Then the time is not changing to the current time it is taking the previous one. Now I am having another Problem. If I change the Date through DateCellEditior the Time is taking the previous one only instead of taking the current Time.
What should I do? where I am doing wrong?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03396 seconds