Fixed Downscale

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@113533 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-09 18:01:59 +00:00 committed by Giancarlo Panichi
parent 373842e983
commit a31f629556
6 changed files with 40 additions and 137 deletions

View File

@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
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 + "]";
}
}

View File

@ -66,8 +66,8 @@ public class DownscaleCSquarePanel extends FramedPanel implements
private ComboBox<ColumnData> comboCSquareColumn;
private ListStore<ColumnData> storeComboCSquare;
private ComboBox<DownscaleCSquare> comboDownscale;
private ListStore<DownscaleCSquare> storeComboDownscale;
private ComboBox<Resolution> comboDownscale;
private ListStore<Resolution> 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<DownscaleCSquare>(propsDownscale.id());
storeComboDownscale.addAll(DownscaleCSquareStore.getStoreDownscaleCSquare());
storeComboDownscale = new ListStore<Resolution>(propsDownscale.id());
storeComboDownscale.addAll(ResolutionStore.getStoreCSquareResolution());
comboDownscale = new ComboBox<DownscaleCSquare>(storeComboDownscale,
propsDownscale.label());
comboDownscale = new ComboBox<Resolution>(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<DownscaleCSquare> labelProvider) {
comboDownscale.addSelectionHandler(new SelectionHandler<DownscaleCSquare>() {
final LabelProvider<Resolution> labelProvider) {
comboDownscale.addSelectionHandler(new SelectionHandler<Resolution>() {
@Override
public void onSelection(SelectionEvent<DownscaleCSquare> event) {
public void onSelection(SelectionEvent<Resolution> 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 {

View File

@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface DownscaleCSquarePropertiesCombo extends PropertyAccess<DownscaleCSquare> {
@Path("id")
ModelKeyProvider<DownscaleCSquare> id();
LabelProvider<DownscaleCSquare> label();
}

View File

@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DownscaleCSquareStore implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6520001942214730827L;
private static ArrayList<DownscaleCSquare> storeDownscaleCSquare;
public static ArrayList<DownscaleCSquare> getStoreDownscaleCSquare() {
storeDownscaleCSquare=new ArrayList<DownscaleCSquare>();
int i=1;
for(CSquareDownscaleResolution resolution:CSquareDownscaleResolution.getList()){
DownscaleCSquare downscale=new DownscaleCSquare(i, resolution);
storeDownscaleCSquare.add(downscale);
i++;
}
return storeDownscaleCSquare;
}
}

View File

@ -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 + "]";
}
}

View File

@ -19,15 +19,15 @@ public class ResolutionStore implements Serializable {
private static ArrayList<Resolution> storeCSquareResolution;
private static ArrayList<Resolution> 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<Resolution> getStoreCSquareResolution() {
storeCSquareResolution=new ArrayList<Resolution>();