Updated Monitor grid

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@114399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-24 16:33:44 +00:00 committed by Giancarlo Panichi
parent a4da9b32f9
commit fc8852874b
11 changed files with 238 additions and 103 deletions

View File

@ -72,6 +72,10 @@
<version>1.0.1</version> <version>1.0.1</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
</dependency>
</dependencies> </dependencies>
</profile> </profile>
</profiles> </profiles>

View File

@ -76,7 +76,7 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(true); setResizable(false);
setModal(true); setModal(true);
setClosable(true); setClosable(true);
setHeadingText("Progress"); setHeadingText("Progress");

View File

@ -51,6 +51,9 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
Log.debug("retrieved OperationMonitor: " Log.debug("retrieved OperationMonitor: "
+ result); + result);
if(result==null){
return;
}
if(result.isInBackground()){ if(result.isInBackground()){
Log.debug("Operation is in background"); Log.debug("Operation is in background");
cancel(); cancel();
@ -65,6 +68,10 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
} }
if(result.getTask()==null|| result.getTask().getState()==null){
return;
}
switch (result.getTask().getState()) { switch (result.getTask().getState()) {
case INITIALIZING: case INITIALIZING:
Log.info("Initializing..."); Log.info("Initializing...");

View File

@ -39,7 +39,7 @@ public class MonitorWidgetEntry implements EntryPoint {
}; };
public void onModuleLoad() { public void onModuleLoad() {
TestShow testShow = TestShow.MONITORBACKGROUNDWIDGET; TestShow testShow = TestShow.MONITORBACKGROUNDINFOWIDGET;
Timer elapsedTimer; Timer elapsedTimer;
switch (testShow) { switch (testShow) {
@ -170,7 +170,9 @@ public class MonitorWidgetEntry implements EntryPoint {
} }
private float genProgress() { private float genProgress() {
float fperc;
float fperc=20;
int perc = Random.nextInt(100); int perc = Random.nextInt(100);
if (perc == 0) { if (perc == 0) {
fperc = 0f; fperc = 0f;

View File

@ -67,10 +67,10 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
private static final String HEIGHT = "420px"; private static final String HEIGHT = "420px";
private static final String HEIGHTGRID = "290px"; private static final String HEIGHTGRID = "290px";
private static final int CC1WIDTH = 168; private static final int CC1WIDTH = 164;
private static final int CC2WIDTH = 100; private static final int CC2WIDTH = 100;
private static final int CC3WIDTH = 140; private static final int CC3WIDTH = 140;
private static final int CC4WIDTH = 100; private static final int CC4WIDTH = 104;
private MonitorBackgroundInfoDialog parent; private MonitorBackgroundInfoDialog parent;
@ -89,7 +89,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
private TextField startDateField; private TextField startDateField;
private FieldLabel startLabel; private FieldLabel startLabel;
class KeyProvider implements ModelKeyProvider<MonitorBaseDto> { class KeyProvider implements ModelKeyProvider<MonitorBaseDto> {
@Override @Override
public String getKey(MonitorBaseDto item) { public String getKey(MonitorBaseDto item) {
@ -102,6 +101,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
BackgroundOperationMonitor backgroundOperationMonitor, BackgroundOperationMonitor backgroundOperationMonitor,
EventBus eventBus) { EventBus eventBus) {
super(); super();
gen = new MonitorTreeDataGenerator();
this.parent = parent; this.parent = parent;
this.backgroundOperationMonitor = backgroundOperationMonitor; this.backgroundOperationMonitor = backgroundOperationMonitor;
this.operationMonitorSession = new OperationMonitorSession( this.operationMonitorSession = new OperationMonitorSession(
@ -134,8 +134,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
.getStartTime())); .getStartTime()));
} }
startLabel = new FieldLabel(startDateField, "Start Date"); startLabel = new FieldLabel(startDateField, "Start Date");
// Tree // Tree
store = new TreeStore<MonitorBaseDto>(new KeyProvider()); store = new TreeStore<MonitorBaseDto>(new KeyProvider());
@ -178,8 +176,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
public void setValue(MonitorBaseDto object, String value) { public void setValue(MonitorBaseDto object, String value) {
if (object instanceof MonitorValidationJobSDto) { if (object instanceof MonitorValidationJobSDto) {
WorkerState workerState = WorkerState.get(value); WorkerState workerState = WorkerState.get(value);
((MonitorValidationJobSDto) object) ((MonitorValidationJobSDto) object).setWorkerState(workerState);
.setWorkerState(workerState);
} }
if (object instanceof MonitorFolderDto) { if (object instanceof MonitorFolderDto) {
@ -193,6 +190,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
} }
}, CC2WIDTH, "Status"); }, CC2WIDTH, "Status");
cc2.setHeader("Status"); cc2.setHeader("Status");
cc2.setWidth(CC2WIDTH);
ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>( ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>(
new ValueProvider<MonitorBaseDto, String>() { new ValueProvider<MonitorBaseDto, String>() {
@ -229,6 +227,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
} }
}, CC3WIDTH, "Human Readble"); }, CC3WIDTH, "Human Readble");
cc3.setHeader("Human Readble"); cc3.setHeader("Human Readble");
cc3.setWidth(CC3WIDTH);
ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>( ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>(
new ValueProvider<MonitorBaseDto, Double>() { new ValueProvider<MonitorBaseDto, Double>() {
@ -266,7 +265,8 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
} }
}, CC4WIDTH, "Progress"); }, CC4WIDTH, "Progress");
cc4.setHeader("Progress"); cc4.setHeader("Progress");
cc4.setWidth(CC4WIDTH);
ProgressBarCell progress = new ProgressBarCell() { ProgressBarCell progress = new ProgressBarCell() {
@Override @Override
public boolean handlesSelection() { public boolean handlesSelection() {
@ -274,7 +274,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
} }
}; };
progress.setProgressText("{0}% Complete"); progress.setProgressText("{0}% Complete");
progress.setWidth(110); progress.setWidth(100);
cc4.setCell(progress); cc4.setCell(progress);
@ -385,7 +385,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
flowButton.add(btnClose, new BoxLayoutData(new Margins(0, 4, 0, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(0, 4, 0, 4)));
// //
con.add(startLabel, new VerticalLayoutData(1, -1, new Margins(0))); con.add(startLabel, new VerticalLayoutData(1, -1, new Margins(0)));
con.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0))); con.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
con.add(tree, new VerticalLayoutData(1, -1, new Margins(0))); con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
@ -417,7 +417,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
} }
private void addChildrensToStore() { private void addChildrensToStore() {
gen = new MonitorTreeDataGenerator();
MonitorFolderDto root = gen.getRoot(operationMonitor); MonitorFolderDto root = gen.getRoot(operationMonitor);
if (root != null) { if (root != null) {
@ -446,21 +445,24 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
public void update(OperationMonitor operationMonitor) { public void update(OperationMonitor operationMonitor) {
this.operationMonitor = operationMonitor; this.operationMonitor = operationMonitor;
store.clear(); if (!gen.isCacheValid(operationMonitor)) {
store.commitChanges(); store.clear();
addChildrensToStore(); store.commitChanges();
store.commitChanges(); addChildrensToStore();
tree.expandAll(); store.commitChanges();
tree.expandAll();
// StartDate
if (backgroundOperationMonitor != null
&& backgroundOperationMonitor.getStartTime() != null) {
startDateField.setValue(sdf.format(backgroundOperationMonitor
.getStartTime()));
}
forceLayout();
// StartDate
if (backgroundOperationMonitor != null
&& backgroundOperationMonitor.getStartTime() != null) {
startDateField.setValue(sdf.format(backgroundOperationMonitor
.getStartTime()));
} }
forceLayout();
} }

View File

@ -50,26 +50,26 @@ public class MonitorBackgroundPanel extends FramedPanel implements
private static final String WIDTH = "640px"; private static final String WIDTH = "640px";
private static final String HEIGHT = "520px"; private static final String HEIGHT = "520px";
private static final int CC1WIDTH = 90; private static final int CC1WIDTH = 90;
private static final int CC2WIDTH = 60; private static final int CC2WIDTH = 66;
private static final int CC3WIDTH = 110; private static final int CC3WIDTH = 104;
private static final int PROGRESS_WIDTH = 110; private static final int PROGRESS_WIDTH = 100;
private MonitorBackgroundDialog parent; private MonitorBackgroundDialog parent;
private ArrayList<MonitorBackgroundEventUIListener> monitorBackgroundEventUIListeners = new ArrayList<MonitorBackgroundEventUIListener>(); private ArrayList<MonitorBackgroundEventUIListener> monitorBackgroundEventUIListeners = new ArrayList<MonitorBackgroundEventUIListener>();
private Menu contextMenu; private Menu contextMenu;
private MenuItem infoItem; private MenuItem infoItem;
private MenuItem abortItem; private MenuItem abortItem;
private MenuItem hideItem; private MenuItem hideItem;
//private TRId trId; // private TRId trId;
private VerticalLayoutContainer con; private VerticalLayoutContainer con;
//private ValidationsTasksMetadata validationsTasksMetadata; // private ValidationsTasksMetadata validationsTasksMetadata;
private ListStore<BackgroundOperationMonitor> store; private ListStore<BackgroundOperationMonitor> store;
private Grid<BackgroundOperationMonitor> grid; private Grid<BackgroundOperationMonitor> grid;
private ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList; private ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList;
private ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorListCache;
private EventBus eventBus; private EventBus eventBus;
private MonitorBackgroundUpdater monitorBackgroundUpdater; private MonitorBackgroundUpdater monitorBackgroundUpdater;
@ -89,6 +89,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
public MonitorBackgroundPanel(EventBus eventBus) { public MonitorBackgroundPanel(EventBus eventBus) {
super(); super();
backgroundOperationMonitorListCache = null;
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize = true; forceLayoutOnResize = true;
init(); init();
@ -98,6 +99,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
public MonitorBackgroundPanel(MonitorBackgroundDialog parent, public MonitorBackgroundPanel(MonitorBackgroundDialog parent,
EventBus eventBus) { EventBus eventBus) {
super(); super();
backgroundOperationMonitorListCache = null;
this.eventBus = eventBus; this.eventBus = eventBus;
this.parent = parent; this.parent = parent;
forceLayoutOnResize = true; forceLayoutOnResize = true;
@ -142,7 +144,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
props.state()); props.state());
cc2.setHeader("Status"); cc2.setHeader("Status");
cc2.setWidth(CC2WIDTH); cc2.setWidth(CC2WIDTH);
ColumnConfig<BackgroundOperationMonitor, Double> cc3 = new ColumnConfig<BackgroundOperationMonitor, Double>( ColumnConfig<BackgroundOperationMonitor, Double> cc3 = new ColumnConfig<BackgroundOperationMonitor, Double>(
new ValueProvider<BackgroundOperationMonitor, Double>() { new ValueProvider<BackgroundOperationMonitor, Double>() {
@ -193,6 +195,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
grid.setLoadMask(true); grid.setLoadMask(true);
grid.setColumnReordering(false); grid.setColumnReordering(false);
grid.setColumnResize(true); grid.setColumnResize(true);
grid.getView().setAutoExpandColumn(cc1);
createContextMenu(); createContextMenu();
@ -237,11 +240,10 @@ public class MonitorBackgroundPanel extends FramedPanel implements
} }
private void addChildrensToStore() { private void addChildrensToStore() {
if(backgroundOperationMonitorList!=null){ if (backgroundOperationMonitorList != null) {
store.addAll(backgroundOperationMonitorList); store.addAll(backgroundOperationMonitorList);
} }
} }
protected void createContextMenu() { protected void createContextMenu() {
@ -328,14 +330,56 @@ public class MonitorBackgroundPanel extends FramedPanel implements
@Override @Override
public void operationMonitorListUpdated( public void operationMonitorListUpdated(
ArrayList<BackgroundOperationMonitor> operationMonitorList) { ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList) {
this.backgroundOperationMonitorList = operationMonitorList; this.backgroundOperationMonitorList = backgroundOperationMonitorList;
store.clear();
store.commitChanges();
addChildrensToStore();
store.commitChanges();
forceLayout();
if (!isCacheValid(backgroundOperationMonitorList)) {
store.clear();
store.commitChanges();
addChildrensToStore();
store.commitChanges();
forceLayout();
}
}
protected boolean isCacheValid(
ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList) {
if (backgroundOperationMonitorList == null
|| backgroundOperationMonitorList.size() <= 0) {
backgroundOperationMonitorListCache = null;
return false;
}
if (backgroundOperationMonitorListCache == null) {
backgroundOperationMonitorListCache = backgroundOperationMonitorList;
return false;
}
if (backgroundOperationMonitorListCache.size() == backgroundOperationMonitorList
.size()) {
for (int i = 0; i < backgroundOperationMonitorList.size(); i++) {
BackgroundOperationMonitor backgroundOperationMonitor = backgroundOperationMonitorList
.get(i);
BackgroundOperationMonitor backgroundOperationMonitorCache = backgroundOperationMonitorListCache
.get(i);
if (backgroundOperationMonitor.getTaskId().compareTo(
backgroundOperationMonitorCache.getTaskId()) == 0
&& backgroundOperationMonitor.getState().compareTo(
backgroundOperationMonitorCache.getState()) == 0
&& backgroundOperationMonitor.getProgress() == backgroundOperationMonitorCache
.getProgress()) {
} else {
return false;
}
}
} else {
return false;
}
return true;
} }
@Override @Override

View File

@ -51,26 +51,26 @@ import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
public class MonitorDetailPanel extends FramedPanel { public class MonitorDetailPanel extends FramedPanel {
private static final String WIDTH = "618px"; private static final String WIDTH = "618px";
private static final String HEIGHT = "256px"; private static final String HEIGHT = "256px";
private static final String GRIDHEIGHT = "332px"; private static final String GRIDHEIGHT = "208px";
private static final int CC1WIDTH = 168; private static final int CC1WIDTH = 164;
private static final int CC2WIDTH = 100; private static final int CC2WIDTH = 100;
private static final int CC3WIDTH = 140; private static final int CC3WIDTH = 140;
private static final int CC4WIDTH = 100; private static final int CC4WIDTH = 104;
interface DtoTemplates extends XTemplates { interface DtoTemplates extends XTemplates {
@XTemplate("<span title=\"{id} - {value}\">{value}</span>") @XTemplate("<span title=\"{id} - {value}\">{value}</span>")
SafeHtml format(String id, String value); SafeHtml format(String id, String value);
/*"<span title='" /*
+ SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value) * "<span title='" + SafeHtmlUtils.htmlEscape(value) + "'>" +
+ "</span>"*/ * SafeHtmlUtils.htmlEscape(value) + "</span>"
*/
} }
private VerticalLayoutContainer con; private VerticalLayoutContainer con;
private MonitorTreeDataGenerator gen; private MonitorTreeDataGenerator gen;
private TreeStore<MonitorBaseDto> store; private TreeStore<MonitorBaseDto> store;
private TreeGrid<MonitorBaseDto> tree; private TreeGrid<MonitorBaseDto> tree;
@ -93,6 +93,7 @@ public class MonitorDetailPanel extends FramedPanel {
super(); super();
Log.debug("MonitorDetailPanel"); Log.debug("MonitorDetailPanel");
forceLayoutOnResize = true; forceLayoutOnResize = true;
gen = new MonitorTreeDataGenerator();
init(); init();
create(); create();
@ -134,24 +135,21 @@ public class MonitorDetailPanel extends FramedPanel {
String label = jobSDto.getJobClassfier().getLabel(); String label = jobSDto.getJobClassfier().getLabel();
String response; String response;
if (label == null||label.isEmpty()) { if (label == null || label.isEmpty()) {
response = "Job"; response = "Job";
} else { } else {
response = "Job "+label; response = "Job " + label;
} }
sb.append(dtoTemplates.format(response, value)); sb.append(dtoTemplates.format(response, value));
} else { } else {
if (d instanceof MonitorValidationJobSDto) { if (d instanceof MonitorValidationJobSDto) {
sb.append(dtoTemplates.format("Validation", value)); sb.append(dtoTemplates.format("Validation", value));
} else{ } else {
sb.append(dtoTemplates.format("", value)); sb.append(dtoTemplates.format("", value));
} }
} }
} }
} }
}); });
@ -177,8 +175,7 @@ public class MonitorDetailPanel extends FramedPanel {
public void setValue(MonitorBaseDto object, String value) { public void setValue(MonitorBaseDto object, String value) {
if (object instanceof MonitorValidationJobSDto) { if (object instanceof MonitorValidationJobSDto) {
WorkerState workerState = WorkerState.get(value); WorkerState workerState = WorkerState.get(value);
((MonitorValidationJobSDto) object) ((MonitorValidationJobSDto) object).setWorkerState(workerState);
.setWorkerState(workerState);
} }
if (object instanceof MonitorFolderDto) { if (object instanceof MonitorFolderDto) {
@ -192,7 +189,8 @@ public class MonitorDetailPanel extends FramedPanel {
} }
}, CC2WIDTH, "Status"); }, CC2WIDTH, "Status");
cc2.setHeader("Status"); cc2.setHeader("Status");
cc2.setWidth(CC2WIDTH);
ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>( ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>(
new ValueProvider<MonitorBaseDto, String>() { new ValueProvider<MonitorBaseDto, String>() {
@ -228,6 +226,7 @@ public class MonitorDetailPanel extends FramedPanel {
} }
}, CC3WIDTH, "Human Readble"); }, CC3WIDTH, "Human Readble");
cc3.setHeader("Human Readble"); cc3.setHeader("Human Readble");
cc3.setWidth(CC3WIDTH);
ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>( ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>(
new ValueProvider<MonitorBaseDto, Double>() { new ValueProvider<MonitorBaseDto, Double>() {
@ -265,7 +264,8 @@ public class MonitorDetailPanel extends FramedPanel {
} }
}, CC4WIDTH, "Progress"); }, CC4WIDTH, "Progress");
cc4.setHeader("Progress"); cc4.setHeader("Progress");
cc4.setWidth(CC4WIDTH);
ProgressBarCell progress = new ProgressBarCell() { ProgressBarCell progress = new ProgressBarCell() {
@Override @Override
public boolean handlesSelection() { public boolean handlesSelection() {
@ -273,7 +273,7 @@ public class MonitorDetailPanel extends FramedPanel {
} }
}; };
progress.setProgressText("{0}% Complete"); progress.setProgressText("{0}% Complete");
progress.setWidth(110); progress.setWidth(100);
cc4.setCell(progress); cc4.setCell(progress);
@ -283,9 +283,9 @@ public class MonitorDetailPanel extends FramedPanel {
l.add(cc3); l.add(cc3);
l.add(cc4); l.add(cc4);
ColumnModel<MonitorBaseDto> cm = new ColumnModel<MonitorBaseDto>(l); ColumnModel<MonitorBaseDto> cm = new ColumnModel<MonitorBaseDto>(l);
gridView=new ExtendedTreeGridView<MonitorBaseDto>(); gridView = new ExtendedTreeGridView<MonitorBaseDto>();
tree = new TreeGrid<MonitorBaseDto>(store, cm, cc1); tree = new TreeGrid<MonitorBaseDto>(store, cm, cc1);
tree.setView(gridView); tree.setView(gridView);
tree.getView().setAutoFill(true); tree.getView().setAutoFill(true);
@ -349,8 +349,8 @@ public class MonitorDetailPanel extends FramedPanel {
img = ResourceBundle.INSTANCE.tableValidation(); img = ResourceBundle.INSTANCE.tableValidation();
} }
} }
return img; return img;
} }
}; };
tree.setIconProvider(iconProvider); tree.setIconProvider(iconProvider);
@ -422,22 +422,22 @@ public class MonitorDetailPanel extends FramedPanel {
public void update(OperationMonitor operationMonitor) { public void update(OperationMonitor operationMonitor) {
this.operationMonitor = operationMonitor; this.operationMonitor = operationMonitor;
if (!gen.isCacheValid(operationMonitor)) {
store.clear();
store.commitChanges();
// con.remove(tree);
// con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
addChildrensToStore();
store.commitChanges();
tree.expandAll();
forceLayout();
}
store.clear();
store.commitChanges();
//con.remove(tree);
//con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
addChildrensToStore();
store.commitChanges();
tree.expandAll();
forceLayout();
} }
private void addChildrensToStore() { private void addChildrensToStore() {
gen = new MonitorTreeDataGenerator();
MonitorFolderDto root = gen.getRootNoTask(operationMonitor); MonitorFolderDto root = gen.getRootNoTask(operationMonitor);
if (root != null) { if (root != null) {
for (MonitorBaseDto base : root.getChildrens()) { for (MonitorBaseDto base : root.getChildrens()) {
@ -452,7 +452,7 @@ public class MonitorDetailPanel extends FramedPanel {
} }
} }
} else { } else {
Log.error("Error generating the task informations"); Log.error("Error generating the task informations");
UtilsGXT3.alert("Error", "Error generating task informations"); UtilsGXT3.alert("Error", "Error generating task informations");
@ -461,7 +461,7 @@ public class MonitorDetailPanel extends FramedPanel {
private void processFolder(TreeStore<MonitorBaseDto> store, private void processFolder(TreeStore<MonitorBaseDto> store,
MonitorFolderDto folder) { MonitorFolderDto folder) {
for (MonitorBaseDto child : folder.getChildrens()) { for (MonitorBaseDto child : folder.getChildrens()) {
try { try {
store.add(folder, child); store.add(folder, child);
@ -474,7 +474,7 @@ public class MonitorDetailPanel extends FramedPanel {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }

View File

@ -21,12 +21,86 @@ public class MonitorTreeDataGenerator {
.getFormat("yyyy-MM-dd HH:mm:ss"); .getFormat("yyyy-MM-dd HH:mm:ss");
private MonitorFolderDto root; private MonitorFolderDto root;
private TaskS taskSCache;
public MonitorTreeDataGenerator() { public MonitorTreeDataGenerator() {
Log.debug("MonitorTreeDataGenerator"); Log.debug("MonitorTreeDataGenerator");
} }
public boolean isCacheValid(OperationMonitor operationMonitor) {
if (operationMonitor == null || operationMonitor.getTask() == null) {
taskSCache = null;
return false;
}
TaskS taskS = operationMonitor.getTask();
if (taskSCache == null) {
taskSCache = taskS;
return false;
}
if (taskS.getId().compareTo(taskSCache.getId()) == 0) {
if (taskS.getProgress() == taskSCache.getProgress()
&& taskS.getState().compareTo(taskSCache.getState()) == 0) {
ArrayList<JobS> listJobS = taskS.getJobs();
ArrayList<JobS> listJobSCache = taskSCache.getJobs();
if (listJobS.size() == listJobSCache.size()) {
for (int i = 0; i < listJobS.size(); i++) {
JobS jobS = listJobS.get(i);
JobS jobSCache = listJobSCache.get(i);
if (jobS.getId() == jobSCache.getId()
&& jobS.getProgress() == jobSCache
.getProgress()
&& jobS.getWorkerState().compareTo(
jobSCache.getWorkerState()) == 0) {
ArrayList<ValidationsJobS> listValidationsJobS = jobS
.getValidationsJobS();
ArrayList<ValidationsJobS> listValidationsJobSCache = jobSCache
.getValidationsJobS();
if (listValidationsJobS.size() == listValidationsJobSCache
.size()) {
for (int j = 0; j < listValidationsJobS.size(); j++) {
ValidationsJobS validationsJobS = listValidationsJobS
.get(j);
ValidationsJobS validationsJobSCache = listValidationsJobSCache
.get(j);
if (validationsJobS.getId() == validationsJobSCache
.getId()
&& validationsJobS.getProgress() == validationsJobSCache
.getProgress()
&& validationsJobS
.getWorkerState()
.compareTo(
validationsJobSCache
.getWorkerState()) == 0) {
} else {
return false;
}
}
} else {
return false;
}
} else {
return false;
}
}
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
return true;
}
public MonitorFolderDto getRoot(OperationMonitor operationMonitor) { public MonitorFolderDto getRoot(OperationMonitor operationMonitor) {
root = null; root = null;
@ -51,10 +125,11 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto); validations.add(validationDto);
} }
MonitorJobSDto foldJob = new MonitorJobSDto("job", MonitorJobSDto foldJob = new MonitorJobSDto("job",
task.getId() + "-" + job.getId(),job.getJobClassifier(), task.getId() + "-" + job.getId(),
job.getDescription(), job.getWorkerState() job.getJobClassifier(), job.getDescription(), job
.toString(), job.getHumaReadableStatus(), .getWorkerState().toString(),
job.getProgress(), validations); job.getHumaReadableStatus(), job.getProgress(),
validations);
jobs.add(foldJob); jobs.add(foldJob);
} }
MonitorTaskSDto foldTask = new MonitorTaskSDto("task", MonitorTaskSDto foldTask = new MonitorTaskSDto("task",
@ -96,6 +171,7 @@ public class MonitorTreeDataGenerator {
ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>(); ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>();
if (operationMonitor != null && operationMonitor.getTask() != null) { if (operationMonitor != null && operationMonitor.getTask() != null) {
TaskS task = operationMonitor.getTask(); TaskS task = operationMonitor.getTask();
for (JobS job : task.getJobs()) { for (JobS job : task.getJobs()) {
ArrayList<MonitorBaseDto> validations = new ArrayList<MonitorBaseDto>(); ArrayList<MonitorBaseDto> validations = new ArrayList<MonitorBaseDto>();
for (ValidationsJobS v : job.getValidationsJobS()) { for (ValidationsJobS v : job.getValidationsJobS()) {
@ -109,10 +185,11 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto); validations.add(validationDto);
} }
MonitorJobSDto foldJob = new MonitorJobSDto("job", MonitorJobSDto foldJob = new MonitorJobSDto("job",
task.getId() + "-" + job.getId(),job.getJobClassifier(), task.getId() + "-" + job.getId(),
job.getDescription(), job.getWorkerState() job.getJobClassifier(), job.getDescription(), job
.toString(), job.getHumaReadableStatus(), .getWorkerState().toString(),
job.getProgress(), validations); job.getHumaReadableStatus(), job.getProgress(),
validations);
jobs.add(foldJob); jobs.add(foldJob);
} }
@ -165,8 +242,8 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto); validations.add(validationDto);
} }
MonitorJobSDto foldJob = new MonitorJobSDto( MonitorJobSDto foldJob = new MonitorJobSDto("job",
"job", task.getId() + "-" + job.getId(), task.getId() + "-" + job.getId(),
job.getJobClassifier(), job.getJobClassifier(),
job.getDescription(), job.getWorkerState() job.getDescription(), job.getWorkerState()
.toString(), .toString(),
@ -174,10 +251,10 @@ public class MonitorTreeDataGenerator {
job.getProgress(), validations); job.getProgress(), validations);
jobs.add(foldJob); jobs.add(foldJob);
} }
MonitorTaskSDto foldTask = new MonitorTaskSDto( MonitorTaskSDto foldTask = new MonitorTaskSDto("task",
"task", task.getId(), operationMonitor task.getId(), operationMonitor.getOperationId()
.getOperationId().toString(), task .toString(),
.getState().toString(), "", task.getState().toString(), "",
task.getProgress(), jobs); task.getProgress(), jobs);
if (task.getStartTime() != null) { if (task.getStartTime() != null) {
foldTask.setStartTime(sdf.format(task foldTask.setStartTime(sdf.format(task

View File

@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.monitorwidget.client.resources;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;
public interface ResourceBundle extends ClientBundle { public interface ResourceBundle extends ClientBundle {

View File

@ -23,7 +23,7 @@
<!-- Specify the app entry point class. --> <!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.monitorwidget.client.MonitorWidgetEntry' /> --> <!-- <entry-point class='org.gcube.portlets.user.td.monitorwidget.client.MonitorWidgetEntry' /> -->
<!-- Logger --> <!-- Logger -->
<!-- <set-property name="log_DivLogger" value="ENABLED" /> <!-- <set-property name="log_DivLogger" value="ENABLED" />

View File

@ -22,7 +22,7 @@
<!-- Servlets Mapping --> <!-- Servlets Mapping -->
<servlet-mapping> <servlet-mapping>
<servlet-name>TDGWTService</servlet-name> <servlet-name>TDGWTService</servlet-name>
<url-pattern>tdgwtservice/TDGWTService</url-pattern> <url-pattern>/MonitorWidgetTD/TDGWTService</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name> <servlet-name>jUnitHostImpl</servlet-name>