Added JobClassifier

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@113604 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-13 15:51:38 +00:00 committed by Giancarlo Panichi
parent 72a5d18873
commit 528c81f578
18 changed files with 249 additions and 74 deletions

View File

@ -88,6 +88,25 @@ public interface ResourceBundle extends ClientBundle {
@Source("cog_32.png") @Source("cog_32.png")
ImageResource cog32(); 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") @Source("basket.png")
ImageResource basket(); 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

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalExcept
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS; import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata; import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode; import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
@ -19,6 +20,8 @@ import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.BaseDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.BaseDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.FolderDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.FolderDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.JobSDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TaskSDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TreeDataGenerator; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TreeDataGenerator;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
@ -37,6 +40,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.operations.Operations
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell.Context; import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.BrowserEvents;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
@ -44,12 +48,13 @@ import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.resources.client.ImageResource; 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.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.core.client.ToStringValueProvider; import com.sencha.gxt.core.client.ToStringValueProvider;
import com.sencha.gxt.core.client.ValueProvider; import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.IconProvider; import com.sencha.gxt.data.shared.IconProvider;
@ -84,22 +89,32 @@ import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
*/ */
public class ValidationsTasksPanel extends FramedPanel implements public class ValidationsTasksPanel extends FramedPanel implements
MonitorDialogListener { MonitorDialogListener {
protected String WIDTH = "298px"; interface DtoTemplates extends XTemplates {
protected String HEIGHT = "520px"; @XTemplate("<span title=\"{id} - {value}\">{value}</span>")
protected ValidationsTasksPanel thisPanel; SafeHtml format(String id, String value);
protected Menu contextMenu; /*"<span title='"
protected MenuItem resumeItem; + SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value)
protected MenuItem resolveItem; + "</span>"*/
protected TRId trId;
protected VerticalLayoutContainer con;
protected EventBus eventBus;
protected ValidationsTasksMetadata validationsTasksMetadata;
protected TreeDataGenerator gen; }
protected TreeStore<BaseDto> store;
protected TreeGrid<BaseDto> tree; private static final String WIDTH = "298px";
private static final String HEIGHT = "520px";
private Menu contextMenu;
private MenuItem resumeItem;
private MenuItem resolveItem;
private TRId trId;
private VerticalLayoutContainer con;
private EventBus eventBus;
private ValidationsTasksMetadata validationsTasksMetadata;
private TreeDataGenerator gen;
private TreeStore<BaseDto> store;
private TreeGrid<BaseDto> tree;
private boolean updateTR; private boolean updateTR;
class KeyProvider implements ModelKeyProvider<BaseDto> { class KeyProvider implements ModelKeyProvider<BaseDto> {
@ -117,7 +132,6 @@ public class ValidationsTasksPanel extends FramedPanel implements
super(); super();
Log.debug("ValidationsTasksPanel"); Log.debug("ValidationsTasksPanel");
this.eventBus = eventBus; this.eventBus = eventBus;
this.thisPanel = this;
forceLayoutOnResize = true; forceLayoutOnResize = true;
updateTR = false; updateTR = false;
init(); init();
@ -135,7 +149,6 @@ public class ValidationsTasksPanel extends FramedPanel implements
Log.debug("ValidationsTasksPanel: " + trId); Log.debug("ValidationsTasksPanel: " + trId);
this.trId = trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
this.thisPanel = this;
forceLayoutOnResize = true; forceLayoutOnResize = true;
updateTR = false; updateTR = false;
init(); init();
@ -180,10 +193,33 @@ public class ValidationsTasksPanel extends FramedPanel implements
@Override @Override
public void render(Context context, String value, SafeHtmlBuilder sb) { public void render(Context context, String value, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<span title='" String key = (String) context.getKey();
+ SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value) BaseDto d = store.findModelWithKey(key);
+ "</span>"); DtoTemplates dtoTemplates = GWT.create(DtoTemplates.class);
if (d instanceof TaskSDto) {
sb.append(dtoTemplates.format("Task", value));
} else {
if (d instanceof JobSDto) {
JobSDto jobSDto = (JobSDto) 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 ValidationDto) {
sb.append(dtoTemplates.format("Validation", value));
} else{
sb.append(dtoTemplates.format("", value));
}
}
}
} }
}); });
@ -228,17 +264,18 @@ public class ValidationsTasksPanel extends FramedPanel implements
Element el = tree.getView().getCell(rowIndex, columnIndex); Element el = tree.getView().getCell(rowIndex, columnIndex);
NativeEvent contextEvent = Document.get().createMouseEvent(BrowserEvents.CONTEXTMENU, true, true,0, 0, 0, NativeEvent contextEvent = Document.get().createMouseEvent(
el.getAbsoluteLeft(), el.getAbsoluteTop(), false, false, false, false, BrowserEvents.CONTEXTMENU, true, true, 0, 0, 0,
NativeEvent.BUTTON_RIGHT, null); el.getAbsoluteLeft(), el.getAbsoluteTop(), false,
false, false, false, NativeEvent.BUTTON_RIGHT, null);
//NativeEvent contextEvent = Document.get().createContextMenuEvent(); // NativeEvent contextEvent =
// Document.get().createContextMenuEvent();
el.dispatchEvent(contextEvent); el.dispatchEvent(contextEvent);
// DomEvent // DomEvent
} }
}); });
cc2.setCell(validationButton); cc2.setCell(validationButton);
List<ColumnConfig<BaseDto, ?>> l = new ArrayList<ColumnConfig<BaseDto, ?>>(); List<ColumnConfig<BaseDto, ?>> l = new ArrayList<ColumnConfig<BaseDto, ?>>();
@ -260,18 +297,53 @@ public class ValidationsTasksPanel extends FramedPanel implements
public ImageResource getIcon(BaseDto model) { public ImageResource getIcon(BaseDto model) {
ImageResource img = null; ImageResource img = null;
if (model instanceof FolderDto) { if (model instanceof FolderDto) {
String type = ((FolderDto) model).getType(); if (model instanceof JobSDto) {
if (type.compareTo("job") == 0) { JobSDto jobSDto = (JobSDto) model;
JobSClassifier jobClassifier = jobSDto
.getJobClassfier();
if (jobClassifier == null) {
img = ResourceBundle.INSTANCE.cog(); img = ResourceBundle.INSTANCE.cog();
} else { } else {
if (type.compareTo("task") == 0) { 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 (model instanceof TaskSDto) {
img = ResourceBundle.INSTANCE.basket(); img = ResourceBundle.INSTANCE.basket();
} else { } else {
} }
} }
} else { } else {
if (model instanceof ValidationDto) {
img = ResourceBundle.INSTANCE.tableValidation(); img = ResourceBundle.INSTANCE.tableValidation();
} else {
img = ResourceBundle.INSTANCE.tableValidation();
}
} }
return img; return img;
} }
@ -376,8 +448,7 @@ public class ValidationsTasksPanel extends FramedPanel implements
WidgetRequestType.CURATIONBYREPLACEBATCHDIALOG); WidgetRequestType.CURATIONBYREPLACEBATCHDIALOG);
widgetRequestEvent.setTrId(trId); widgetRequestEvent.setTrId(trId);
HashMap<RequestPropertiesParameterType, Object> map = new HashMap<RequestPropertiesParameterType, Object>(); HashMap<RequestPropertiesParameterType, Object> map = new HashMap<RequestPropertiesParameterType, Object>();
map.put(RequestPropertiesParameterType.InvocationS map.put(RequestPropertiesParameterType.InvocationS,
,
invocationS); invocationS);
map.put(RequestPropertiesParameterType.ConditionCode, map.put(RequestPropertiesParameterType.ConditionCode,
v.getConditionCode()); v.getConditionCode());
@ -661,7 +732,8 @@ public class ValidationsTasksPanel extends FramedPanel implements
public void operationComplete(OperationResult operationResult) { public void operationComplete(OperationResult operationResult) {
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED; ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(), why); ChangeTableRequestType.TASKRESUME, operationResult.getTrId(),
why);
eventBus.fireEvent(changeTableRequestEvent); eventBus.fireEvent(changeTableRequestEvent);
close(); close();
} }
@ -674,10 +746,12 @@ public class ValidationsTasksPanel extends FramedPanel implements
} }
@Override @Override
public void operationStopped(OperationResult operationResult, String reason, String details) { public void operationStopped(OperationResult operationResult,
String reason, String details) {
ChangeTableWhy why = ChangeTableWhy.TABLECURATION; ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(), why); ChangeTableRequestType.TASKRESUME, operationResult.getTrId(),
why);
eventBus.fireEvent(changeTableRequestEvent); eventBus.fireEvent(changeTableRequestEvent);
close(); close();
@ -695,6 +769,4 @@ public class ValidationsTasksPanel extends FramedPanel implements
} }
} }

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.td.tablewidget.client.validation.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 JobSDto extends FolderDto {
private static final long serialVersionUID = 4644048540524701598L;
private JobSClassifier jobClassifier;
public JobSDto(){
super();
}
public JobSDto(String type,String id,JobSClassifier jobClassifier,String description, ArrayList<BaseDto> childrens){
super(type,id,description,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,26 @@
package org.gcube.portlets.user.td.tablewidget.client.validation.tree;
import java.util.ArrayList;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TaskSDto extends FolderDto {
private static final long serialVersionUID = 4644048540524701598L;
public TaskSDto(){
}
public TaskSDto(String type,String id,String description, ArrayList<BaseDto> childrens){
super(type,id,description,childrens);
}
}

View File

@ -32,14 +32,14 @@ public class TreeDataGenerator {
ArrayList<BaseDto> validations = new ArrayList<BaseDto>(); ArrayList<BaseDto> validations = new ArrayList<BaseDto>();
for (Validations v : job.getValidations()) { for (Validations v : job.getValidations()) {
ValidationDto validationDto = new ValidationDto(task.getId()+"-"+job.getId()+"-"+v.getId(), ValidationDto validationDto = new ValidationDto(task.getId()+"-"+job.getId()+"-"+v.getId(),
v.getDescription(), v.isValid(), v.getConditionCode(), v.getValidationColumnColumnId(),job.getInvocation()); v.getTitle(), v.getDescription(), v.isValid(), v.getConditionCode(), v.getValidationColumnColumnId(),job.getInvocation());
validations.add(validationDto); validations.add(validationDto);
} }
FolderDto foldJob = new FolderDto("job",task.getId()+"-"+job.getId(), JobSDto foldJob = new JobSDto("job",task.getId()+"-"+job.getId(),
job.getDescription(), validations); job.getJobClassifier(),job.getDescription(), validations);
jobs.add(foldJob); jobs.add(foldJob);
} }
FolderDto foldTask = new FolderDto("task",task.getId(), TaskSDto foldTask = new TaskSDto("task",task.getId(),
sdf.format(task.getStartTime()), jobs); sdf.format(task.getStartTime()), jobs);
childrens.add(foldTask); childrens.add(foldTask);
} }

