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
|
@ -88,6 +88,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();
|
||||
|
||||
|
|
After Width: | Height: | Size: 979 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 953 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1021 B |
After Width: | Height: | Size: 2.5 KiB |
|
@ -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.TDGWTSessionExpiredException;
|
||||
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.ValidationsTasksMetadata;
|
||||
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.validation.tree.BaseDto;
|
||||
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.ValidationDto;
|
||||
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.google.gwt.cell.client.AbstractCell;
|
||||
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.Document;
|
||||
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.SelectionHandler;
|
||||
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.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
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.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
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
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "298px";
|
||||
protected String HEIGHT = "520px";
|
||||
protected ValidationsTasksPanel thisPanel;
|
||||
interface DtoTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{id} - {value}\">{value}</span>")
|
||||
SafeHtml format(String id, String value);
|
||||
|
||||
protected Menu contextMenu;
|
||||
protected MenuItem resumeItem;
|
||||
protected MenuItem resolveItem;
|
||||
/*"<span title='"
|
||||
+ SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value)
|
||||
+ "</span>"*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected TRId trId;
|
||||
protected VerticalLayoutContainer con;
|
||||
protected EventBus eventBus;
|
||||
protected ValidationsTasksMetadata validationsTasksMetadata;
|
||||
private static final String WIDTH = "298px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
protected TreeDataGenerator gen;
|
||||
protected TreeStore<BaseDto> store;
|
||||
protected TreeGrid<BaseDto> tree;
|
||||
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;
|
||||
|
||||
class KeyProvider implements ModelKeyProvider<BaseDto> {
|
||||
|
@ -117,7 +132,6 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
super();
|
||||
Log.debug("ValidationsTasksPanel");
|
||||
this.eventBus = eventBus;
|
||||
this.thisPanel = this;
|
||||
forceLayoutOnResize = true;
|
||||
updateTR = false;
|
||||
init();
|
||||
|
@ -135,7 +149,6 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
Log.debug("ValidationsTasksPanel: " + trId);
|
||||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
this.thisPanel = this;
|
||||
forceLayoutOnResize = true;
|
||||
updateTR = false;
|
||||
init();
|
||||
|
@ -180,10 +193,33 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
|
||||
@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();
|
||||
BaseDto d = store.findModelWithKey(key);
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -215,30 +251,31 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
validationButton.setFalseIcon(ResourceBundle.INSTANCE.error());
|
||||
validationButton.setTrueTitle("Valid");
|
||||
validationButton.setFalseTitle("Error");
|
||||
|
||||
|
||||
validationButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Button Pressed");
|
||||
|
||||
|
||||
Context c = event.getContext();
|
||||
int rowIndex = c.getIndex();
|
||||
int columnIndex=c.getColumn();
|
||||
|
||||
Element el=tree.getView().getCell(rowIndex, columnIndex);
|
||||
|
||||
NativeEvent contextEvent = Document.get().createMouseEvent(BrowserEvents.CONTEXTMENU, true, true,0, 0, 0,
|
||||
el.getAbsoluteLeft(), el.getAbsoluteTop(), false, false, false, false,
|
||||
NativeEvent.BUTTON_RIGHT, null);
|
||||
|
||||
//NativeEvent contextEvent = Document.get().createContextMenuEvent();
|
||||
int columnIndex = c.getColumn();
|
||||
|
||||
Element el = tree.getView().getCell(rowIndex, columnIndex);
|
||||
|
||||
NativeEvent contextEvent = Document.get().createMouseEvent(
|
||||
BrowserEvents.CONTEXTMENU, true, true, 0, 0, 0,
|
||||
el.getAbsoluteLeft(), el.getAbsoluteTop(), false,
|
||||
false, false, false, NativeEvent.BUTTON_RIGHT, null);
|
||||
|
||||
// NativeEvent contextEvent =
|
||||
// Document.get().createContextMenuEvent();
|
||||
el.dispatchEvent(contextEvent);
|
||||
//DomEvent
|
||||
// DomEvent
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
cc2.setCell(validationButton);
|
||||
|
||||
List<ColumnConfig<BaseDto, ?>> l = new ArrayList<ColumnConfig<BaseDto, ?>>();
|
||||
|
@ -260,18 +297,53 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
public ImageResource getIcon(BaseDto model) {
|
||||
ImageResource img = null;
|
||||
if (model instanceof FolderDto) {
|
||||
String type = ((FolderDto) model).getType();
|
||||
if (type.compareTo("job") == 0) {
|
||||
img = ResourceBundle.INSTANCE.cog();
|
||||
if (model instanceof JobSDto) {
|
||||
JobSDto jobSDto = (JobSDto) 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 TaskSDto) {
|
||||
img = ResourceBundle.INSTANCE.basket();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
img = ResourceBundle.INSTANCE.tableValidation();
|
||||
if (model instanceof ValidationDto) {
|
||||
img = ResourceBundle.INSTANCE.tableValidation();
|
||||
} else {
|
||||
img = ResourceBundle.INSTANCE.tableValidation();
|
||||
}
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
@ -376,8 +448,7 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
WidgetRequestType.CURATIONBYREPLACEBATCHDIALOG);
|
||||
widgetRequestEvent.setTrId(trId);
|
||||
HashMap<RequestPropertiesParameterType, Object> map = new HashMap<RequestPropertiesParameterType, Object>();
|
||||
map.put(RequestPropertiesParameterType.InvocationS
|
||||
,
|
||||
map.put(RequestPropertiesParameterType.InvocationS,
|
||||
invocationS);
|
||||
map.put(RequestPropertiesParameterType.ConditionCode,
|
||||
v.getConditionCode());
|
||||
|
@ -661,7 +732,8 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
public void operationComplete(OperationResult operationResult) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(), why);
|
||||
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(),
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
}
|
||||
|
@ -674,10 +746,12 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
||||
public void operationStopped(OperationResult operationResult,
|
||||
String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(), why);
|
||||
ChangeTableRequestType.TASKRESUME, operationResult.getTrId(),
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
|
@ -695,6 +769,4 @@ public class ValidationsTasksPanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -32,14 +32,14 @@ public class TreeDataGenerator {
|
|||
ArrayList<BaseDto> validations = new ArrayList<BaseDto>();
|
||||
for (Validations v : job.getValidations()) {
|
||||
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);
|
||||
}
|
||||
FolderDto foldJob = new FolderDto("job",task.getId()+"-"+job.getId(),
|
||||
job.getDescription(), validations);
|
||||
JobSDto foldJob = new JobSDto("job",task.getId()+"-"+job.getId(),
|
||||
job.getJobClassifier(),job.getDescription(), validations);
|
||||
jobs.add(foldJob);
|
||||
}
|
||||
FolderDto foldTask = new FolderDto("task",task.getId(),
|
||||
TaskSDto foldTask = new TaskSDto("task",task.getId(),
|
||||
sdf.format(task.getStartTime()), jobs);
|
||||
childrens.add(foldTask);
|
||||
}
|
||||
|
|
|
@ -5,25 +5,25 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ValidationDto extends BaseDto {
|
||||
|
||||
private static final long serialVersionUID = -4353641080571614057L;
|
||||
|
||||
protected String description;
|
||||
protected Boolean valid;
|
||||
protected InvocationS invocation;
|
||||
protected ConditionCode conditionCode;
|
||||
protected String validationColumnColumnId;
|
||||
|
||||
|
||||
public ValidationDto(){
|
||||
|
||||
private String title;
|
||||
private String description;
|
||||
private Boolean valid;
|
||||
private InvocationS invocation;
|
||||
private ConditionCode conditionCode;
|
||||
private String validationColumnColumnId;
|
||||
|
||||
public ValidationDto() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
|
@ -33,17 +33,27 @@ public class ValidationDto extends BaseDto {
|
|||
* @param validationColumnColumnId
|
||||
* @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);
|
||||
this.description=description;
|
||||
this.valid=valid;
|
||||
this.conditionCode=conditionCode;
|
||||
this.validationColumnColumnId=validationColumnColumnId;
|
||||
this.invocation=invocation;
|
||||
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.valid = valid;
|
||||
this.conditionCode = conditionCode;
|
||||
this.validationColumnColumnId = validationColumnColumnId;
|
||||
this.invocation = invocation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
@ -86,10 +96,13 @@ public class ValidationDto extends BaseDto {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description;
|
||||
String response;
|
||||
if(title==null || title.isEmpty()){
|
||||
response=description;
|
||||
} else {
|
||||
response=title+": "+description;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 979 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 953 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1021 B |
After Width: | Height: | Size: 2.5 KiB |