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
Removing invalidated units
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">
<dependency-type>uses</dependency-type>
</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="context-root" value="tabular-data-manager"/>
</wb-module>

View File

@ -180,12 +180,10 @@ public class TabularDataController {
}
};
int TIMEOUT = 5; // 3 second timeout
timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
}
// Bind Controller to events on bus
protected void bindToEvents() {
@ -254,29 +252,27 @@ public class TabularDataController {
}
});
eventBus.addHandler(WidgetRequestEvent.TYPE,
new WidgetRequestEvent.WidgetRequestEventHandler() {
@Override
public void onWidgetRequest(WidgetRequestEvent event) {
Log.debug("Catch Event WidgetRequestEvent");
doWidgetRequestCommand(event);
}
});
eventBus.addHandler(BackgroundRequestEvent.TYPE,
new BackgroundRequestEvent.BackgroundRequestEventHandler() {
@Override
public void onBackgroundRequest(BackgroundRequestEvent event) {
Log.debug("Catch Event BackgroundRequestEvent");
doBackgroundRequestCommand(event);
}
});
@ -284,19 +280,40 @@ public class TabularDataController {
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
}
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 {
closeTabularResource();
//TODO Open monitor background and change TR
closeTabularResource();
openBackgroundMonitor();
openTabularResource(true);
} catch (Exception e) {
Log.debug("Put In Background :" + e.getLocalizedMessage());
}
}
// Resume state of user interface
protected void resumeUIState() {
@ -401,6 +418,7 @@ public class TabularDataController {
} catch (Exception e) {
Log.debug("Bus Error: " + e.getMessage());
}
closeTabularResourceOnServer();
break;
case TR_CLOSE:
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() {
final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm",
@ -558,7 +593,7 @@ public class TabularDataController {
break;
case CODELISTMAPPING:
openCodelistMappingWizard();
break;
break;
case GENERATESUMMARY:
break;
case TABLEFILTER:
@ -643,16 +678,17 @@ public class TabularDataController {
break;
}
}
//TODO
protected void doWidgetRequestCommand(WidgetRequestEvent event){
WidgetRequestType widgetRequestType=event.getWidgetRequestType();
switch(widgetRequestType){
// TODO
protected void doWidgetRequestCommand(WidgetRequestEvent event) {
WidgetRequestType widgetRequestType = event.getWidgetRequestType();
switch (widgetRequestType) {
case CHANGECOLUMNTYPEPANEL:
break;
case CHANGETABLETYPEPANEL:
break;
case CURATIONBYREPLACEBATCHDIALOG:
openBatchReplace(event.getTrId(),event.getRequestProperties());
openBatchReplace(event.getTrId(), event.getRequestProperties());
break;
case DELETECOLUMNPANEL:
break;
@ -664,13 +700,12 @@ public class TabularDataController {
break;
default:
break;
}
}
//TODO
// TODO
public void doBackgroundRequestCommand(BackgroundRequestEvent event) {
BackgroundRequestType type = event.getBackgroundRequestType();
Log.trace("doBackgroundRequestEvent BackgroundRequestType: " + type);
@ -683,20 +718,22 @@ public class TabularDataController {
break;
}
} catch (Throwable e) {
Log.error("doBackgroundRequestCommand Error : " + e.getLocalizedMessage());
Log.error("doBackgroundRequestCommand Error : "
+ e.getLocalizedMessage());
e.printStackTrace();
}
}
protected void openLogsWindow(){
protected void openLogsWindow() {
Log.debug("Request Open Logs Window");
TDMLogs tdmLogs=new TDMLogs(eventBus);
TDMLogs tdmLogs = new TDMLogs(eventBus);
tdmLogs.show();
}
protected void openBatchReplace(TRId trId, RequestProperties requestProperties){
Log.debug("Request Open Batch Replace Dialog: "+trId+" "+requestProperties);
protected void openBatchReplace(TRId trId,
RequestProperties requestProperties) {
Log.debug("Request Open Batch Replace Dialog: " + trId + " "
+ requestProperties);
if (trId != null) {
ReplaceBatchDialog dialog = new ReplaceBatchDialog(trId,
requestProperties, eventBus);
@ -706,8 +743,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openSDMXImportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -716,12 +752,12 @@ public class TabularDataController {
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
"SDMX Import", eventBus);
importWizard.addListener(new WizardListener() {
@Override
public void completed(TRId tabularResourceId) {
openTable(tabularResourceId);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
@ -739,7 +775,6 @@ public class TabularDataController {
resumeUIState();
}
});
importWizard.show();
@ -761,30 +796,30 @@ public class TabularDataController {
"CSV Export", eventBus);
exportWizard.addListener(new WizardListener() {
@Override
public void completed(TRId id) {
resumeUIState();
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
@Override
public void aborted() {
resumeUIState();
}
@Override
public void failed(String title, String message,
Throwable throwable) {
UtilsGXT3.alert(title, message);
resumeUIState();
}
});
exportWizard.show();
@ -796,7 +831,7 @@ public class TabularDataController {
});
}
protected void openJSONExportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -806,30 +841,30 @@ public class TabularDataController {
"JSON Export", eventBus);
exportWizard.addListener(new WizardListener() {
@Override
public void completed(TRId id) {
resumeUIState();
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
@Override
public void aborted() {
resumeUIState();
}
@Override
public void failed(String title, String message,
Throwable throwable) {
UtilsGXT3.alert(title, message);
resumeUIState();
}
});
exportWizard.show();
@ -841,12 +876,7 @@ public class TabularDataController {
});
}
protected void openSDMXExportWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -866,7 +896,7 @@ public class TabularDataController {
resumeUIState();
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
@ -886,19 +916,19 @@ public class TabularDataController {
});
}
protected void openExtractCodelistWizard() {
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
ExtractCodelistWizardTD extractCodelistWizard = new ExtractCodelistWizardTD(
trId,"Extract Codelist", eventBus);
trId, "Extract Codelist", eventBus);
extractCodelistWizard.addListener(new WizardListener() {
public void failed(String title, String message,
Throwable throwable) {
UtilsGXT3.alert(title,message);
UtilsGXT3.alert(title, message);
resumeUIState();
}
@ -906,7 +936,7 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
@ -926,16 +956,14 @@ public class TabularDataController {
});
}
protected void openCodelistMappingWizard() {
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
CodelistMappingImportWizardTD codelistMappingWizard = new CodelistMappingImportWizardTD(
trId,"Codelist Mapping Import", eventBus);
trId, "Codelist Mapping Import", eventBus);
codelistMappingWizard.addListener(new WizardListener() {
public void failed(String title, String message,
@ -948,7 +976,7 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
@ -968,14 +996,14 @@ public class TabularDataController {
});
}
protected void openTableUnionWizard() {
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
UnionWizardTD unionWizard = new UnionWizardTD(
trId,"Union", eventBus);
UnionWizardTD unionWizard = new UnionWizardTD(trId, "Union",
eventBus);
unionWizard.addListener(new WizardListener() {
public void failed(String title, String message,
@ -988,12 +1016,11 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -1009,35 +1036,32 @@ public class TabularDataController {
});
}
/**
* @param switchState
* @param switchState
*
*/
protected void openTabularResource(final boolean switchState) {
Log.info("Open Tabular Resources");
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
String title;
if(switchState){
title="Switches Tabular Resource";
if (switchState) {
title = "Switches Tabular Resource";
} 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() {
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
}
@ -1085,7 +1109,7 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
@ -1153,8 +1177,6 @@ public class TabularDataController {
TRShare trShare = new TRShare(trId, eventBus);
}
protected void callDiscard() {
HistoryDiscard historyDiscard = new HistoryDiscard(eventBus);
historyDiscard.discard();
@ -1196,19 +1218,18 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No current tabular resource present");
}
}
protected void openReplaceColumnByExpression(String columnName) {
Log.debug("Request Open Replace Column By Expression Dialog");
if (trId != null) {
ReplaceColumnByExpressionDialog rceDialog = new ReplaceColumnByExpressionDialog(trId,
columnName, eventBus);
ReplaceColumnByExpressionDialog rceDialog = new ReplaceColumnByExpressionDialog(
trId, columnName, eventBus);
rceDialog.show();
} else {
Log.error("TRId is null");
UtilsGXT3.alert("Error", "No current tabular resource present");
}
}
protected void openColumnType() {
openColumnType(null);
@ -1231,7 +1252,7 @@ public class TabularDataController {
protected void openNormalize() {
openNormalize(null);
}
protected void openNormalize(String columnName) {
Log.debug("Request Open Normalize Tab");
if (trId != null) {
@ -1245,11 +1266,11 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No current tabular resource present");
}
}
protected void openDenormalize() {
openDenormalize(null);
}
protected void openDenormalize(String columnName) {
Log.debug("Request Open Denormalize Tab");
if (trId != null) {
@ -1263,8 +1284,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No current tabular resource present");
}
}
protected void cloneTabularResource() {
CloneTabularResource cloneTR = new CloneTabularResource(trId, eventBus);
cloneTR.cloneTR();
@ -1302,8 +1322,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openColumnDelete() {
openColumnDelete(null);
}
@ -1321,7 +1340,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openColumnSplit() {
openColumnSplit(null);
}
@ -1339,8 +1358,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openColumnMerge() {
openColumnMerge(null);
}
@ -1358,10 +1376,7 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openGroupBy() {
openGroupBy(null);
}
@ -1423,16 +1438,15 @@ public class TabularDataController {
UtilsGXT3.alert("Error", "No tabular resource present");
}
}
protected void openBackgroundMonitor() {
Log.debug("Request Open Monitor Background Tab");
WidgetRequestEvent e = new WidgetRequestEvent(
WidgetRequestType.MONITORBACKGROUNDPANEL);
WidgetRequestType.MONITORBACKGROUNDPANEL);
eventBus.fireEvent(e);
}
protected void doChangeTableRequestEventCommand(
ChangeTableRequestEvent event) {
Log.debug("Change Table Request: " + event);
@ -1581,7 +1595,7 @@ public class TabularDataController {
} else {
if (opId.compareTo(GridHeaderOperationId.DUPLICATEDETECTION
.toString()) == 0) {
} else {
if (opId.compareTo(GridHeaderOperationId.COLUMNSPLIT
.toString()) == 0) {
@ -1593,7 +1607,7 @@ public class TabularDataController {
} else {
if (opId.compareTo(GridHeaderOperationId.COLUMNREPLACEBYEXPRESSION
.toString()) == 0) {
//TODO
// TODO
openReplaceColumnByExpression(columnName);
} else {
@ -1621,8 +1635,7 @@ public class TabularDataController {
Log.error("Async code loading failed", reason);
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
}
}

View File

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