Updated Task in background

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@99771 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-11 16:39:50 +00:00
parent a06d6fae32
commit e035f60acd
7 changed files with 172 additions and 22 deletions

View File

@ -30,6 +30,7 @@ import org.gcube.portlets.user.td.tablewidget.client.rows.EditRowDialog;
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
import org.gcube.portlets.user.td.unionwizardwidget.client.UnionWizardTD;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.BackgroundRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridHeaderColumnMenuItemEvent;
@ -38,6 +39,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredE
import org.gcube.portlets.user.td.widgetcommonevent.client.event.TasksMonitorEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.BackgroundRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.TaskType;
@ -202,7 +204,7 @@ public class TabularDataController {
public void onGridHeaderColumnMenuItemEvent(
GridHeaderColumnMenuItemEvent event) {
Log.debug("Catch Event HeaderColumnMenuItemEvent");
Log.debug("Catch Event GridHeaderColumnMenuItemEvent");
doGridHeaderColumnMenuCommand(event);
}
@ -234,6 +236,7 @@ public class TabularDataController {
new RibbonEvent.RibbonEventHandler() {
public void onRibbon(RibbonEvent event) {
Log.debug("Catch Event RibbonEvent");
doRibbonCommand(event);
}
@ -243,7 +246,7 @@ public class TabularDataController {
new TasksMonitorEvent.TasksMonitorEventHandler() {
public void onTasksMonitorEvent(TasksMonitorEvent event) {
Log.debug("Catch Event HeaderColumnMenuItemEvent");
Log.debug("Catch Event TasksMonitorEvent");
doTasksMonitorCommand(event);
}
@ -255,17 +258,43 @@ public class TabularDataController {
@Override
public void onWidgetRequest(WidgetRequestEvent event) {
Log.debug("Catch Event HeaderColumnMenuItemEvent");
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);
}
});
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
}
protected void putInBackgroundUIState(){
try {
closeTabularResource();
//TODO Open monitor background and change TR
openBackgroundMonitor();
openTabularResource(true);
} catch (Exception e) {
Log.debug("Put In Background :" + e.getLocalizedMessage());
}
}
// Resume state of user interface
protected void resumeUIState() {
@ -425,7 +454,7 @@ public class TabularDataController {
try {
switch (type) {
case OPEN:
openTabularResource();
openTabularResource(false);
break;
case CLONE:
cloneTabularResource();
@ -469,6 +498,9 @@ public class TabularDataController {
case TIMELINE:
openTasksManagerWizard();
break;
case BACKGROUNDTASKS:
openBackgroundMonitor();
break;
case HISTORY:
break;
case UNDO:
@ -631,8 +663,29 @@ public class TabularDataController {
break;
}
}
//TODO
public void doBackgroundRequestCommand(BackgroundRequestEvent event) {
BackgroundRequestType type = event.getBackgroundRequestType();
Log.trace("doBackgroundRequestEvent BackgroundRequestType: " + type);
try {
switch (type) {
case BACKGROUND:
putInBackgroundUIState();
break;
default:
break;
}
} catch (Throwable e) {
Log.error("doBackgroundRequestCommand Error : " + e.getLocalizedMessage());
e.printStackTrace();
}
}
protected void openLogsWindow(){
Log.debug("Request Open Logs Window");
TDMLogs tdmLogs=new TDMLogs(eventBus);
@ -660,21 +713,30 @@ 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");
}
@Override
public void aborted() {
resumeUIState();
}
@Override
public void failed(Throwable throwable, String reason,
String details) {
UtilsGXT3.alert(reason, details);
resumeUIState();
}
});
importWizard.show();
@ -696,20 +758,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(Throwable throwable, String reason,
String details) {
UtilsGXT3.alert(reason, details);
resumeUIState();
}
public void completed(TRId id) {
resumeUIState();
}
public void aborted() {
resumeUIState();
}
});
exportWizard.show();
@ -745,6 +817,11 @@ public class TabularDataController {
resumeUIState();
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -780,6 +857,11 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -817,6 +899,11 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -852,6 +939,12 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -870,19 +963,32 @@ public class TabularDataController {
/**
* @param switchState
*
*/
protected void openTabularResource() {
protected void openTabularResource(final boolean switchState) {
Log.info("Open Tabular Resources");
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
TDOpen tdOpen = new TDOpen(trId,"Open Tabular Resource", eventBus);
String title;
if(switchState){
title="Switches Tabular Resource";
} else {
title="Open Tabular Resource";
}
TDOpen tdOpen=new TDOpen(trId,title, eventBus);
tdOpen.addListener(new WizardListener() {
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
}
@ -930,6 +1036,11 @@ public class TabularDataController {
openTable(id);
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
}
public void aborted() {
resumeUIState();
@ -1247,7 +1358,16 @@ 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);
eventBus.fireEvent(e);
}
protected void doChangeTableRequestEventCommand(
ChangeTableRequestEvent event) {
Log.debug("Change Table Request: " + event);

View File

@ -399,5 +399,12 @@ public interface TabularDataResources extends ClientBundle {
@Source("column-merge.png")
ImageResource columnMerge();
@Source("basket-background_32.png")
ImageResource basketBackground32();
@Source("basket-background.png")
ImageResource basketBackground();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -60,6 +60,7 @@ public class FileToolBar {
protected TextButton shareButton;
protected TextButton timelineButton;
protected TextButton backgroundButton;
// History
protected TextButton historyButton;
@ -390,9 +391,9 @@ public class FileToolBar {
// TimeLine (Tasks)
ButtonGroup taskGroup = new ButtonGroup();
taskGroup.setId("Template");
taskGroup.setId("TasksStatus");
taskGroup.setStyleName("ribbon");
taskGroup.setHeadingText("Timeline");
taskGroup.setHeadingText("Tasks");
toolBar.add(taskGroup);
FlexTable taskLayout = new FlexTable();
@ -414,6 +415,24 @@ public class FileToolBar {
taskLayout.setWidget(0, 0, timelineButton);
taskLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
backgroundButton = new TextButton("Background",
TabularDataResources.INSTANCE.basketBackground32());
backgroundButton.enable();
backgroundButton.setToolTip("Tasks in background");
backgroundButton.setScale(ButtonScale.LARGE);
backgroundButton.setIconAlign(IconAlign.TOP);
backgroundButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
backgroundButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.BACKGROUNDTASKS));
}
});
taskLayout.setWidget(0, 1, backgroundButton);
taskLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
cleanCells(taskLayout.getElement());
// History Group
@ -565,6 +584,7 @@ public class FileToolBar {
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.disable();
backgroundButton.enable();
historyButton.disable();
undoButton.disable();
//discardAllButton.disable();
@ -587,6 +607,7 @@ public class FileToolBar {
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.disable();
backgroundButton.enable();
historyButton.disable();
undoButton.disable();
//discardAllButton.disable();
@ -615,6 +636,7 @@ public class FileToolBar {
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.enable();
backgroundButton.enable();
historyButton.enable();
undoButton.enable();
//discardAllButton.disable();
@ -636,6 +658,7 @@ public class FileToolBar {
templateNewButton.disable();
templateDeleteButton.disable();
timelineButton.disable();
backgroundButton.disable();
historyButton.disable();
undoButton.disable();
//discardAllButton.disable();

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB