diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 3d61b10..6da0bc9 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -2118,3 +2118,35 @@ 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: 8 seconds) + 30% complete (ETR: 8 seconds) + 30% complete (ETR: 8 seconds) + 30% complete (ETR: 8 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 17.79 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 diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/replace/ReplacePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/replace/ReplacePanel.java index cf2a94b..17ec55d 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/replace/ReplacePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/replace/ReplacePanel.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.td.columnwidget.client.replace; +import java.util.GregorianCalendar; + import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceColumnProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; @@ -16,11 +18,11 @@ import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.button.TextButton; -import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer; -import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; +import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; @@ -152,11 +154,89 @@ public class ReplacePanel extends FramedPanel { if (rValue == null || rValue.isEmpty()) { UtilsGXT3.alert("Attention", "Insert a valid replace value"); } else { - callReplaceValue(rValue); + String checkedValue = checkTypeData(rValue); + if (checkedValue != null && !checkedValue.isEmpty()) { + callReplaceValue(rValue); + } else { + UtilsGXT3.alert("Attention", "Insert a valid replace value for this column"); + } } } + protected GregorianCalendar convertDate(String date) { + int year, month, day, hour, min, sec; + GregorianCalendar d = null; + switch (date.length()) { + case 10: + year = Integer.parseInt(date.substring(0, 4)); + month = Integer.parseInt(date.substring(5, 7)); + day = Integer.parseInt(date.substring(8, 10)); + d = new GregorianCalendar(year, month, day); + break; + case 16: + year = Integer.parseInt(date.substring(0, 4)); + month = Integer.parseInt(date.substring(5, 7)); + day = Integer.parseInt(date.substring(8, 10)); + hour = Integer.parseInt(date.substring(11, 13)); + min = Integer.parseInt(date.substring(14, 16)); + d = new GregorianCalendar(year, month, day, hour, min); + break; + case 19: + year = Integer.parseInt(date.substring(0, 4)); + month = Integer.parseInt(date.substring(5, 7)); + day = Integer.parseInt(date.substring(8, 10)); + hour = Integer.parseInt(date.substring(11, 13)); + min = Integer.parseInt(date.substring(14, 16)); + sec = Integer.parseInt(date.substring(17, 19)); + d = new GregorianCalendar(year, month, day, hour, min, sec); + break; + } + return d; + + } + + protected String checkTypeData(String rValue) { + String checked = null; + try { + switch (column.getDataTypeName()) { + case "Boolean": + Boolean b = new Boolean(rValue); + checked = b.toString(); + break; + case "Date": + GregorianCalendar d = convertDate(rValue); + if (d != null) { + Long data = d.getTimeInMillis(); + checked = data.toString(); + } + break; + case "Geometry": + checked = rValue; + break; + case "Integer": + Integer in = new Integer(rValue); + checked = in.toString(); + break; + case "Numeric": + Float fl = new Float(rValue); + checked = fl.toString(); + break; + case "Text": + checked = rValue; + break; + default: + break; + } + + } catch (Throwable e) { + Log.debug("Error no valid type data: " + e.getLocalizedMessage()); + } + + return checked; + + } + protected void callReplaceValue(String rValue) { replaceColumnSession = new ReplaceColumnSession( value.getCurrentValue(), rValue, trId, column,