diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index f00c2db..8eb3d0e 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -542,3 +542,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... + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 40% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 14.57 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/ChangeColumnTypePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java index 97579c1..6210ef5 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java @@ -70,7 +70,8 @@ public class ChangeColumnTypePanel extends FramedPanel { this.trId = trId; this.columnName = columnName; this.eventBus = eventBus; - + Log.debug("Create ChangeColumnTypePanel(): ["+ trId.toString()+" columnName: "+columnName+"]"); + //Column Data ColumnDataProperties propsColumnData = GWT .create(ColumnDataProperties.class); @@ -338,17 +339,7 @@ public class ChangeColumnTypePanel extends FramedPanel { public void onSuccess(ArrayList result) { Log.trace("loaded " + result.size() + " ColumnData"); - if (columnName != null) { - Log.debug("ColumnName:"+columnName); - for (ColumnData cd : result) { - Log.debug("ColumnData name:"+cd.getName()); - if (cd.getName().compareTo(columnName) == 0) { - comboColumn.setValue(cd); - comboColumnTypeCode.select(ColumnTypeCodeStore - .selected(cd.getTypeCode())); - } - } - } + setComboStatus(result); callback.onSuccess(new ListLoadResultBean( result)); @@ -357,5 +348,43 @@ public class ChangeColumnTypePanel extends FramedPanel { }); } + + protected void setComboStatus(ArrayList result){ + Log.debug("ColumnName:"+columnName); + if (columnName != null) { + for (ColumnData cd : result) { + Log.debug("ColumnData name:"+cd.getName()); + if (cd.getName().compareTo(columnName) == 0) { + updateComboStatus(cd); + } + } + } + } + + protected void updateComboStatus(ColumnData cd){ + Log.debug("ColumnData: "+cd.toString()); + comboColumn.setValue(cd); + comboColumnTypeCode.setValue(ColumnTypeCodeStore.selectedElement(cd.getTypeCode())); + ColumnTypeCode type=ColumnTypeCodeStore.selected(cd.getTypeCode()); + updateColumnType(type); + if (type == ColumnTypeCode.MEASURE) { + comboMeasureType.setValue(ColumnDataTypeStore.selectedMeasureElement(cd.getDataTypeName())); + } else { + if (type == ColumnTypeCode.ATTRIBUTE) { + comboMeasureType.setValue(ColumnDataTypeStore.selectedMeasureElement(cd.getDataTypeName())); + } else { + + } + + } + } + + public void update(TRId trId, String columnName){ + if(this.trId.getId()=trId.) + + this.trId=trId; + this.columnName=columnName; + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeElement.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeElement.java index eaac74d..8f435c8 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeElement.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeElement.java @@ -39,11 +39,13 @@ public class ColumnDataTypeElement { return type.toString(); } + @Override public String toString() { - return "ColumnTypeCode [id=" + id + ", code=" + type + ", getLabel()=" - + getLabel() + "]"; + return "ColumnDataTypeElement [id=" + id + ", type=" + type + "]"; } + + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeStore.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeStore.java index 3b77706..d0d598e 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeStore.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnDataTypeStore.java @@ -19,15 +19,22 @@ public class ColumnDataTypeStore implements Serializable { private static final long serialVersionUID = -1908324094430432681L; protected static ArrayList store; - + + protected static ColumnDataTypeElement integerElement=new ColumnDataTypeElement(1,ColumnDataType.Integer); + protected static ColumnDataTypeElement numericElement=new ColumnDataTypeElement(2,ColumnDataType.Numeric); + protected static ColumnDataTypeElement booleanElement=new ColumnDataTypeElement(3,ColumnDataType.Boolean); + protected static ColumnDataTypeElement geometryElement=new ColumnDataTypeElement(4,ColumnDataType.Geometry); + protected static ColumnDataTypeElement textElement=new ColumnDataTypeElement(5,ColumnDataType.Text); + + public static ArrayList getMeasureType(){ store=new ArrayList(); - store.add(new ColumnDataTypeElement(1,ColumnDataType.Integer)); - store.add(new ColumnDataTypeElement(2,ColumnDataType.Numeric)); + store.add(integerElement); + store.add(numericElement); return store; } - public static int selectedMeasure(String selected){ + public static int selectedMeasurePosition(String selected){ int position=0; if(selected.compareTo(ColumnDataType.Integer.toString())==0){ position=1; @@ -40,18 +47,45 @@ public class ColumnDataTypeStore implements Serializable { return position; } + + public static ColumnDataType selectedMeasure(String selected){ + if(selected.compareTo(ColumnDataType.Integer.toString())==0){ + return ColumnDataType.Integer; + } else { + if(selected.compareTo(ColumnDataType.Numeric.toString())==0){ + return ColumnDataType.Numeric; + } else { + return null; + } + } + } + + public static ColumnDataTypeElement selectedMeasureElement(String selected){ + if(selected.compareTo(ColumnDataType.Integer.toString())==0){ + return integerElement; + } else { + if(selected.compareTo(ColumnDataType.Numeric.toString())==0){ + return numericElement; + } else { + return null; + } + } + } + + + + public static ArrayList getAttributeType(){ store=new ArrayList(); - store.add(new ColumnDataTypeElement(1,ColumnDataType.Integer)); - store.add(new ColumnDataTypeElement(2,ColumnDataType.Numeric)); - store.add(new ColumnDataTypeElement(3,ColumnDataType.Boolean)); - store.add(new ColumnDataTypeElement(4,ColumnDataType.Geometry)); - store.add(new ColumnDataTypeElement(5,ColumnDataType.Text)); - + store.add(integerElement); + store.add(numericElement); + store.add(booleanElement); + store.add(geometryElement); + store.add(textElement); return store; } - public static int selectedAttribute(String selected){ + public static int selectedAttributePosition(String selected){ int position=0; if(selected.compareTo(ColumnDataType.Integer.toString())==0){ position=1; @@ -76,5 +110,52 @@ public class ColumnDataTypeStore implements Serializable { return position; } + public static ColumnDataType selectedAttribute(String selected){ + if(selected.compareTo(ColumnDataType.Integer.toString())==0){ + return ColumnDataType.Integer; + } else { + if(selected.compareTo(ColumnDataType.Numeric.toString())==0){ + return ColumnDataType.Numeric; + } else { + if(selected.compareTo(ColumnDataType.Boolean.toString())==0){ + return ColumnDataType.Boolean; + } else { + if(selected.compareTo(ColumnDataType.Geometry.toString())==0){ + return ColumnDataType.Geometry; + } else { + if(selected.compareTo(ColumnDataType.Text.toString())==0){ + return ColumnDataType.Text; + } else { + return null; + } + } + } + } + } + } + + public static ColumnDataTypeElement selectedAttributeElement(String selected){ + if(selected.compareTo(ColumnDataType.Integer.toString())==0){ + return integerElement; + } else { + if(selected.compareTo(ColumnDataType.Numeric.toString())==0){ + return numericElement; + } else { + if(selected.compareTo(ColumnDataType.Boolean.toString())==0){ + return booleanElement; + } else { + if(selected.compareTo(ColumnDataType.Geometry.toString())==0){ + return geometryElement; + } else { + if(selected.compareTo(ColumnDataType.Text.toString())==0){ + return textElement; + } else { + return null; + } + } + } + } + } + } } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeElement.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeElement.java index 5392de3..6adffa9 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeElement.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeElement.java @@ -39,11 +39,12 @@ public class ColumnTypeCodeElement { return code.getColumnTypeCodeLabel(); } + @Override public String toString() { - return "ColumnTypeCode [id=" + id + ", code=" + code + ", getLabel()=" - + getLabel() + "]"; + return "ColumnTypeCodeElement [id=" + id + ", code=" + code + "]"; } + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeStore.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeStore.java index 53751f1..2f18e05 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeStore.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ColumnTypeCodeStore.java @@ -17,24 +17,35 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeC public class ColumnTypeCodeStore implements Serializable { private static final long serialVersionUID = -1908324094430432681L; - + + protected static ColumnTypeCodeElement annotation=new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION); + protected static ColumnTypeCodeElement attribute=new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE); + protected static ColumnTypeCodeElement measure=new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE); + protected static ColumnTypeCodeElement code=new ColumnTypeCodeElement(4,ColumnTypeCode.CODE); + protected static ColumnTypeCodeElement codeName=new ColumnTypeCodeElement(5,ColumnTypeCode.CODENAME); + protected static ColumnTypeCodeElement codeDescription=new ColumnTypeCodeElement(6,ColumnTypeCode.CODEDESCRIPTION); + protected static ColumnTypeCodeElement dimension=new ColumnTypeCodeElement(7,ColumnTypeCode.DIMENSION); + protected static ColumnTypeCodeElement timeDimension=new ColumnTypeCodeElement(8,ColumnTypeCode.TIMEDIMENSION); + + + + protected static ArrayList store; public static ArrayList getColumnTypeCodes(){ store = new ArrayList(); - store.add(new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION)); - store.add(new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE)); - store.add(new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE)); - store.add(new ColumnTypeCodeElement(4,ColumnTypeCode.CODE)); - store.add(new ColumnTypeCodeElement(5,ColumnTypeCode.CODENAME)); - store.add(new ColumnTypeCodeElement(6,ColumnTypeCode.CODEDESCRIPTION)); - store.add(new ColumnTypeCodeElement(7,ColumnTypeCode.DIMENSION)); - store.add(new ColumnTypeCodeElement(8,ColumnTypeCode.TIMEDIMENSION)); - + store.add(annotation); + store.add(attribute); + store.add(measure); + store.add(code); + store.add(codeName); + store.add(codeDescription); + store.add(dimension); + store.add(timeDimension); return store; } - public static int selected(String selected){ + public static int selectedPosition(String selected){ int position=0; if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){ position=1; @@ -79,4 +90,92 @@ public class ColumnTypeCodeStore implements Serializable { return position; } + public static ColumnTypeCode selected(String selected){ + if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){ + return ColumnTypeCode.ANNOTATION; + } else { + if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){ + return ColumnTypeCode.ATTRIBUTE; + } else { + if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){ + return ColumnTypeCode.MEASURE; + } else { + if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){ + return ColumnTypeCode.CODE; + } else { + if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){ + return ColumnTypeCode.CODENAME; + } else { + if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){ + return ColumnTypeCode.CODEDESCRIPTION; + } else { + if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){ + return ColumnTypeCode.DIMENSION; + } else { + if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){ + return ColumnTypeCode.TIMEDIMENSION; + } else { + return null; + } + + } + + } + + } + + } + + } + + } + + } + } + + public static ColumnTypeCodeElement selectedElement(String selected){ + if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){ + return annotation; + } else { + if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){ + return attribute; + } else { + if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){ + return measure; + } else { + if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){ + return code; + } else { + if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){ + return codeName; + } else { + if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){ + return codeDescription; + } else { + if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){ + return dimension; + } else { + if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){ + return timeDimension; + } else { + return null; + } + + } + + } + + } + + } + + } + + } + + } + } + + + }