diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquare.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquare.java deleted file mode 100644 index dca4cd8..0000000 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquare.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.gcube.portlets.user.td.tablewidget.client.geospatial; - -import org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial.CSquareDownscaleResolution; - -/** - * - * @author giancarlo - * email: g.panichi@isti.cnr.it - * - */ -public class DownscaleCSquare { - private int id; - private CSquareDownscaleResolution value; - - public DownscaleCSquare() { - } - - public DownscaleCSquare(int id, CSquareDownscaleResolution value) { - super(); - this.id = id; - this.value = value; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public CSquareDownscaleResolution getValue() { - return value; - } - - public void setValue(CSquareDownscaleResolution value) { - this.value = value; - } - - public String getLabel(){ - return value.getLabel(); - } - - - @Override - public String toString() { - return "DownscaleCSquare [id=" + id + ", value=" + value + "]"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePanel.java index dcce36b..e086f9f 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePanel.java @@ -66,8 +66,8 @@ public class DownscaleCSquarePanel extends FramedPanel implements private ComboBox comboCSquareColumn; private ListStore storeComboCSquare; - private ComboBox comboDownscale; - private ListStore storeComboDownscale; + private ComboBox comboDownscale; + private ListStore storeComboDownscale; private String columnLocalId; public DownscaleCSquarePanel(TRId trId, String columnLocalId, @@ -101,7 +101,7 @@ public class DownscaleCSquarePanel extends FramedPanel implements storeComboDownscale.clear(); - storeComboDownscale.addAll(DownscaleCSquareStore.getStoreDownscaleCSquare()); + storeComboDownscale.addAll(ResolutionStore.getStoreCSquareResolution()); storeComboDownscale.commitChanges(); comboDownscale.reset(); comboDownscale.clear(); @@ -141,18 +141,18 @@ public class DownscaleCSquarePanel extends FramedPanel implements comboCSquareColumn.setTriggerAction(TriggerAction.ALL); // Downscale combo - DownscaleCSquarePropertiesCombo propsDownscale = GWT - .create(DownscaleCSquarePropertiesCombo.class); + ResolutionPropertiesCombo propsDownscale = GWT + .create(ResolutionPropertiesCombo.class); - storeComboDownscale = new ListStore(propsDownscale.id()); - storeComboDownscale.addAll(DownscaleCSquareStore.getStoreDownscaleCSquare()); + storeComboDownscale = new ListStore(propsDownscale.id()); + storeComboDownscale.addAll(ResolutionStore.getStoreCSquareResolution()); - comboDownscale = new ComboBox(storeComboDownscale, - propsDownscale.label()); + comboDownscale = new ComboBox(storeComboDownscale, + propsDownscale.value()); Log.trace("Combo Downscale created"); - addHandlersForComboDownscale(propsDownscale.label()); + addHandlersForComboDownscale(propsDownscale.value()); comboDownscale.setEmptyText("Select a resolution..."); comboDownscale.setWidth(191); @@ -249,11 +249,11 @@ public class DownscaleCSquarePanel extends FramedPanel implements } private void addHandlersForComboDownscale( - final LabelProvider labelProvider) { - comboDownscale.addSelectionHandler(new SelectionHandler() { + final LabelProvider labelProvider) { + comboDownscale.addSelectionHandler(new SelectionHandler() { @Override - public void onSelection(SelectionEvent event) { + public void onSelection(SelectionEvent event) { Info.display( "Resolution Selected", "You selected " @@ -261,7 +261,7 @@ public class DownscaleCSquarePanel extends FramedPanel implements : labelProvider.getLabel(event .getSelectedItem()) + "!")); Log.debug("Resolution selected: " + event.getSelectedItem()); - DownscaleCSquare resolution = event.getSelectedItem(); + Resolution resolution = event.getSelectedItem(); updatedResolution(resolution); } @@ -270,7 +270,7 @@ public class DownscaleCSquarePanel extends FramedPanel implements } - protected void updatedResolution(DownscaleCSquare resolution) { + protected void updatedResolution(Resolution resolution) { // TODO Auto-generated method stub } @@ -278,10 +278,10 @@ public class DownscaleCSquarePanel extends FramedPanel implements protected void onGeometryCreatePoint() { ColumnData csquareColumn = comboCSquareColumn.getCurrentValue(); if (csquareColumn != null) { - DownscaleCSquare downscale = comboDownscale.getCurrentValue(); + Resolution downscale = comboDownscale.getCurrentValue(); if (downscale != null) { GeospatialDownscaleCSquareSession geospatialDownscaleCSquareSession = new GeospatialDownscaleCSquareSession ( - trId, csquareColumn, downscale.getValue()); + trId, csquareColumn, downscale.getStringValue()); callGeospatialDownscaleCSquare(geospatialDownscaleCSquareSession); } else { diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePropertiesCombo.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePropertiesCombo.java deleted file mode 100644 index 89d8463..0000000 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquarePropertiesCombo.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.gcube.portlets.user.td.tablewidget.client.geospatial; - -import com.google.gwt.editor.client.Editor.Path; -import com.sencha.gxt.data.shared.LabelProvider; -import com.sencha.gxt.data.shared.ModelKeyProvider; -import com.sencha.gxt.data.shared.PropertyAccess; - -/** - * - * @author giancarlo - * email: g.panichi@isti.cnr.it - * - */ -public interface DownscaleCSquarePropertiesCombo extends PropertyAccess { - - @Path("id") - ModelKeyProvider id(); - - LabelProvider label(); - -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquareStore.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquareStore.java deleted file mode 100644 index 03d6ddb..0000000 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/DownscaleCSquareStore.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.gcube.portlets.user.td.tablewidget.client.geospatial; - -import java.io.Serializable; -import java.util.ArrayList; - -import org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial.CSquareDownscaleResolution; - -/** - * - * @author giancarlo - * email: g.panichi@isti.cnr.it - * - */ -public class DownscaleCSquareStore implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 6520001942214730827L; - - private static ArrayList storeDownscaleCSquare; - - - - public static ArrayList getStoreDownscaleCSquare() { - storeDownscaleCSquare=new ArrayList(); - - int i=1; - for(CSquareDownscaleResolution resolution:CSquareDownscaleResolution.getList()){ - DownscaleCSquare downscale=new DownscaleCSquare(i, resolution); - storeDownscaleCSquare.add(downscale); - i++; - } - - return storeDownscaleCSquare; - } - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/Resolution.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/Resolution.java index f70a558..c886bc4 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/Resolution.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/Resolution.java @@ -9,14 +9,16 @@ package org.gcube.portlets.user.td.tablewidget.client.geospatial; public class Resolution { private int id; private Double value; + private String stringValue; public Resolution() { } - public Resolution(int id, Double value) { + public Resolution(int id, Double value, String stringValue) { super(); this.id = id; this.value = value; + this.stringValue=stringValue; } public int getId() { @@ -34,10 +36,21 @@ public class Resolution { public void setValue(Double value) { this.value = value; } + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } @Override public String toString() { - return "Resolution [id=" + id + ", value=" + value + "]"; + return "Resolution [id=" + id + ", value=" + value + ", stringValue=" + + stringValue + "]"; } + + } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/ResolutionStore.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/ResolutionStore.java index 4d86a8b..4539b25 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/ResolutionStore.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/ResolutionStore.java @@ -19,15 +19,15 @@ public class ResolutionStore implements Serializable { private static ArrayList storeCSquareResolution; private static ArrayList storeOcenaAreaResolution; - private static Resolution resolutionCSquare1=new Resolution(1, 0.1d); - private static Resolution resolutionCSquare2=new Resolution(2, 0.5d); - private static Resolution resolutionCSquare3=new Resolution(3, 1.0d); - private static Resolution resolutionCSquare4=new Resolution(4, 5.0d); - private static Resolution resolutionCSquare5=new Resolution(5, 10.0d); + private static Resolution resolutionCSquare1=new Resolution(1, 0.1d,"0.1"); + private static Resolution resolutionCSquare2=new Resolution(2, 0.5d,"0.5"); + private static Resolution resolutionCSquare3=new Resolution(3, 1.0d,"1"); + private static Resolution resolutionCSquare4=new Resolution(4, 5.0d,"5"); + private static Resolution resolutionCSquare5=new Resolution(5, 10.0d,"10"); - private static Resolution resolutionOceanArea1=new Resolution(1, 1.0d); - private static Resolution resolutionOceanArea2=new Resolution(2, 5.0d); - private static Resolution resolutionOceanArea3=new Resolution(3, 10.0d); + private static Resolution resolutionOceanArea1=new Resolution(1, 1.0d,"1"); + private static Resolution resolutionOceanArea2=new Resolution(2, 5.0d,"5"); + private static Resolution resolutionOceanArea3=new Resolution(3, 10.0d,"10"); public static ArrayList getStoreCSquareResolution() { storeCSquareResolution=new ArrayList();