Added Geospatial Create Coordinates Panel
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@111804 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
63fc1fcc10
commit
d34256a3fc
|
@ -47,18 +47,17 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|||
*/
|
||||
public class ChangeTableTypePanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected TableData table;
|
||||
protected String headingTitle;
|
||||
protected VerticalLayoutContainer vl;
|
||||
protected EventBus eventBus;
|
||||
protected ChangeTableTypeSession changeTableTypeSession;
|
||||
private TRId trId;
|
||||
private TableData table;
|
||||
private VerticalLayoutContainer vl;
|
||||
private EventBus eventBus;
|
||||
private ChangeTableTypeSession changeTableTypeSession;
|
||||
|
||||
protected ComboBox<TableTypeElement> comboTableType;
|
||||
protected TextButton change;
|
||||
private ComboBox<TableTypeElement> comboTableType;
|
||||
private TextButton change;
|
||||
|
||||
public ChangeTableTypePanel(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
|
@ -159,7 +158,7 @@ public class ChangeTableTypePanel extends FramedPanel implements
|
|||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Error Changing The Table Type",
|
||||
"Error in invocation of Change Table Type operation!");
|
||||
"Error in invocation of Change Table Type operation! "+caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,9 +195,9 @@ public class ChangeTableTypePanel extends FramedPanel implements
|
|||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.error("Error retrieving table: "
|
||||
+ caught.getMessage());
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving table",
|
||||
caught.getMessage());
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
public class CloneTabularResource implements MonitorDialogListener {
|
||||
protected TRId trId;
|
||||
protected EventBus eventBus;
|
||||
private TRId trId;
|
||||
private EventBus eventBus;
|
||||
|
||||
protected CloneTabularResourceSession cloneTabularResourceSession;
|
||||
private CloneTabularResourceSession cloneTabularResourceSession;
|
||||
|
||||
public CloneTabularResource(TRId trId, EventBus eventBus) {
|
||||
this.trId = trId;
|
||||
|
@ -54,7 +54,7 @@ public class CloneTabularResource implements MonitorDialogListener {
|
|||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert(
|
||||
"Error Cloning Tabular Resource",
|
||||
"Error in clone operation!");
|
||||
"Error in clone operation! "+caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client.coordinates;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeElement;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeProperties;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeStore;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
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.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;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class GeospatialCreateC_SquarePanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected TableData table;
|
||||
protected String headingTitle;
|
||||
protected VerticalLayoutContainer vl;
|
||||
protected EventBus eventBus;
|
||||
protected ChangeTableTypeSession changeTableTypeSession;
|
||||
|
||||
protected ComboBox<TableTypeElement> comboTableType;
|
||||
protected TextButton change;
|
||||
|
||||
public GeospatialCreateC_SquarePanel(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
forceLayoutOnResize = true;
|
||||
create();
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
|
||||
TableTypeProperties props = GWT.create(TableTypeProperties.class);
|
||||
ListStore<TableTypeElement> storeTableType = new ListStore<TableTypeElement>(
|
||||
props.id());
|
||||
|
||||
storeTableType.addAll(TableTypeStore.getTableTypes());
|
||||
|
||||
Log.trace("Store created");
|
||||
|
||||
comboTableType = new ComboBox<TableTypeElement>(storeTableType,
|
||||
props.label());
|
||||
|
||||
Log.trace("ComboTableType created");
|
||||
|
||||
comboTableType.setEmptyText("Select a Table Type...");
|
||||
comboTableType.setItemId("ComboTableType");
|
||||
comboTableType.setWidth("200px");
|
||||
comboTableType.setEditable(false);
|
||||
comboTableType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
change = new TextButton("Apply");
|
||||
change.setIcon(ResourceBundle.INSTANCE.tableType());
|
||||
change.setIconAlign(IconAlign.RIGHT);
|
||||
change.setTitle("Apply Table Type");
|
||||
|
||||
change.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
onChangeTableType();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vl = new VerticalLayoutContainer();
|
||||
vl.setScrollMode(ScrollMode.AUTO);
|
||||
vl.setAdjustForScroll(true);
|
||||
|
||||
vl.add(new FieldLabel(comboTableType, "Table Type"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
vl.add(change,
|
||||
new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
|
||||
|
||||
add(vl);
|
||||
show();
|
||||
load();
|
||||
|
||||
}
|
||||
|
||||
protected void onChangeTableType() {
|
||||
TableTypeElement tableTypeElement = comboTableType.getCurrentValue();
|
||||
if (tableTypeElement != null) {
|
||||
if (tableTypeElement.getTableType() != null) {
|
||||
changeTableTypeSession = new ChangeTableTypeSession(trId,
|
||||
tableTypeElement.getTableType());
|
||||
callChangeTableType();
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", "Invalid table type!");
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention", "Select a table type!");
|
||||
}
|
||||
}
|
||||
|
||||
private void callChangeTableType() {
|
||||
TDGWTServiceAsync.INSTANCE.startChangeTableType(changeTableTypeSession,
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Change The Table Type Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Error Changing The Table Type",
|
||||
"Error in invocation of Change Table Type operation!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void setCurrentType() {
|
||||
TableTypeElement tElement = TableTypeStore.getTableTypeElement(table
|
||||
.getTypeName());
|
||||
comboTableType.setValue(tElement);
|
||||
|
||||
}
|
||||
|
||||
private void load() {
|
||||
TDGWTServiceAsync.INSTANCE.getTable(trId,
|
||||
new AsyncCallback<TableData>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.error("Error retrieving table: "
|
||||
+ caught.getMessage());
|
||||
UtilsGXT3.alert("Error retrieving table",
|
||||
caught.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(TableData result) {
|
||||
Log.debug("Retrieved table: " + result.toString());
|
||||
table = result;
|
||||
setCurrentType();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void update(TRId trId) {
|
||||
this.trId = trId;
|
||||
load();
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
/*
|
||||
* if (parent != null) { parent.close(); }
|
||||
*/
|
||||
}
|
||||
|
||||
// /
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.addProgressDialogListener(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(OperationResult operationResult) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.CHANGETABLETYPE, operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
UtilsGXT3.alert(reason, details);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.CHANGETABLETYPE, operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,494 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client.geospatial;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.geospatial.GeospatialCoordinatesTypePropertiesCombo;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestPropertiesParameterType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial.GeospatialCoordinatesType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
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.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;
|
||||
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.info.Info;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
private TRId trId;
|
||||
private EventBus eventBus;
|
||||
private GeospatialCoordinatesType gsCoordinatesType;
|
||||
private boolean created;
|
||||
|
||||
private ArrayList<ColumnData> columns;
|
||||
private VerticalLayoutContainer vl;
|
||||
|
||||
private TextButton createCoordinatesButton;
|
||||
private ComboBox<ColumnData> comboLatitude;
|
||||
private ComboBox<ColumnData> comboLongitude;
|
||||
private ComboBox<GeospatialCoordinatesType> comboGsCoordinatesType;
|
||||
private ListStore<ColumnData> storeComboLatitude;
|
||||
private ListStore<ColumnData> storeComboLongitude;
|
||||
|
||||
public GeospatialCreateCoordinatesPanel(TRId trId,
|
||||
RequestProperties requestProperties, EventBus eventBus) {
|
||||
super();
|
||||
this.trId = trId;
|
||||
|
||||
this.gsCoordinatesType = (GeospatialCoordinatesType) requestProperties
|
||||
.getMap().get(
|
||||
RequestPropertiesParameterType.Coordinates);
|
||||
|
||||
this.eventBus = eventBus;
|
||||
this.created = false;
|
||||
forceLayoutOnResize = true;
|
||||
retrieveColumns();
|
||||
|
||||
}
|
||||
|
||||
protected void testCreated() {
|
||||
if (created) {
|
||||
updateCombo();
|
||||
} else {
|
||||
created = true;
|
||||
create();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateCombo() {
|
||||
storeComboLatitude.clear();
|
||||
storeComboLatitude.addAll(columns);
|
||||
storeComboLatitude.commitChanges();
|
||||
comboLatitude.reset();
|
||||
comboLatitude.clear();
|
||||
|
||||
storeComboLongitude.clear();
|
||||
storeComboLongitude.addAll(columns);
|
||||
storeComboLongitude.commitChanges();
|
||||
comboLongitude.reset();
|
||||
comboLongitude.clear();
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
|
||||
Log.debug("Create GeospatialCreateC_SquarePanel(): [" + trId.toString()
|
||||
+ " GeospatialCoordinatesType: " + gsCoordinatesType + "]");
|
||||
|
||||
// Column Propierties
|
||||
ColumnDataPropertiesCombo propsColumnData = GWT
|
||||
.create(ColumnDataPropertiesCombo.class);
|
||||
|
||||
// Latitude
|
||||
storeComboLatitude = new ListStore<ColumnData>(propsColumnData.id());
|
||||
storeComboLatitude.addAll(columns);
|
||||
|
||||
comboLatitude = new ComboBox<ColumnData>(storeComboLatitude,
|
||||
propsColumnData.label());
|
||||
Log.trace("Combo ColumnData created");
|
||||
|
||||
addHandlersForComboColumnLatitude(propsColumnData.label());
|
||||
|
||||
comboLatitude.setEmptyText("Select a column...");
|
||||
comboLatitude.setWidth(191);
|
||||
comboLatitude.setTypeAhead(false);
|
||||
comboLatitude.setEditable(false);
|
||||
comboLatitude.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
// Longitude
|
||||
storeComboLongitude = new ListStore<ColumnData>(propsColumnData.id());
|
||||
storeComboLongitude.addAll(columns);
|
||||
|
||||
comboLongitude = new ComboBox<ColumnData>(storeComboLongitude,
|
||||
propsColumnData.label());
|
||||
Log.trace("Combo ColumnData created");
|
||||
|
||||
addHandlersForComboColumnLongitude(propsColumnData.label());
|
||||
|
||||
comboLongitude.setEmptyText("Select a column...");
|
||||
comboLongitude.setWidth(191);
|
||||
comboLongitude.setTypeAhead(false);
|
||||
comboLongitude.setEditable(false);
|
||||
comboLongitude.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
// Geospatial Column Type
|
||||
GeospatialCoordinatesTypePropertiesCombo propsGeospatialCoordinatesType = GWT
|
||||
.create(GeospatialCoordinatesTypePropertiesCombo.class);
|
||||
|
||||
ListStore<GeospatialCoordinatesType> storeComboGsCoordinatesType = new ListStore<GeospatialCoordinatesType>(
|
||||
propsGeospatialCoordinatesType.id());
|
||||
storeComboGsCoordinatesType.addAll(GeospatialCoordinatesType.getList());
|
||||
|
||||
comboGsCoordinatesType = new ComboBox<GeospatialCoordinatesType>(
|
||||
storeComboGsCoordinatesType,
|
||||
propsGeospatialCoordinatesType.label());
|
||||
Log.trace("Combo ColumnData created");
|
||||
|
||||
addHandlersForComboGsCoordinatesType(propsGeospatialCoordinatesType
|
||||
.label());
|
||||
|
||||
comboGsCoordinatesType.setEmptyText("Select a type...");
|
||||
comboGsCoordinatesType.setWidth(191);
|
||||
comboGsCoordinatesType.setTypeAhead(false);
|
||||
comboGsCoordinatesType.setEditable(false);
|
||||
comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
if (gsCoordinatesType != null) {
|
||||
comboGsCoordinatesType.select(gsCoordinatesType);
|
||||
}
|
||||
|
||||
// Create
|
||||
createCoordinatesButton = new TextButton("Create");
|
||||
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE.tableType());
|
||||
createCoordinatesButton.setIconAlign(IconAlign.RIGHT);
|
||||
createCoordinatesButton.setTitle("Create Geospatial Coordinates");
|
||||
|
||||
createCoordinatesButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
onGeospatialCreateCoordinates();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
vl = new VerticalLayoutContainer();
|
||||
vl.setScrollMode(ScrollMode.AUTO);
|
||||
vl.setAdjustForScroll(true);
|
||||
|
||||
vl.add(new FieldLabel(comboLatitude, "Latitude"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
vl.add(new FieldLabel(comboLongitude, "Longitude"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
vl.add(new FieldLabel(comboGsCoordinatesType, "Type"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
vl.add(createCoordinatesButton, new VerticalLayoutData(-1, -1,
|
||||
new Margins(10, 0, 10, 0)));
|
||||
|
||||
add(vl);
|
||||
show();
|
||||
|
||||
}
|
||||
|
||||
private void addHandlersForComboColumnLatitude(
|
||||
final LabelProvider<ColumnData> labelProvider) {
|
||||
comboLatitude.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"Latitude Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("Latitude selected: " + event.getSelectedItem());
|
||||
ColumnData latitude = event.getSelectedItem();
|
||||
updatedLatitude(latitude);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void updatedLatitude(ColumnData latitude) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void addHandlersForComboColumnLongitude(
|
||||
final LabelProvider<ColumnData> labelProvider) {
|
||||
comboLongitude.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"Longitude Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("Longitude selected: " + event.getSelectedItem());
|
||||
ColumnData longitude = event.getSelectedItem();
|
||||
updatedLongitude(longitude);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void updatedLongitude(ColumnData longitude) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void addHandlersForComboGsCoordinatesType(
|
||||
final LabelProvider<GeospatialCoordinatesType> labelProvider) {
|
||||
comboGsCoordinatesType
|
||||
.addSelectionHandler(new SelectionHandler<GeospatialCoordinatesType>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(
|
||||
SelectionEvent<GeospatialCoordinatesType> event) {
|
||||
Info.display(
|
||||
"Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("Type selected: " + event.getSelectedItem());
|
||||
GeospatialCoordinatesType type = event
|
||||
.getSelectedItem();
|
||||
updatedType(type);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void updatedType(GeospatialCoordinatesType type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
protected void onGeospatialCreateCoordinates() {
|
||||
ColumnData latitude = comboLatitude.getCurrentValue();
|
||||
if (latitude != null) {
|
||||
ColumnData longitude = comboLongitude.getCurrentValue();
|
||||
if (longitude != null) {
|
||||
GeospatialCoordinatesType type = comboGsCoordinatesType
|
||||
.getCurrentValue();
|
||||
if (type != null) {
|
||||
GeospatialCreateCoordinatesSession gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
|
||||
trId, latitude, longitude, type);
|
||||
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Invalid Geospatial Coordinates Type!");
|
||||
}
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention", "Select Longitude!");
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention", "Select Latitude!");
|
||||
}
|
||||
}
|
||||
|
||||
private void callGeospatialCreateCoordinates(
|
||||
GeospatialCreateCoordinatesSession gsCreateCoordinatesSession) {
|
||||
TDGWTServiceAsync.INSTANCE.startGeospatialCreateCoordinates(
|
||||
gsCreateCoordinatesSession, new AsyncCallback<String>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Create Geospatial Coordinates Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Error Creating Geospatial Coordinates",
|
||||
"Error creating geospatial coordinates: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(String taskId) {
|
||||
openMonitorDialog(taskId);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void retrieveColumns() {
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.error("load combo failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving columns of tabular resource:"
|
||||
+ trId.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<ColumnData> result) {
|
||||
Log.trace("loaded " + result.size() + " ColumnData");
|
||||
columns = new ArrayList<ColumnData>();
|
||||
|
||||
for (ColumnData column : result) {
|
||||
ColumnDataType columnDataType = ColumnDataType
|
||||
.getColumnDataTypeFromId(column
|
||||
.getDataTypeName());
|
||||
if (columnDataType
|
||||
.compareTo(ColumnDataType.Integer) == 0
|
||||
|| columnDataType
|
||||
.compareTo(ColumnDataType.Numeric) == 0) {
|
||||
columns.add(column);
|
||||
}
|
||||
|
||||
}
|
||||
if (columns.size() < 1) {
|
||||
Log.debug("Attention no Integer or Numeric column is present in the tabular resource");
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"No Integer or Numeric column is present in the tabular resource!");
|
||||
}
|
||||
testCreated();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void update(TRId trId) {
|
||||
this.trId = trId;
|
||||
retrieveColumns();
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
/*
|
||||
* if (parent != null) { parent.close(); }
|
||||
*/
|
||||
}
|
||||
|
||||
// /
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.addProgressDialogListener(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(OperationResult operationResult) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.GEOSPATIALCREATECOORDINATES,
|
||||
operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
UtilsGXT3.alert(reason, details);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult,
|
||||
String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.GEOSPATIALCREATECOORDINATES,
|
||||
operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -5,8 +5,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
|
@ -32,7 +30,9 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredTy
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestPropertiesParameterType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.OperationsId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
|
@ -375,12 +375,13 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
WidgetRequestEvent widgetRequestEvent = new WidgetRequestEvent(
|
||||
WidgetRequestType.CURATIONBYREPLACEBATCHDIALOG);
|
||||
widgetRequestEvent.setTrId(trId);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(Constants.REQUEST_PROPERTIES_INVOCATIONS,
|
||||
HashMap<RequestPropertiesParameterType, Object> map = new HashMap<RequestPropertiesParameterType, Object>();
|
||||
map.put(RequestPropertiesParameterType.InvocationS
|
||||
,
|
||||
invocationS);
|
||||
map.put(Constants.REQUEST_PROPERTIES_CONDITIONCODE,
|
||||
map.put(RequestPropertiesParameterType.ConditionCode,
|
||||
v.getConditionCode());
|
||||
map.put(Constants.REQUEST_PROPERTIES_VALIDATIONCOLUMNCOLUMNID,
|
||||
map.put(RequestPropertiesParameterType.ValidationColumnColumnId,
|
||||
v.getValidationColumnColumnId());
|
||||
|
||||
RequestProperties props = new RequestProperties(
|
||||
|
|
Loading…
Reference in New Issue