Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@99539 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-05 11:03:47 +00:00 committed by Giancarlo Panichi
parent 8d4b13d6eb
commit 7662a2dd1b
3 changed files with 151 additions and 10 deletions

View File

@ -0,0 +1,96 @@
package org.gcube.portlets.user.td.monitorwidget.client.background;
import org.gcube.portlets.user.td.monitorwidget.client.details.MonitorDetailPanel;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
/**
* Background Operations Monitor
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class MonitorBackgroundDialog extends Window {
private static final String WIDTH = "640px";
private static final String HEIGHT = "378px";
private static final String PANELWIDTH = "620px";
private static final String PANELHEIGHT = "308px";
private static final String PROGRESSWIDTH = "618px";
private EventBus eventBus;
private String taskId;
private TRId trId;
private MonitorDetailPanel monitorDetailPanel;
public MonitorBackgroundDialog(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);
setClosable(true);
setHeadingText("Background Operations Monitor");
}
protected void create(){
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
/*if (backgroundBtnEnabled) {
backgroundBtn = new ToolButton(ToolButton.CLOSE);
backgroundBtn.setToolTip("Put in the background");
backgroundBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
hide();
}
});
header.addTool(backgroundBtn);
}*/
super.initTools();
closeBtn.setVisible(false);
/*
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});*/
}
protected void close() {
hide();
}
}

View File

@ -364,7 +364,7 @@ public class MonitorDetailPanel extends FramedPanel {
private void addChildrensToStore() {
gen = new MonitorTreeDataGenerator(operationMonitor);
MonitorFolderDto root = gen.getRoot();
MonitorFolderDto root = gen.getRootNoTask();
for (MonitorBaseDto base : root.getChildrens()) {
store.add(base);
if (base instanceof MonitorFolderDto) {

View File

@ -21,11 +21,16 @@ public class MonitorTreeDataGenerator {
.getFormat("yyyy-MM-dd HH:mm:ss");
protected MonitorFolderDto root;
protected OperationMonitor operationMonitor;
public MonitorTreeDataGenerator(OperationMonitor operationMonitor) {
Log.debug("MonitorTreeDataGenerator");
this.operationMonitor = operationMonitor;
}
public MonitorFolderDto getRoot() {
ArrayList<MonitorBaseDto> childrens = new ArrayList<MonitorBaseDto>();
if (operationMonitor!=null && operationMonitor.getTask() != null) {
if (operationMonitor != null && operationMonitor.getTask() != null) {
TaskS task = operationMonitor.getTask();
ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>();
for (JobS job : task.getJobs()) {
@ -42,35 +47,75 @@ public class MonitorTreeDataGenerator {
}
MonitorFolderDto foldJob = new MonitorFolderDto("job",
task.getId() + "-" + job.getId(), job.getDescription(),
job.getWorkerState().toString(), job.getHumaReadableStatus(),job.getProgress(),
job.getWorkerState().toString(),
job.getHumaReadableStatus(), job.getProgress(),
validations);
jobs.add(foldJob);
}
MonitorFolderDto foldTask = new MonitorFolderDto("task",
task.getId(), task.getId()+" [Date:"+sdf.format(task.getStartTime())+"]", task
.getState().toString(), "",task.getProgress(), jobs);
task.getId(), task.getId() + " [Date:"
+ sdf.format(task.getStartTime()) + "]", task
.getState().toString(), "", task.getProgress(),
jobs);
childrens.add(foldTask);
root = new MonitorFolderDto("root", "-1", "root", "root", "",0,
root = new MonitorFolderDto("root", "-1", "root", "root", "", 0,
childrens);
Log.debug("Generated root");
//printRecorsive(root);
// printRecorsive(root);
} else {
root = new MonitorFolderDto("root", "-1", "root", "root", "", 0,
childrens);
Log.debug("Generated root without childrens");
}
}
public MonitorFolderDto getRoot() {
return root;
}
public MonitorFolderDto getRootNoTask(){
ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>();
if (operationMonitor != null && operationMonitor.getTask() != null) {
TaskS task = operationMonitor.getTask();
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(),
job.getWorkerState().toString(),
job.getHumaReadableStatus(), job.getProgress(),
validations);
jobs.add(foldJob);
}
root = new MonitorFolderDto("root", "-1", "root", "root", "", 0,
jobs);
Log.debug("Generated root");
// printRecorsive(root);
} else {
root = new MonitorFolderDto("root", "-1", "root", "root", "", 0,
jobs);
Log.debug("Generated root without childrens");
}
return root;
}
protected void printRecorsive(MonitorFolderDto root) {
for (MonitorBaseDto base : root.getChildrens()) {
Log.debug("+++");
Log.debug("Children:[id=" +base.getId() +", toString="+base.toString()+"]");
Log.debug("Children:[id=" + base.getId() + ", toString="
+ base.toString() + "]");
if (base instanceof MonitorFolderDto) {
printRecorsive((MonitorFolderDto) base);
}