View File

@ -5,20 +5,20 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" email: <a
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class ValidationDto extends BaseDto { public class ValidationDto extends BaseDto {
private static final long serialVersionUID = -4353641080571614057L; private static final long serialVersionUID = -4353641080571614057L;
protected String description; private String title;
protected Boolean valid; private String description;
protected InvocationS invocation; private Boolean valid;
protected ConditionCode conditionCode; private InvocationS invocation;
protected String validationColumnColumnId; private ConditionCode conditionCode;
private String validationColumnColumnId;
public ValidationDto() { public ValidationDto() {
@ -33,8 +33,11 @@ public class ValidationDto extends BaseDto {
* @param validationColumnColumnId * @param validationColumnColumnId
* @param invocation * @param invocation
*/ */
public ValidationDto(String id,String description, Boolean valid,ConditionCode conditionCode, String validationColumnColumnId,InvocationS invocation){ public ValidationDto(String id, String title, String description,
Boolean valid, ConditionCode conditionCode,
String validationColumnColumnId, InvocationS invocation) {
super(id); super(id);
this.title = title;
this.description = description; this.description = description;
this.valid = valid; this.valid = valid;
this.conditionCode = conditionCode; this.conditionCode = conditionCode;
@ -43,6 +46,13 @@ public class ValidationDto extends BaseDto {
} }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() { public String getDescription() {
return description; return description;
@ -86,10 +96,13 @@ public class ValidationDto extends BaseDto {
@Override @Override
public String toString() { public String toString() {
return description; String response;
if(title==null || title.isEmpty()){
response=description;
} else {
response=title+": "+description;
}
return response;
} }
} }

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