Speeded up the open

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@93518 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-25 11:53:24 +00:00 committed by Giancarlo Panichi
parent 9b75d7a012
commit eac20f7808
3 changed files with 85 additions and 35 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/tabular-data-open-widget-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/tabular-data-open-widget-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/tabular-data-open-widget-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/tabular-data-open-widget-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -33,5 +33,5 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/tabular-data-open-widget-2.1.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/tabular-data-open-widget-2.0.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -6,6 +6,8 @@ package org.gcube.portlets.user.td.openwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
@ -65,37 +67,7 @@ public class TabResourcesSelectionCard extends WizardCard {
Command sayFinish = new Command() {
public void execute() {
TDGWTServiceAsync.INSTANCE.setTabResource(tdOpenSession
.getSelectedTabResource(),
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox(
"Error", "Error on set TabResource: "
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
// TODO Auto-generated method stub
}
});
d.show();
}
public void onSuccess(Void result) {
getWizardWindow().fireCompleted(tdOpenSession
.getSelectedTabResource().getTrId());
getWizardWindow().close(false);
Log.info("OpenTD Tabular Resource selected :" + tdOpenSession
.getSelectedTabResource());
}
});
retrieveLastTable();
}
};
@ -104,5 +76,81 @@ public class TabResourcesSelectionCard extends WizardCard {
//getWizardWindow().setFinishCommand(sayFinish);
}
protected void retrieveLastTable(){
TDGWTServiceAsync.INSTANCE.getLastTable(tdOpenSession
.getSelectedTabResource().getTrId(), new AsyncCallback<TableData>(){
@Override
public void onFailure(Throwable caught) {
Log.debug("Attention", "This tabular resource does not have a valid table");
AlertMessageBox d = new AlertMessageBox(
"Attention", "This tabular resource does not have a valid table"
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
// TODO Auto-generated method stub
}
});
d.show();
}
@Override
public void onSuccess(TableData result) {
Log.debug("Retrieve last table: "+result);
updateTDOpenSessionInfo(result);
}
});
}
protected void updateTDOpenSessionInfo(TableData table){
TabResource tabResource=tdOpenSession.getSelectedTabResource();
TRId trId=tabResource.getTrId();
trId.setTableId(table.getTrId().getTableId());
trId.setTableType(table.getTrId().getTableType());
tabResource.setTrId(trId);
tdOpenSession.setSelectedTabResource(tabResource);
Log.debug("TdOpenSession: "+tdOpenSession);
setTabularResource();
}
protected void setTabularResource(){
TDGWTServiceAsync.INSTANCE.setTabResource(tdOpenSession
.getSelectedTabResource(),
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox(
"Error", "Error on set TabResource: "
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
// TODO Auto-generated method stub
}
});
d.show();
}
public void onSuccess(Void result) {
getWizardWindow().fireCompleted(tdOpenSession
.getSelectedTabResource().getTrId());
getWizardWindow().close(false);
Log.info("OpenTD Tabular Resource selected :" + tdOpenSession
.getSelectedTabResource());
}
});
}
}

View File

@ -66,7 +66,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements HasSelec
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(properties.name(), 50, "Name");
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(properties.agency(), 50, "Agency");
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(properties.date(), 50, "Date");
protected Grid<TabResource> grid;
protected ResourceBundle res;