Added Resume UI state

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@100397 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-10-02 17:07:33 +00:00
parent 6ac6504e5e
commit 30fa7774fb
4 changed files with 165 additions and 114 deletions

View File

@ -528,3 +528,35 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
10% complete (ETR: 34 seconds)
10% complete (ETR: 34 seconds)
20% complete (ETR: 24 seconds)
30% complete (ETR: 18 seconds)
40% complete (ETR: 13 seconds)
50% complete (ETR: 10 seconds)
60% complete (ETR: 7 seconds)
70% complete (ETR: 5 seconds)
80% complete (ETR: 3 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 31.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

View File

@ -13,6 +13,12 @@
<dependent-module archiveName="tabular-data-json-export-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-json-export-widget/tabular-data-json-export-widget"> <dependent-module archiveName="tabular-data-json-export-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-json-export-widget/tabular-data-json-export-widget">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="tabular-data-information-widget-2.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-information-widget/tabular-data-information-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-metadata-widget-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-metadata-widget/tabular-data-metadata-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/tabular-data-portlet/target/tabular-data-portlet-2.4.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/tabular-data-portlet/target/tabular-data-portlet-2.4.0-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="tabular-data-manager"/> <property name="context-root" value="tabular-data-manager"/>
</wb-module> </wb-module>

View File

@ -185,8 +185,6 @@ public class TabularDataController {
} }
// Bind Controller to events on bus // Bind Controller to events on bus
protected void bindToEvents() { protected void bindToEvents() {
eventBus.addHandler(SessionExpiredEvent.TYPE, eventBus.addHandler(SessionExpiredEvent.TYPE,
@ -263,7 +261,6 @@ public class TabularDataController {
Log.debug("Catch Event WidgetRequestEvent"); Log.debug("Catch Event WidgetRequestEvent");
doWidgetRequestCommand(event); doWidgetRequestCommand(event);
} }
}); });
@ -276,7 +273,6 @@ public class TabularDataController {
Log.debug("Catch Event BackgroundRequestEvent"); Log.debug("Catch Event BackgroundRequestEvent");
doBackgroundRequestCommand(event); doBackgroundRequestCommand(event);
} }
}); });
@ -285,10 +281,32 @@ public class TabularDataController {
} }
protected void putInBackgroundUIState(){ //
public void restoreUISession() {
TDGWTServiceAsync.INSTANCE
.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(TRId trId) {
if(trId!=null){
if(trId.getId()!=null && !trId.getId().isEmpty()){
openTable(trId);
}
}
}
});
}
//
protected void putInBackgroundUIState() {
try { try {
closeTabularResource(); closeTabularResource();
//TODO Open monitor background and change TR
openBackgroundMonitor(); openBackgroundMonitor();
openTabularResource(true); openTabularResource(true);
@ -297,7 +315,6 @@ public class TabularDataController {
} }
} }
// Resume state of user interface // Resume state of user interface
protected void resumeUIState() { protected void resumeUIState() {
try { try {
@ -401,6 +418,7 @@ public class TabularDataController {
} catch (Exception e) { } catch (Exception e) {
Log.debug("Bus Error: " + e.getMessage()); Log.debug("Bus Error: " + e.getMessage());
} }
closeTabularResourceOnServer();
break; break;
case TR_CLOSE: case TR_CLOSE:
break; break;
@ -411,6 +429,23 @@ public class TabularDataController {
} }
protected void closeTabularResourceOnServer() {
TDGWTServiceAsync.INSTANCE
.closeTabularResource(new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
UtilsGXT3.alert("Error closing tabular resource",
caught.getLocalizedMessage());
}
public void onSuccess(Void result) {
}
});
}
protected void deleteTabularResource() { protected void deleteTabularResource() {
final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm", final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm",
@ -643,16 +678,17 @@ public class TabularDataController {
break; break;
} }
} }
//TODO
protected void doWidgetRequestCommand(WidgetRequestEvent event){ // TODO
WidgetRequestType widgetRequestType=event.getWidgetRequestType(); protected void doWidgetRequestCommand(WidgetRequestEvent event) {
switch(widgetRequestType){ WidgetRequestType widgetRequestType = event.getWidgetRequestType();
switch (widgetRequestType) {
case CHANGECOLUMNTYPEPANEL: case CHANGECOLUMNTYPEPANEL:
break; break;
case CHANGETABLETYPEPANEL: case CHANGETABLETYPEPANEL:
break; break;
case CURATIONBYREPLACEBATCHDIALOG: case CURATIONBYREPLACEBATCHDIALOG:
openBatchReplace(event.getTrId(),event.getRequestProperties()); openBatchReplace(event.getTrId(), event.getRequestProperties());
break; break;
case DELETECOLUMNPANEL: case DELETECOLUMNPANEL:
break; break;
@ -667,10 +703,9 @@ public class TabularDataController {
} }
} }
//TODO // TODO
public void doBackgroundRequestCommand(BackgroundRequestEvent event) { public void doBackgroundRequestCommand(BackgroundRequestEvent event) {
BackgroundRequestType type = event.getBackgroundRequestType(); BackgroundRequestType type = event.getBackgroundRequestType();
Log.trace("doBackgroundRequestEvent BackgroundRequestType: " + type); Log.trace("doBackgroundRequestEvent BackgroundRequestType: " + type);
@ -683,20 +718,22 @@ public class TabularDataController {
break; break;
} }
} catch (Throwable e) { } catch (Throwable e) {
Log.error("doBackgroundRequestCommand Error : " + e.getLocalizedMessage()); Log.error("doBackgroundRequestCommand Error : "
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
protected void openLogsWindow() {
protected void openLogsWindow(){
Log.debug("Request Open Logs Window"); Log.debug("Request Open Logs Window");
TDMLogs tdmLogs=new TDMLogs(eventBus); TDMLogs tdmLogs = new TDMLogs(eventBus);
tdmLogs.show(); tdmLogs.show();
} }
protected void openBatchReplace(TRId trId, RequestProperties requestProperties){ protected void openBatchReplace(TRId trId,
Log.debug("Request Open Batch Replace Dialog: "+trId+" "+requestProperties); RequestProperties requestProperties) {
Log.debug("Request Open Batch Replace Dialog: " + trId + " "
+ requestProperties);
if (trId != null) { if (trId != null) {
ReplaceBatchDialog dialog = new ReplaceBatchDialog(trId, ReplaceBatchDialog dialog = new ReplaceBatchDialog(trId,
requestProperties, eventBus); requestProperties, eventBus);
@ -707,7 +744,6 @@ public class TabularDataController {
} }
} }
protected void openSDMXImportWizard() { protected void openSDMXImportWizard() {
GWT.runAsync(new RunAsyncCallback() { GWT.runAsync(new RunAsyncCallback() {
@ -739,7 +775,6 @@ public class TabularDataController {
resumeUIState(); resumeUIState();
} }
}); });
importWizard.show(); importWizard.show();
@ -842,11 +877,6 @@ public class TabularDataController {
} }
protected void openSDMXExportWizard() { protected void openSDMXExportWizard() {
GWT.runAsync(new RunAsyncCallback() { GWT.runAsync(new RunAsyncCallback() {
@ -893,12 +923,12 @@ public class TabularDataController {
public void onSuccess() { public void onSuccess() {
openWizard(); openWizard();
ExtractCodelistWizardTD extractCodelistWizard = new ExtractCodelistWizardTD( ExtractCodelistWizardTD extractCodelistWizard = new ExtractCodelistWizardTD(
trId,"Extract Codelist", eventBus); trId, "Extract Codelist", eventBus);
extractCodelistWizard.addListener(new WizardListener() { extractCodelistWizard.addListener(new WizardListener() {
public void failed(String title, String message, public void failed(String title, String message,
Throwable throwable) { Throwable throwable) {
UtilsGXT3.alert(title,message); UtilsGXT3.alert(title, message);
resumeUIState(); resumeUIState();
} }
@ -927,15 +957,13 @@ public class TabularDataController {
} }
protected void openCodelistMappingWizard() { protected void openCodelistMappingWizard() {
GWT.runAsync(new RunAsyncCallback() { GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() { public void onSuccess() {
openWizard(); openWizard();
CodelistMappingImportWizardTD codelistMappingWizard = new CodelistMappingImportWizardTD( CodelistMappingImportWizardTD codelistMappingWizard = new CodelistMappingImportWizardTD(
trId,"Codelist Mapping Import", eventBus); trId, "Codelist Mapping Import", eventBus);
codelistMappingWizard.addListener(new WizardListener() { codelistMappingWizard.addListener(new WizardListener() {
public void failed(String title, String message, public void failed(String title, String message,
@ -974,8 +1002,8 @@ public class TabularDataController {
public void onSuccess() { public void onSuccess() {
openWizard(); openWizard();
UnionWizardTD unionWizard = new UnionWizardTD( UnionWizardTD unionWizard = new UnionWizardTD(trId, "Union",
trId,"Union", eventBus); eventBus);
unionWizard.addListener(new WizardListener() { unionWizard.addListener(new WizardListener() {
public void failed(String title, String message, public void failed(String title, String message,
@ -994,7 +1022,6 @@ public class TabularDataController {
Log.debug("PutInBakground"); Log.debug("PutInBakground");
} }
public void aborted() { public void aborted() {
resumeUIState(); resumeUIState();
} }
@ -1010,7 +1037,6 @@ public class TabularDataController {
} }
/** /**
* @param switchState * @param switchState
* *
@ -1023,16 +1049,14 @@ public class TabularDataController {
public void onSuccess() { public void onSuccess() {
openWizard(); openWizard();
String title; String title;
if(switchState){ if (switchState) {
title="Switches Tabular Resource"; title = "Switches Tabular Resource";
} else { } else {
title="Open Tabular Resource"; title = "Open Tabular Resource";
} }
TDOpen tdOpen=new TDOpen(trId,title, eventBus); TDOpen tdOpen = new TDOpen(trId, title, eventBus);
tdOpen.addListener(new WizardListener() { tdOpen.addListener(new WizardListener() {
@Override @Override
public void putInBackground() { public void putInBackground() {
Log.debug("PutInBakground"); Log.debug("PutInBakground");
@ -1153,8 +1177,6 @@ public class TabularDataController {
TRShare trShare = new TRShare(trId, eventBus); TRShare trShare = new TRShare(trId, eventBus);
} }
protected void callDiscard() { protected void callDiscard() {
HistoryDiscard historyDiscard = new HistoryDiscard(eventBus); HistoryDiscard historyDiscard = new HistoryDiscard(eventBus);
historyDiscard.discard(); historyDiscard.discard();
@ -1200,8 +1222,8 @@ public class TabularDataController {
protected void openReplaceColumnByExpression(String columnName) { protected void openReplaceColumnByExpression(String columnName) {
Log.debug("Request Open Replace Column By Expression Dialog"); Log.debug("Request Open Replace Column By Expression Dialog");
if (trId != null) { if (trId != null) {
ReplaceColumnByExpressionDialog rceDialog = new ReplaceColumnByExpressionDialog(trId, ReplaceColumnByExpressionDialog rceDialog = new ReplaceColumnByExpressionDialog(
columnName, eventBus); trId, columnName, eventBus);
rceDialog.show(); rceDialog.show();
} else { } else {
Log.error("TRId is null"); Log.error("TRId is null");
@ -1209,7 +1231,6 @@ public class TabularDataController {
} }
} }
protected void openColumnType() { protected void openColumnType() {
openColumnType(null); openColumnType(null);
} }
@ -1264,7 +1285,6 @@ public class TabularDataController {
} }
} }
protected void cloneTabularResource() { protected void cloneTabularResource() {
CloneTabularResource cloneTR = new CloneTabularResource(trId, eventBus); CloneTabularResource cloneTR = new CloneTabularResource(trId, eventBus);
cloneTR.cloneTR(); cloneTR.cloneTR();
@ -1303,7 +1323,6 @@ public class TabularDataController {
} }
} }
protected void openColumnDelete() { protected void openColumnDelete() {
openColumnDelete(null); openColumnDelete(null);
} }
@ -1340,7 +1359,6 @@ public class TabularDataController {
} }
} }
protected void openColumnMerge() { protected void openColumnMerge() {
openColumnMerge(null); openColumnMerge(null);
} }
@ -1359,9 +1377,6 @@ public class TabularDataController {
} }
} }
protected void openGroupBy() { protected void openGroupBy() {
openGroupBy(null); openGroupBy(null);
} }
@ -1427,12 +1442,11 @@ public class TabularDataController {
protected void openBackgroundMonitor() { protected void openBackgroundMonitor() {
Log.debug("Request Open Monitor Background Tab"); Log.debug("Request Open Monitor Background Tab");
WidgetRequestEvent e = new WidgetRequestEvent( WidgetRequestEvent e = new WidgetRequestEvent(
WidgetRequestType.MONITORBACKGROUNDPANEL); WidgetRequestType.MONITORBACKGROUNDPANEL);
eventBus.fireEvent(e); eventBus.fireEvent(e);
} }
protected void doChangeTableRequestEventCommand( protected void doChangeTableRequestEventCommand(
ChangeTableRequestEvent event) { ChangeTableRequestEvent event) {
Log.debug("Change Table Request: " + event); Log.debug("Change Table Request: " + event);
@ -1593,7 +1607,7 @@ public class TabularDataController {
} else { } else {
if (opId.compareTo(GridHeaderOperationId.COLUMNREPLACEBYEXPRESSION if (opId.compareTo(GridHeaderOperationId.COLUMNREPLACEBYEXPRESSION
.toString()) == 0) { .toString()) == 0) {
//TODO // TODO
openReplaceColumnByExpression(columnName); openReplaceColumnByExpression(columnName);
} else { } else {
@ -1624,5 +1638,4 @@ public class TabularDataController {
} }
} }

View File

@ -154,7 +154,7 @@ public class TabularDataPortlet implements EntryPoint {
bind(mainPanelLayout); bind(mainPanelLayout);
// menu(gridPanel); // menu(gridPanel);
controller.restoreUISession();
} }
protected void bind(BorderLayoutContainer mainWidget) { protected void bind(BorderLayoutContainer mainWidget) {