Fixed Date support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@95642 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-13 15:33:14 +00:00
parent ae1528cbc1
commit 54e4d2bb40
5 changed files with 352 additions and 21 deletions

View File

@ -3098,3 +3098,259 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
30% complete (ETR: 12 seconds)
40% complete (ETR: 9 seconds)
50% complete (ETR: 7 seconds)
60% complete (ETR: 5 seconds)
70% complete (ETR: 4 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 14.07 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
10% complete (ETR: 20 seconds)
10% complete (ETR: 20 seconds)
20% complete (ETR: 20 seconds)
30% complete (ETR: 15 seconds)
40% complete (ETR: 11 seconds)
50% complete (ETR: 8 seconds)
60% complete (ETR: 6 seconds)
70% complete (ETR: 4 seconds)
80% complete (ETR: 3 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 17.02 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
70% complete (ETR: 2 seconds)
80% complete (ETR: 1 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 9.01 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
40% complete (ETR: 6 seconds)
50% complete (ETR: 5 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 16.10 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
20% complete (ETR: 13 seconds)
30% complete (ETR: 12 seconds)
40% complete (ETR: 9 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 14.87 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.01 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
40% complete (ETR: 9 seconds)
50% complete (ETR: 7 seconds)
60% complete (ETR: 5 seconds)
70% complete (ETR: 4 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 17.46 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
40% complete (ETR: 8 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 19.66 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
20% complete (ETR: 18 seconds)
20% complete (ETR: 18 seconds)
20% complete (ETR: 18 seconds)
30% complete (ETR: 14 seconds)
40% complete (ETR: 11 seconds)
50% complete (ETR: 8 seconds)
60% complete (ETR: 6 seconds)
70% complete (ETR: 5 seconds)
80% complete (ETR: 3 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 17.76 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -1,6 +1,8 @@
package org.gcube.portlets.user.td.columnwidget.client.batch; package org.gcube.portlets.user.td.columnwidget.client.batch;
import java.sql.Date;
import java.util.Date;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
@ -9,6 +11,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
@ -149,7 +152,15 @@ public class SingleValueReplacePanel extends FramedPanel {
checked = b.toString(); checked = b.toString();
} else { } else {
if (column.getDataTypeName().compareTo("Date") == 0) { if (column.getDataTypeName().compareTo("Date") == 0) {
Date d = Date.valueOf(rValue); DateTimeFormat sdf= DateTimeFormat.getFormat("yyyy-MM-dd");
Date d = null;
try {
d = sdf.parse(rValue);
} catch (Exception e) {
Log.error("Unparseable using " + sdf);
return null;
}
if (d != null) { if (d != null) {
checked = rValue; checked = rValue;
} }

View File

@ -38,6 +38,11 @@ import com.sencha.gxt.widget.core.client.form.ComboBox;
import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.info.Info; import com.sencha.gxt.widget.core.client.info.Info;
/**
*
* @author "Giancarlo Panichi"
*
*/
public class ConnectCodelistDialog extends Window implements public class ConnectCodelistDialog extends Window implements
CodelistSelectionListener { CodelistSelectionListener {
protected String WIDTH = "500px"; protected String WIDTH = "500px";

View File

@ -27,6 +27,11 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.info.Info; import com.sencha.gxt.widget.core.client.info.Info;
/**
*
* @author "Giancarlo Panichi"
*
*/
public class DimensionRowSelectionDialog extends Window { public class DimensionRowSelectionDialog extends Window {
protected static final int WIDTH = 550; protected static final int WIDTH = 550;
protected static final int HEIGHT = 520; protected static final int HEIGHT = 520;

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.td.columnwidget.client.replace; package org.gcube.portlets.user.td.columnwidget.client.replace;
import java.sql.Date;
import java.util.Date;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog; import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener; import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
@ -17,6 +18,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
@ -37,6 +39,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent; import com.sencha.gxt.widget.core.client.event.TriggerClickEvent;
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler; import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.ComboBox;
import com.sencha.gxt.widget.core.client.form.DateField;
import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.form.TextField;
@ -56,6 +59,7 @@ public class ReplacePanel extends FramedPanel implements
protected ReplaceDialog parent; protected ReplaceDialog parent;
protected ColumnData column; protected ColumnData column;
protected DimensionRow dimensionRow; protected DimensionRow dimensionRow;
protected ReplaceColumnSession replaceColumnSession; protected ReplaceColumnSession replaceColumnSession;
@ -63,7 +67,9 @@ public class ReplacePanel extends FramedPanel implements
private FieldLabel comboDimensionTypeLabel; private FieldLabel comboDimensionTypeLabel;
private TextField value; private TextField value;
private DateField valueDate;
private TextField replaceValue; private TextField replaceValue;
private DateField replaceValueDate;
private TextButton btnApply; private TextButton btnApply;
private TextButton btnClose; private TextButton btnClose;
private boolean isDimension; private boolean isDimension;
@ -117,12 +123,32 @@ public class ReplacePanel extends FramedPanel implements
} }
protected void create() { protected void create() {
value = new TextField(); if(column.getDataTypeName().compareTo("Date") == 0){
value.setValue(cellData.getValue()); valueDate = new DateField();
value.setReadOnly(true); Date d = null;
DateTimeFormat sdf= DateTimeFormat.getFormat("yyyy-MM-dd");
Log.debug("Date value: "+cellData.getValue());
try {
d = sdf.parse(cellData.getValue());
} catch (Exception e) {
Log.error("Unparseable using " + sdf);
}
if(d!=null){
valueDate.setValue(d);
}
valueDate.setReadOnly(true);
replaceValue = new TextField(); replaceValueDate = new DateField();
} else {
value = new TextField();
value.setValue(cellData.getValue());
value.setReadOnly(true);
replaceValue = new TextField();
}
btnApply = new TextButton("Replace"); btnApply = new TextButton("Replace");
btnApply.setIcon(ResourceBundle.INSTANCE.replace()); btnApply.setIcon(ResourceBundle.INSTANCE.replace());
btnApply.setIconAlign(IconAlign.RIGHT); btnApply.setIconAlign(IconAlign.RIGHT);
@ -157,9 +183,15 @@ public class ReplacePanel extends FramedPanel implements
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer v = new VerticalLayoutContainer(); VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1)); if(column.getDataTypeName().compareTo("Date") == 0){
v.add(new FieldLabel(replaceValue, "Replace"), new VerticalLayoutData( v.add(new FieldLabel(valueDate, "Value"), new VerticalLayoutData(1, -1));
v.add(new FieldLabel(replaceValueDate, "Replace"), new VerticalLayoutData(
1, -1));
} else {
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1));
v.add(new FieldLabel(replaceValue, "Replace"), new VerticalLayoutData(
1, -1)); 1, -1));
}
v.add(flowButton, new VerticalLayoutData(-1, 36, v.add(flowButton, new VerticalLayoutData(-1, 36,
new Margins(5, 2, 5, 2))); new Margins(5, 2, 5, 2)));
add(v); add(v);
@ -235,19 +267,34 @@ public class ReplacePanel extends FramedPanel implements
} }
protected void replaceValue() { protected void replaceValue() {
String rValue = replaceValue.getCurrentValue(); String rValue;
if (rValue == null || rValue.isEmpty()) {
UtilsGXT3.alert("Attention", "Insert a valid replace value"); if(column.getDataTypeName().compareTo("Date") == 0){
} else { Date d=replaceValueDate.getCurrentValue();
String checkedValue = checkTypeData(rValue); if(d==null){
if (checkedValue != null && !checkedValue.isEmpty()) { UtilsGXT3.alert("Attention", "Insert a valid replace value");
callReplaceValue(rValue); return;
} else { } else{
UtilsGXT3.alert("Attention", Long data = d.getTime();
"Insert a valid replace value for this column"); rValue = data.toString();
} }
} else {
rValue = replaceValue.getCurrentValue();
if (rValue == null || rValue.isEmpty()) {
UtilsGXT3.alert("Attention", "Insert a valid replace value");
return;
} else {
String checkedValue = checkTypeData(rValue);
if (checkedValue == null || checkedValue.isEmpty()) {
UtilsGXT3.alert("Attention",
"Insert a valid replace value for this column");
return;
}
}
} }
callReplaceValue(rValue);
} }
protected void replaceValueForDimension() { protected void replaceValueForDimension() {
@ -268,7 +315,14 @@ public class ReplacePanel extends FramedPanel implements
checked = b.toString(); checked = b.toString();
} else { } else {
if (column.getDataTypeName().compareTo("Date") == 0) { if (column.getDataTypeName().compareTo("Date") == 0) {
Date d = Date.valueOf(rValue); Date d = null;
DateTimeFormat sdf= DateTimeFormat.getFormat("yyyy-MM-dd");
try {
d = sdf.parse(value.getValue());
} catch (Exception e) {
Log.error("Unparseable using " + sdf);
return null;
}
if (d != null) { if (d != null) {
Long data = d.getTime(); Long data = d.getTime();
checked = data.toString(); checked = data.toString();