Fixed Date support for Cell
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@95632 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9c23a014de
commit
c95d6797ec
|
@ -268,8 +268,15 @@ public class TabularDataXGridPanel extends ContentPanel {
|
||||||
.getCell());
|
.getCell());
|
||||||
DataRowColumnConfig<?> cSelected = (DataRowColumnConfig<?>) colSelected;
|
DataRowColumnConfig<?> cSelected = (DataRowColumnConfig<?>) colSelected;
|
||||||
ColumnDefinition cdSelected = cSelected.getDefinition();
|
ColumnDefinition cdSelected = cSelected.getDefinition();
|
||||||
String cellValue = row.getFieldAsText(cdSelected
|
|
||||||
|
String cellValue;
|
||||||
|
if(cdSelected.getColumnDataType().compareTo("Date")==0){
|
||||||
|
cellValue = row.getFieldAsDate(cdSelected
|
||||||
|
.getColumnLocalId());
|
||||||
|
} else {
|
||||||
|
cellValue = row.getFieldAsText(cdSelected
|
||||||
.getColumnLocalId());
|
.getColumnLocalId());
|
||||||
|
}
|
||||||
|
|
||||||
String columnIdValue = row.getFieldAsText(columnIdSelected
|
String columnIdValue = row.getFieldAsText(columnIdSelected
|
||||||
.getColumnLocalId());
|
.getColumnLocalId());
|
||||||
|
|
|
@ -3,12 +3,15 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.tdwx.client.config;
|
package org.gcube.portlets.user.tdwx.client.config;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.ColumnKey;
|
import org.gcube.portlets.user.tdwx.shared.model.ColumnKey;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||||
|
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
|
@ -54,6 +57,19 @@ public class Row {
|
||||||
return String.valueOf(value);
|
return String.valueOf(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the specified field as text value.
|
||||||
|
* @param fieldId the field id.
|
||||||
|
* @return the text value.
|
||||||
|
*/
|
||||||
|
public String getFieldAsDate(String fieldId)
|
||||||
|
{
|
||||||
|
Date value = (Date)getField(fieldId);
|
||||||
|
DateTimeFormat sdf= DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||||
|
return sdf.format(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the specified field as request value type T.
|
* Returns the specified field as request value type T.
|
||||||
* If a wrong type is specified a {@link ClassCastException} will be throw.
|
* If a wrong type is specified a {@link ClassCastException} will be throw.
|
||||||
|
|
Loading…
Reference in New Issue