Added JobClassifier

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@113603 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-13 15:51:26 +00:00 committed by Giancarlo Panichi
parent 6b1c225847
commit b0e5caab03
20 changed files with 204 additions and 32 deletions

View File

@ -6,6 +6,7 @@ import java.util.Date;
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitor;
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.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS;
@ -135,28 +136,28 @@ public class MonitorWidgetEntry implements EntryPoint {
validationsJobs.add(validationJobS);
ArrayList<JobS> jobs = new ArrayList<JobS>();
JobS job1 = new JobS("1", genProgress(), "Edit Row Job for Human",
JobS job1 = new JobS("1", genProgress(), "Edit Row Job for Human",JobSClassifier.PROCESSING,
"Edit Row Job", WorkerState.IN_PROGRESS, null, validationsJobs);
jobs.add(job1);
JobS job2 = new JobS("2", genProgress(), "Add Row Job for Human",
JobS job2 = new JobS("2", genProgress(), "Add Row Job for Human",JobSClassifier.PROCESSING,
"Add Row Job", WorkerState.IN_PROGRESS, null, validationsJobs);
jobs.add(job2);
JobS job3 = new JobS("3", genProgress(), "Delete Job for Human",
JobS job3 = new JobS("3", genProgress(), "Delete Job for Human",JobSClassifier.PROCESSING,
"Delete Row Job", WorkerState.IN_PROGRESS, null,
validationsJobs);
jobs.add(job3);
JobS job4 = new JobS("4", genProgress(), "Edit Row Job for Human",
JobS job4 = new JobS("4", genProgress(), "Edit Row Job for Human",JobSClassifier.PROCESSING,
"Edit Row Job", WorkerState.IN_PROGRESS, null, validationsJobs);
jobs.add(job4);
JobS job5 = new JobS("5", genProgress(), "Add Row Job for Human",
JobS job5 = new JobS("5", genProgress(), "Add Row Job for Human",JobSClassifier.PROCESSING,
"Add Row Job", WorkerState.IN_PROGRESS, null, validationsJobs);
jobs.add(job5);
JobS job6 = new JobS("6", genProgress(), "Delete Job for Human",
JobS job6 = new JobS("6", genProgress(), "Delete Job for Human",JobSClassifier.PROCESSING,
"Delete Row Job", WorkerState.IN_PROGRESS, null,
validationsJobs);
jobs.add(job6);

View File

@ -4,10 +4,13 @@ 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.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.WorkerState;
import org.gcube.portlets.user.td.monitorwidget.client.custom.ExtendedTreeGridView;
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.MonitorJobSDto;
import org.gcube.portlets.user.td.monitorwidget.client.details.tree.MonitorTaskSDto;
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;
@ -16,13 +19,15 @@ import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
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.core.client.GWT;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeHtml;
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.XTemplates;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.IconProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
@ -52,7 +57,17 @@ public class MonitorDetailPanel extends FramedPanel {
private static final int CC2WIDTH = 100;
private static final int CC3WIDTH = 140;
private static final int CC4WIDTH = 100;
interface DtoTemplates extends XTemplates {
@XTemplate("<span title=\"{id} - {value}\">{value}</span>")
SafeHtml format(String id, String value);
/*"<span title='"
+ SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value)
+ "</span>"*/
}
private VerticalLayoutContainer con;
@ -107,9 +122,36 @@ public class MonitorDetailPanel extends FramedPanel {
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<span title='"
+ SafeHtmlUtils.htmlEscape(value) + "'>"
+ SafeHtmlUtils.htmlEscape(value) + "</span>");
String key = (String) context.getKey();
MonitorBaseDto d = store.findModelWithKey(key);
DtoTemplates dtoTemplates = GWT.create(DtoTemplates.class);
if (d instanceof MonitorTaskSDto) {
sb.append(dtoTemplates.format("Task", value));
} else {
if (d instanceof MonitorJobSDto) {
MonitorJobSDto jobSDto = (MonitorJobSDto) d;
String label = jobSDto.getJobClassfier().getLabel();
String response;
if (label == null||label.isEmpty()) {
response = "Job";
} else {
response = "Job "+label;
}
sb.append(dtoTemplates.format(response, value));
} else {
if (d instanceof MonitorValidationJobSDto) {
sb.append(dtoTemplates.format("Validation", value));
} else{
sb.append(dtoTemplates.format("", value));
}
}
}
}
});
@ -259,20 +301,56 @@ public class MonitorDetailPanel extends FramedPanel {
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();
if (model instanceof MonitorJobSDto) {
MonitorJobSDto jobSDto = (MonitorJobSDto) model;
JobSClassifier jobClassifier = jobSDto
.getJobClassfier();
if (jobClassifier == null) {
img = ResourceBundle.INSTANCE.cog();
} else {
switch (jobClassifier) {
case DATAVALIDATION:
img = ResourceBundle.INSTANCE
.cogDataValidation();
break;
case POSTPROCESSING:
img = ResourceBundle.INSTANCE
.cogPostprocessing();
break;
case PREPROCESSING:
img = ResourceBundle.INSTANCE
.cogPreprocessing();
break;
case PROCESSING:
img = ResourceBundle.INSTANCE.cog();
break;
case UNKNOWN:
img = ResourceBundle.INSTANCE.cog();
break;
default:
img = ResourceBundle.INSTANCE.cog();
break;
}
}
} else {
if (type.compareTo("task") == 0) {
if (model instanceof MonitorTaskSDto) {
img = ResourceBundle.INSTANCE.basket();
} else {
}
}
} else {
img = ResourceBundle.INSTANCE.tableValidation();
if (model instanceof MonitorValidationJobSDto) {
img = ResourceBundle.INSTANCE.tableValidation();
} else {
img = ResourceBundle.INSTANCE.tableValidation();
}
}
return img;
return img;
}
};
tree.setIconProvider(iconProvider);

View File

@ -11,14 +11,14 @@ import java.util.ArrayList;
public class MonitorFolderDto extends MonitorBaseDto {
private static final long serialVersionUID = 4644048540524701598L;
private String description;
private ArrayList<MonitorBaseDto> childrens;
private String type;
private String state;
private String humanReadableStatus;
private float progress;
private String startTime;
private String endTime;
protected String description;
protected ArrayList<MonitorBaseDto> childrens;
protected String type;
protected String state;
protected String humanReadableStatus;
protected float progress;
protected String startTime;
protected String endTime;
public MonitorFolderDto(){

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.user.td.monitorwidget.client.details.tree;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class MonitorJobSDto extends MonitorFolderDto {
private static final long serialVersionUID = 4644048540524701598L;
private JobSClassifier jobClassifier;
public MonitorJobSDto(){
super();
}
public MonitorJobSDto(String type,String id, JobSClassifier jobClassifier,String description, String state,
String humanReadableStatus, float progress, ArrayList<MonitorBaseDto> childrens){
super(type, id, description, state,humanReadableStatus,progress, childrens);
this.jobClassifier=jobClassifier;
}
public JobSClassifier getJobClassfier() {
return jobClassifier;
}
public void setJobClassfier(JobSClassifier jobClassfier) {
this.jobClassifier = jobClassfier;
}
@Override
public String toString() {
return description;
}
}

View File

@ -0,0 +1,29 @@
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 MonitorTaskSDto extends MonitorFolderDto {
private static final long serialVersionUID = 4644048540524701598L;
public MonitorTaskSDto() {
super();
}
public MonitorTaskSDto(String type, String id, String description,
String state, String humanReadableStatus, float progress,
ArrayList<MonitorBaseDto> childrens) {
super(type, id, description, state, humanReadableStatus, progress,
childrens);
}
}

View File

@ -50,14 +50,14 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto);
}
MonitorFolderDto foldJob = new MonitorFolderDto("job",
task.getId() + "-" + job.getId(),
MonitorJobSDto foldJob = new MonitorJobSDto("job",
task.getId() + "-" + job.getId(),job.getJobClassifier(),
job.getDescription(), job.getWorkerState()
.toString(), job.getHumaReadableStatus(),
job.getProgress(), validations);
jobs.add(foldJob);
}
MonitorFolderDto foldTask = new MonitorFolderDto("task",
MonitorTaskSDto foldTask = new MonitorTaskSDto("task",
task.getId(), operationMonitor.getOperationId()
.toString(), task.getState().toString(), "",
task.getProgress(), jobs);
@ -108,8 +108,8 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto);
}
MonitorFolderDto foldJob = new MonitorFolderDto("job",
task.getId() + "-" + job.getId(),
MonitorJobSDto foldJob = new MonitorJobSDto("job",
task.getId() + "-" + job.getId(),job.getJobClassifier(),
job.getDescription(), job.getWorkerState()
.toString(), job.getHumaReadableStatus(),
job.getProgress(), validations);
@ -165,15 +165,16 @@ public class MonitorTreeDataGenerator {
validations.add(validationDto);
}
MonitorFolderDto foldJob = new MonitorFolderDto(
MonitorJobSDto foldJob = new MonitorJobSDto(
"job", task.getId() + "-" + job.getId(),
job.getJobClassifier(),
job.getDescription(), job.getWorkerState()
.toString(),
job.getHumaReadableStatus(),
job.getProgress(), validations);
jobs.add(foldJob);
}
MonitorFolderDto foldTask = new MonitorFolderDto(
MonitorTaskSDto foldTask = new MonitorTaskSDto(
"task", task.getId(), operationMonitor
.getOperationId().toString(), task
.getState().toString(), "",

View File

@ -66,6 +66,8 @@ public class MonitorValidationJobSDto extends MonitorBaseDto {
this.progress = progress;
}
public String getDescription() {
return description;
}

View File

@ -3,6 +3,7 @@ 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;
import com.google.gwt.resources.client.ClientBundle.Source;
public interface ResourceBundle extends ClientBundle {
@ -35,7 +36,25 @@ public interface ResourceBundle extends ClientBundle {
@Source("cog_32.png")
ImageResource cog32();
@Source("cog-preprocessing.png")
ImageResource cogPreprocessing();
@Source("cog-preprocessing_32.png")
ImageResource cogPreprocessing32();
@Source("cog-postprocessing.png")
ImageResource cogPostprocessing();
@Source("cog-postprocessing_32.png")
ImageResource cogPostprocessing32();
@Source("cog-datavalidation.png")
ImageResource cogDataValidation();
@Source("cog-datavalidation_32.png")
ImageResource cogDataValidation32();
@Source("basket.png")
ImageResource basket();

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB