Updated OperationMonitor
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@99324 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -33,7 +33,7 @@ public class MonitorBarUpdater implements MonitorUpdaterListener {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void monitorComplete(TRId trId) {
|
||||
public void monitorComplete(TRId trId, OperationMonitor operationMonitor) {
|
||||
Log.info("Completed");
|
||||
progressBar.updateProgress(1, "Completed");
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class MonitorBarUpdater implements MonitorUpdaterListener {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void monitorFailed(Throwable caught, String reason, String failureDetails) {
|
||||
public void monitorFailed(Throwable caught, String reason, String failureDetails, OperationMonitor operationMonitor) {
|
||||
Log.info("Failed");
|
||||
progressBar.updateText("Failed");
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class MonitorBarUpdater implements MonitorUpdaterListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void monitorStopped(TRId trId,String reason, String details) {
|
||||
public void monitorStopped(TRId trId,String reason, String details, OperationMonitor operationMonitor) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Validations failed");
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.details.MonitorDetailPanel;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
@ -21,6 +22,7 @@ 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.FieldSet;
|
||||
|
||||
/**
|
||||
* AddColumnProgressDialog is a Dialog that show progress of AddColumn
|
||||
|
@ -35,29 +37,42 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
private static final String WIDTH = "400px";
|
||||
private static final String HEIGHT = "120px";
|
||||
private EventBus eventBus;
|
||||
private String taskId;
|
||||
private MonitorUpdater progressUpdater;
|
||||
private TextButton ok;
|
||||
private TRId trId;
|
||||
private String reason;
|
||||
private String details;
|
||||
|
||||
|
||||
protected boolean backgroundBtnEnabled=true;
|
||||
protected ToolButton backgroundBtn;
|
||||
|
||||
protected ArrayList<MonitorDialogListener> listeners = new ArrayList<MonitorDialogListener>();
|
||||
private MonitorDetailPanel monitorDetailPanel;
|
||||
|
||||
|
||||
|
||||
public MonitorDialog(String taskId, EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.taskId=taskId;
|
||||
trId = null;
|
||||
initWindow();
|
||||
create();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void initWindow(){
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setModal(true);
|
||||
setHeadingText("Add Column Progress");
|
||||
|
||||
trId = null;
|
||||
|
||||
setHeadingText("Progress");
|
||||
}
|
||||
|
||||
protected void create(){
|
||||
FramedPanel panel = new FramedPanel();
|
||||
panel.setHeaderVisible(false);
|
||||
panel.setBodyBorder(false);
|
||||
|
@ -65,7 +80,27 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
|
||||
ProgressBar progressBar = new ProgressBar();
|
||||
|
||||
|
||||
FieldSet detailsSet = new FieldSet();
|
||||
detailsSet.setHeadingText("Details");
|
||||
detailsSet.setCollapsible(true);
|
||||
|
||||
monitorDetailPanel=new MonitorDetailPanel(eventBus);
|
||||
detailsSet.add(monitorDetailPanel);
|
||||
|
||||
/*TextField
|
||||
|
||||
FlowLayoutContainer progressDetailContainer = new FlowLayoutContainer();
|
||||
progressDetailContainer.setScrollMode(ScrollMode.ALWAYS);
|
||||
MarginData layoutData = new MarginData(new Margins(0, 5, 0, 0));
|
||||
c.add(new TextButton("Button 1"), layoutData);
|
||||
c.add(new TextButton("Button 2"), layoutData);
|
||||
c.add(new TextButton("Button 3"), layoutData);
|
||||
Viewport v = new Viewport();
|
||||
v.add(c);
|
||||
RootPanel.get().add(v);
|
||||
*/
|
||||
|
||||
ok = new TextButton("OK");
|
||||
ok.addSelectHandler(new SelectHandler() {
|
||||
|
||||
|
@ -77,7 +112,9 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
|
||||
v.add(progressBar,
|
||||
new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
|
||||
|
||||
|
||||
v.add(detailsSet,new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
|
||||
|
||||
panel.add(v);
|
||||
panel.addButton(ok);
|
||||
add(panel);
|
||||
|
@ -91,7 +128,6 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
show();
|
||||
ok.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void addProgressDialogListener(MonitorDialogListener listener) {
|
||||
|
@ -103,19 +139,23 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void monitorInitializing(OperationMonitor result) {
|
||||
// TODO Auto-generated method stub
|
||||
public void monitorInitializing(OperationMonitor operationMonitor) {
|
||||
if(monitorDetailPanel!=null){
|
||||
monitorDetailPanel.update(operationMonitor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorUpdate(OperationMonitor operationMonitor) {
|
||||
// TODO Auto-generated method stub
|
||||
if(monitorDetailPanel!=null){
|
||||
monitorDetailPanel.update(operationMonitor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorComplete(TRId trId) {
|
||||
public void monitorComplete(TRId trId, OperationMonitor operationMonitor) {
|
||||
Log.debug("Operation Complete return: " + trId.toString());
|
||||
this.trId = trId;
|
||||
fireOperationComplete(trId);
|
||||
|
@ -123,7 +163,7 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void monitorFailed(Throwable caught, String reason, String details) {
|
||||
public void monitorFailed(Throwable caught, String reason, String details, OperationMonitor operationMonitor) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
|
@ -143,7 +183,7 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void monitorStopped(TRId trId, String reason, String details) {
|
||||
public void monitorStopped(TRId trId, String reason, String details, OperationMonitor operationMonitor) {
|
||||
Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
|
||||
+ ", " + details + "]");
|
||||
this.trId = trId;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
caught);
|
||||
String message = getStack(caught);
|
||||
fireMonitorFailed(caught,
|
||||
"Failed getting operation updates", message);
|
||||
"Failed getting operation updates", message, null);
|
||||
}
|
||||
|
||||
public void onSuccess(OperationMonitor result) {
|
||||
|
@ -91,7 +91,7 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
cancel();
|
||||
Log.info("Fisnish :"
|
||||
+ result.getTrId());
|
||||
fireMonitorComplete(result.getTrId());
|
||||
fireMonitorComplete(result);
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
|
@ -122,7 +122,7 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
details = "Operation failed";
|
||||
}
|
||||
|
||||
fireMonitorFailed(th, reason, details);
|
||||
fireMonitorFailed(th, reason, details,result);
|
||||
}
|
||||
|
||||
protected void stopMessage(OperationMonitor result) {
|
||||
|
@ -137,7 +137,7 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
details = "Operation stopped";
|
||||
}
|
||||
|
||||
fireMonitorStopped(result.getTrId(),reason, details);
|
||||
fireMonitorStopped(result.getTrId(),reason, details,result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,20 +169,20 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
listener.monitorValidate(result);
|
||||
}
|
||||
|
||||
protected void fireMonitorComplete(TRId trId) {
|
||||
protected void fireMonitorComplete(OperationMonitor result) {
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorComplete(trId);
|
||||
listener.monitorComplete(result.getTrId(), result);
|
||||
}
|
||||
|
||||
protected void fireMonitorFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
String failureDetails, OperationMonitor operationMonitor) {
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorFailed(caught, failure, failureDetails);
|
||||
listener.monitorFailed(caught, failure, failureDetails, operationMonitor);
|
||||
}
|
||||
|
||||
protected void fireMonitorStopped(TRId trId, String reason, String details) {
|
||||
protected void fireMonitorStopped(TRId trId, String reason, String details, OperationMonitor operationMonitor) {
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorStopped(trId,reason, details);
|
||||
listener.monitorStopped(trId,reason, details, operationMonitor);
|
||||
}
|
||||
|
||||
protected void fireMonitorAborted() {
|
||||
|
|
|
@ -34,8 +34,9 @@ public interface MonitorUpdaterListener {
|
|||
|
||||
/**
|
||||
* Called when the operation is complete.
|
||||
* @param operationMonitor TODO
|
||||
*/
|
||||
public void monitorComplete(TRId trId);
|
||||
public void monitorComplete(TRId trId, OperationMonitor operationMonitor);
|
||||
|
||||
/**
|
||||
* Called when the operation is failed.
|
||||
|
@ -43,8 +44,9 @@ public interface MonitorUpdaterListener {
|
|||
* @param caught
|
||||
* @param reason
|
||||
* @param details
|
||||
* @param operationMonitor TODO
|
||||
*/
|
||||
public void monitorFailed(Throwable caught, String reason, String details);
|
||||
public void monitorFailed(Throwable caught, String reason, String details, OperationMonitor operationMonitor);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
|
@ -52,8 +54,9 @@ public interface MonitorUpdaterListener {
|
|||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
* @param operationMonitor TODO
|
||||
*/
|
||||
public void monitorStopped(TRId trId, String reason, String details);
|
||||
public void monitorStopped(TRId trId, String reason, String details, OperationMonitor operationMonitor);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,299 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.details;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.details.tree.MonitorBaseDto;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.details.tree.MonitorFolderDto;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.details.tree.MonitorTreeDataGenerator;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.details.tree.MonitorValidationJobSDto;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.cell.client.Cell.Context;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ProgressBarCell;
|
||||
import com.sencha.gxt.core.client.ToStringValueProvider;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.data.shared.IconProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.TreeStore;
|
||||
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.MarginData;
|
||||
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.CollapseItemEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.CollapseItemEvent.CollapseItemHandler;
|
||||
import com.sencha.gxt.widget.core.client.event.ExpandItemEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.ExpandItemEvent.ExpandItemHandler;
|
||||
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.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
|
||||
|
||||
public class MonitorDetailPanel extends FramedPanel {
|
||||
protected String WIDTH = "380px";
|
||||
protected String HEIGHT = "200px";
|
||||
protected MonitorDetailPanel thisPanel;
|
||||
|
||||
protected Menu contextMenu;
|
||||
protected MenuItem resumeItem;
|
||||
protected MenuItem resolveItem;
|
||||
|
||||
protected TRId trId;
|
||||
protected VerticalLayoutContainer con;
|
||||
protected EventBus eventBus;
|
||||
protected ValidationsTasksMetadata validationsTasksMetadata;
|
||||
|
||||
protected MonitorTreeDataGenerator gen;
|
||||
protected TreeStore<MonitorBaseDto> store;
|
||||
protected TreeGrid<MonitorBaseDto> tree;
|
||||
private OperationMonitor operationMonitor;
|
||||
|
||||
class KeyProvider implements ModelKeyProvider<MonitorBaseDto> {
|
||||
@Override
|
||||
public String getKey(MonitorBaseDto item) {
|
||||
return (item instanceof MonitorFolderDto ? "f-" : "v-")
|
||||
+ item.getId();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param eventBus
|
||||
*/
|
||||
public MonitorDetailPanel(EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("MonitorDetailPanel");
|
||||
this.eventBus = eventBus;
|
||||
this.thisPanel = this;
|
||||
forceLayoutOnResize = true;
|
||||
init();
|
||||
draw();
|
||||
|
||||
}
|
||||
|
||||
protected void draw() {
|
||||
if (tree != null) {
|
||||
remove(tree);
|
||||
}
|
||||
if(operationMonitor!=null){
|
||||
createTreeData();
|
||||
}
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
forceLayoutOnResize = true;
|
||||
}
|
||||
|
||||
protected void createTreeData() {
|
||||
gen = new MonitorTreeDataGenerator(operationMonitor);
|
||||
create();
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
con = new VerticalLayoutContainer();
|
||||
con.setScrollMode(ScrollMode.AUTO);
|
||||
|
||||
store = new TreeStore<MonitorBaseDto>(new KeyProvider());
|
||||
|
||||
MonitorFolderDto root = gen.getRoot();
|
||||
for (MonitorBaseDto base : root.getChildrens()) {
|
||||
store.add(base);
|
||||
if (base instanceof MonitorFolderDto) {
|
||||
processFolder(store, (MonitorFolderDto) base);
|
||||
}
|
||||
}
|
||||
|
||||
ColumnConfig<MonitorBaseDto, String> cc1 = new ColumnConfig<MonitorBaseDto, String>(
|
||||
new ToStringValueProvider<MonitorBaseDto>("task"), 168, "Task");
|
||||
cc1.setHeader("Task");
|
||||
cc1.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
sb.appendHtmlConstant("<span title='"
|
||||
+ SafeHtmlUtils.htmlEscape(value) + "'>" + value
|
||||
+ "</span>");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<MonitorBaseDto, Double> cc2 = new ColumnConfig<MonitorBaseDto, Double>(
|
||||
new ValueProvider<MonitorBaseDto, Double>() {
|
||||
|
||||
@Override
|
||||
public Double getValue(MonitorBaseDto object) {
|
||||
Double d = null;
|
||||
if (object instanceof MonitorValidationJobSDto) {
|
||||
Float f = ((MonitorValidationJobSDto) object).getProgress();
|
||||
d = new Double(f);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(MonitorBaseDto object, Double value) {
|
||||
if (object instanceof MonitorValidationJobSDto) {
|
||||
((MonitorValidationJobSDto) object)
|
||||
.setProgress(value.floatValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return "progress";
|
||||
}
|
||||
}, 140, "Progress");
|
||||
cc2.setHeader("Progress");
|
||||
|
||||
ProgressBarCell progress = new ProgressBarCell() {
|
||||
@Override
|
||||
public boolean handlesSelection() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
progress.setProgressText("{0}% Complete");
|
||||
progress.setWidth(140);
|
||||
cc2.setCell(progress);
|
||||
|
||||
List<ColumnConfig<MonitorBaseDto, ?>> l = new ArrayList<ColumnConfig<MonitorBaseDto, ?>>();
|
||||
l.add(cc1);
|
||||
l.add(cc2);
|
||||
ColumnModel<MonitorBaseDto> cm = new ColumnModel<MonitorBaseDto>(l);
|
||||
|
||||
tree = new TreeGrid<MonitorBaseDto>(store, cm, cc1);
|
||||
tree.getView().setAutoFill(true);
|
||||
tree.setBorders(false);
|
||||
tree.setLoadMask(true);
|
||||
tree.setColumnResize(true);
|
||||
tree.getView().setAutoExpandColumn(cc1);
|
||||
|
||||
IconProvider<MonitorBaseDto> iconProvider = new IconProvider<MonitorBaseDto>() {
|
||||
|
||||
@Override
|
||||
public ImageResource getIcon(MonitorBaseDto model) {
|
||||
ImageResource img = null;
|
||||
if (model instanceof MonitorFolderDto) {
|
||||
String type = ((MonitorFolderDto) model).getType();
|
||||
if (type.compareTo("job") == 0) {
|
||||
img = ResourceBundle.INSTANCE.cog();
|
||||
} else {
|
||||
if (type.compareTo("task") == 0) {
|
||||
img = ResourceBundle.INSTANCE.basket();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
img = ResourceBundle.INSTANCE.tableValidation();
|
||||
}
|
||||
return img;
|
||||
}
|
||||
};
|
||||
tree.setIconProvider(iconProvider);
|
||||
|
||||
tree.addExpandHandler(new ExpandItemHandler<MonitorBaseDto>() {
|
||||
|
||||
@Override
|
||||
public void onExpand(ExpandItemEvent<MonitorBaseDto> event) {
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tree.addCollapseHandler(new CollapseItemHandler<MonitorBaseDto>() {
|
||||
|
||||
@Override
|
||||
public void onCollapse(CollapseItemEvent<MonitorBaseDto> event) {
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//createContextMenu();
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
|
||||
TextButton btnExpandAll = new TextButton();
|
||||
btnExpandAll.setIcon(ResourceBundle.INSTANCE.magnifierZoomIn());
|
||||
btnExpandAll.setToolTip("Expand All");
|
||||
btnExpandAll.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
tree.expandAll();
|
||||
forceLayout();
|
||||
}
|
||||
});
|
||||
toolBar.add(btnExpandAll);
|
||||
|
||||
TextButton btnCollapseAll = new TextButton();
|
||||
btnCollapseAll.setIcon(ResourceBundle.INSTANCE.magnifierZoomOut());
|
||||
btnCollapseAll.setToolTip("Collapse All");
|
||||
btnCollapseAll.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
tree.collapseAll();
|
||||
forceLayout();
|
||||
}
|
||||
});
|
||||
toolBar.add(btnCollapseAll);
|
||||
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||
con.add(tree, new VerticalLayoutData(1, -1));
|
||||
|
||||
add(con, new MarginData(0));
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
protected void requestOperationOnKey(Context context) {
|
||||
String key = (String) context.getKey();
|
||||
@SuppressWarnings("unused")
|
||||
MonitorBaseDto d = store.findModelWithKey(key);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void update(OperationMonitor operationMonitor) {
|
||||
this.operationMonitor = operationMonitor;
|
||||
draw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void processFolder(TreeStore<MonitorBaseDto> store,
|
||||
MonitorFolderDto folder) {
|
||||
for (MonitorBaseDto child : folder.getChildrens()) {
|
||||
store.add(folder, child);
|
||||
if (child instanceof MonitorFolderDto) {
|
||||
processFolder(store, (MonitorFolderDto) child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.details.tree;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorBaseDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5535466371215737037L;
|
||||
protected String id;
|
||||
|
||||
public MonitorBaseDto() {
|
||||
|
||||
}
|
||||
|
||||
public MonitorBaseDto(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BaseDto [id=" + id + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.details.tree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorFolderDto extends MonitorBaseDto {
|
||||
|
||||
private static final long serialVersionUID = 4644048540524701598L;
|
||||
protected String description;
|
||||
protected ArrayList<MonitorBaseDto> childrens;
|
||||
protected String type;
|
||||
|
||||
public MonitorFolderDto(){
|
||||
|
||||
}
|
||||
|
||||
public MonitorFolderDto(String type,String id,String description, ArrayList<MonitorBaseDto> childrens){
|
||||
super(id);
|
||||
this.type=type;
|
||||
this.description=description;
|
||||
this.childrens=childrens;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArrayList<MonitorBaseDto> getChildrens() {
|
||||
return childrens;
|
||||
}
|
||||
|
||||
public void setChildrens(ArrayList<MonitorBaseDto> childrens) {
|
||||
this.childrens = childrens;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.details.tree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorTreeDataGenerator {
|
||||
protected DateTimeFormat sdf = DateTimeFormat
|
||||
.getFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
protected MonitorFolderDto root;
|
||||
|
||||
public MonitorTreeDataGenerator(OperationMonitor operationMonitor) {
|
||||
Log.debug("MonitorTreeDataGenerator");
|
||||
ArrayList<MonitorBaseDto> childrens = new ArrayList<MonitorBaseDto>();
|
||||
if (operationMonitor.getTask() != null) {
|
||||
TaskS task = operationMonitor.getTask();
|
||||
ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>();
|
||||
for (JobS job : task.getJobs()) {
|
||||
ArrayList<MonitorBaseDto> validations = new ArrayList<MonitorBaseDto>();
|
||||
|
||||
for (ValidationsJobS v : job.getValidationsJobS()) {
|
||||
MonitorValidationJobSDto validationDto = new MonitorValidationJobSDto(
|
||||
task.getId() + "-" + job.getId() + "-" + v.getId(),
|
||||
v.getWorkerState(), v.getProgress(),
|
||||
v.getDescription(), v.getErrorMessage(),
|
||||
v.getHumanReadableStatus(), job.getInvocation());
|
||||
|
||||
validations.add(validationDto);
|
||||
}
|
||||
MonitorFolderDto foldJob = new MonitorFolderDto("job",
|
||||
task.getId() + "-" + job.getId(), job.getDescription(),
|
||||
validations);
|
||||
jobs.add(foldJob);
|
||||
}
|
||||
MonitorFolderDto foldTask = new MonitorFolderDto("task",
|
||||
task.getId(), sdf.format(task.getStartTime()), jobs);
|
||||
childrens.add(foldTask);
|
||||
|
||||
root = new MonitorFolderDto("root", "-1", "root", childrens);
|
||||
Log.debug("Generated root");
|
||||
// printRecorsive(root);
|
||||
|
||||
} else {
|
||||
root = new MonitorFolderDto("root", "-1", "root", childrens);
|
||||
Log.debug("Generated root without childrens");
|
||||
}
|
||||
}
|
||||
|
||||
public MonitorFolderDto getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
protected void printRecorsive(MonitorFolderDto root) {
|
||||
for (MonitorBaseDto base : root.getChildrens()) {
|
||||
Log.debug("+++");
|
||||
Log.debug("Children:" + base.toString());
|
||||
if (base instanceof MonitorFolderDto) {
|
||||
printRecorsive((MonitorFolderDto) base);
|
||||
}
|
||||
Log.debug("---");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.details.tree;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.WorkerState;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorValidationJobSDto extends MonitorBaseDto {
|
||||
|
||||
private static final long serialVersionUID = -4353641080571614057L;
|
||||
|
||||
protected WorkerState workerState;
|
||||
protected float progress;
|
||||
protected String description;
|
||||
protected Throwable errorMessage;
|
||||
protected String humanReadableStatus;
|
||||
protected InvocationS invocation;
|
||||
|
||||
|
||||
|
||||
|
||||
public MonitorValidationJobSDto(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param workerState
|
||||
* @param progress
|
||||
* @param description
|
||||
* @param errorMessage
|
||||
* @param humanReadableStatus
|
||||
* @param invocation
|
||||
*/
|
||||
public MonitorValidationJobSDto(String id, WorkerState workerState, float progress,
|
||||
String description, Throwable errorMessage,
|
||||
String humanReadableStatus, InvocationS invocation) {
|
||||
super(id);
|
||||
this.workerState = workerState;
|
||||
this.progress = progress;
|
||||
this.description = description;
|
||||
this.errorMessage = errorMessage;
|
||||
this.humanReadableStatus = humanReadableStatus;
|
||||
this.invocation = invocation;
|
||||
}
|
||||
|
||||
|
||||
public WorkerState getWorkerState() {
|
||||
return workerState;
|
||||
}
|
||||
|
||||
public void setWorkerState(WorkerState workerState) {
|
||||
this.workerState = workerState;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Throwable getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(Throwable errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getHumanReadableStatus() {
|
||||
return humanReadableStatus;
|
||||
}
|
||||
|
||||
public void setHumanReadableStatus(String humanReadableStatus) {
|
||||
this.humanReadableStatus = humanReadableStatus;
|
||||
}
|
||||
|
||||
public InvocationS getInvocation() {
|
||||
return invocation;
|
||||
}
|
||||
|
||||
public void setInvocation(InvocationS invocation) {
|
||||
this.invocation = invocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,19 +1,57 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client.resources;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface ResourceBundle extends ClientBundle {
|
||||
|
||||
public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class);
|
||||
|
||||
|
||||
public static final ResourceBundle INSTANCE = GWT
|
||||
.create(ResourceBundle.class);
|
||||
|
||||
@Source("MonitorWidgetTD.css")
|
||||
MonitorCSS monitorCss();
|
||||
|
||||
|
||||
|
||||
@Source("error.png")
|
||||
ImageResource error();
|
||||
|
||||
@Source("error_32.png")
|
||||
ImageResource error32();
|
||||
|
||||
@Source("ok.png")
|
||||
ImageResource ok();
|
||||
|
||||
@Source("ok_32.png")
|
||||
ImageResource ok32();
|
||||
|
||||
@Source("table-validation.png")
|
||||
ImageResource tableValidation();
|
||||
|
||||
@Source("table-validation_32.png")
|
||||
ImageResource tableValidation32();
|
||||
|
||||
@Source("cog.png")
|
||||
ImageResource cog();
|
||||
|
||||
@Source("cog_32.png")
|
||||
ImageResource cog32();
|
||||
|
||||
@Source("basket.png")
|
||||
ImageResource basket();
|
||||
|
||||
@Source("basket_32.png")
|
||||
ImageResource basket32();
|
||||
|
||||
@Source("magnifier-zoom-in_32.png")
|
||||
ImageResource magnifierZoomIn32();
|
||||
|
||||
@Source("magnifier-zoom-in.png")
|
||||
ImageResource magnifierZoomIn();
|
||||
|
||||
@Source("magnifier-zoom-out_32.png")
|
||||
ImageResource magnifierZoomOut32();
|
||||
|
||||
@Source("magnifier-zoom-out.png")
|
||||
ImageResource magnifierZoomOut();
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 844 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 814 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 844 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 814 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 1.7 KiB |