diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java
index a83a35a..8a0c18f 100644
--- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java
@@ -69,5 +69,11 @@ public interface ResourceBundle extends ClientBundle {
@Source("arrow-undo-all_32.png")
ImageResource undoAll32();
+
+ @Source("table-validation.png")
+ ImageResource tableValidation();
+
+ @Source("table-validation_32.png")
+ ImageResource tableValidation32();
}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png
new file mode 100644
index 0000000..eee1001
Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png differ
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png
new file mode 100644
index 0000000..c253439
Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png differ
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java
new file mode 100644
index 0000000..4c7dfaf
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java
@@ -0,0 +1,269 @@
+package org.gcube.portlets.user.td.tablewidget.client.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
+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.TreeDataGenerator;
+import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+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.dom.ScrollSupport.ScrollMode;
+import com.sencha.gxt.data.shared.ModelKeyProvider;
+import com.sencha.gxt.data.shared.TreeStore;
+import com.sencha.gxt.widget.core.client.FramedPanel;
+import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
+import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
+import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
+import com.sencha.gxt.widget.core.client.grid.ColumnModel;
+import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class ValidationsTasksPanel extends FramedPanel {
+ protected String WIDTH = "298px";
+ protected String HEIGHT = "520px";
+
+ protected TRId trId;
+ protected VerticalLayoutContainer vl;
+ protected EventBus eventBus;
+ protected ValidationsTasksMetadata validationsTasksMetadata;
+
+ protected TreeDataGenerator gen;
+ protected TreeStore store;
+
+ class KeyProvider implements ModelKeyProvider {
+ @Override
+ public String getKey(BaseDto item) {
+ return (item instanceof FolderDto ? "f-" : "m-")
+ + item.getId().toString();
+ }
+ }
+
+ public ValidationsTasksPanel(EventBus eventBus) {
+ super();
+ this.eventBus = eventBus;
+ forceLayoutOnResize = true;
+ retrieveCurrentTR();
+
+ }
+
+ public ValidationsTasksPanel(TRId trId, EventBus eventBus) {
+ super();
+ this.trId = trId;
+ this.eventBus = eventBus;
+ forceLayoutOnResize = true;
+ draw();
+ }
+
+ protected void draw() {
+ init();
+ retrieveValidations();
+ }
+
+ protected void init() {
+ setWidth(WIDTH);
+ setHeight(HEIGHT);
+ setHeaderVisible(false);
+ setBodyBorder(false);
+ }
+
+ protected void createTreeData(){
+ gen=new TreeDataGenerator(validationsTasksMetadata);
+ create();
+ }
+
+ protected void create() {
+ vl = new VerticalLayoutContainer();
+ vl.setScrollMode(ScrollMode.AUTO);
+ vl.setAdjustForScroll(true);
+ this.add(vl);
+
+ store = new TreeStore(new KeyProvider());
+
+ FolderDto root = gen.getRoot();
+ for (BaseDto base : root.getChildren()) {
+ store.add(base);
+ if (base instanceof FolderDto) {
+ processFolder(store, (FolderDto) base);
+ }
+ }
+
+ ColumnConfig cc1 = new ColumnConfig(
+ new ToStringValueProvider("task"));
+ cc1.setHeader("Task");
+
+ ColumnConfig cc2 = new ColumnConfig(
+ new ValueProvider() {
+
+ @Override
+ public String getValue(BaseDto object) {
+ return object instanceof ValidationDto ? ((ValidationDto) object)
+ .getDescription() : "";
+ }
+
+ @Override
+ public void setValue(BaseDto object, String value) {
+ if (object instanceof ValidationDto) {
+ ((ValidationDto) object).setDescription(value);
+ }
+ }
+
+ @Override
+ public String getPath() {
+ return "description";
+ }
+ });
+ cc2.setHeader("Description");
+
+ ColumnConfig cc3 = new ColumnConfig(
+ new ValueProvider() {
+
+ @Override
+ public Boolean getValue(BaseDto object) {
+ return object instanceof ValidationDto ? ((ValidationDto) object)
+ .getValid() : false;
+ }
+
+ @Override
+ public void setValue(BaseDto object, Boolean value) {
+ if (object instanceof ValidationDto) {
+ ((ValidationDto) object).setValid(value);
+ }
+ }
+
+ @Override
+ public String getPath() {
+ return "valid";
+ }
+ });
+ cc3.setHeader("Valid");
+ cc3.setCell(new AbstractCell() {
+
+ @Override
+ public void render(Context context, Boolean value,
+ SafeHtmlBuilder sb) {
+
+ if (value) {
+ sb.appendHtmlConstant("
");
+
+ } else {
+ sb.appendHtmlConstant("
");
+
+ }
+
+ }
+ });
+
+ List> l = new ArrayList>();
+ l.add(cc1);
+ l.add(cc2);
+ l.add(cc3);
+ ColumnModel cm = new ColumnModel(l);
+
+ final TreeGrid tree = new TreeGrid(store, cm, cc1);
+ tree.getStyle().setLeafIcon(ResourceBundle.INSTANCE.tableValidation());
+ tree.getView().setAutoExpandColumn(cc1);
+ /*
+ * ToolBar buttonBar = new ToolBar();
+ *
+ * buttonBar.add(new TextButton("Expand All", new SelectHandler() {
+ *
+ * @Override public void onSelect(SelectEvent event) { tree.expandAll();
+ * } })); buttonBar.add(new TextButton("Collapse All", new
+ * SelectHandler() {
+ *
+ * @Override public void onSelect(SelectEvent event) {
+ * tree.collapseAll(); } }));
+ *
+ * v.add(buttonBar, new VerticalLayoutData(1, -1));
+ */
+ vl.add(tree, new VerticalLayoutData(1, 1));
+
+ }
+
+ protected void retrieveValidations() {
+
+ TDGWTServiceAsync.INSTANCE.getValidationsTasksMetadata(trId,
+ new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ Log.error("Load validations metadata failure: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert(
+ "Error retrieving validations metadata",
+ "Error retrieving validations metadata");
+
+ }
+
+ public void onSuccess(ValidationsTasksMetadata result) {
+ Log.debug("loaded " + result.getId());
+ validationsTasksMetadata = result;
+ createTreeData();
+
+ }
+
+ });
+
+ }
+
+ public void update() {
+ retrieveCurrentTR();
+ }
+
+ public void update(TRId trId) {
+ this.trId = trId;
+ draw();
+ }
+
+ protected void retrieveCurrentTR() {
+ TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ Log.error("Error retrieving current TRId: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error",
+ "Error retrieving current tabular resource id");
+
+ }
+
+ public void onSuccess(TRId result) {
+ Log.debug("retrieved " + result);
+ trId = result;
+ draw();
+
+ }
+
+ });
+ }
+
+ private void processFolder(TreeStore store, FolderDto folder) {
+ for (BaseDto child : folder.getChildren()) {
+ store.add(folder, child);
+ if (child instanceof FolderDto) {
+ processFolder(store, (FolderDto) child);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/BaseDto.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/BaseDto.java
new file mode 100644
index 0000000..da6ca47
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/BaseDto.java
@@ -0,0 +1,32 @@
+package org.gcube.portlets.user.td.tablewidget.client.validation.tree;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ *
+ */
+public class BaseDto implements Serializable {
+
+ private static final long serialVersionUID = -5535466371215737037L;
+ protected String id;
+
+ public BaseDto(){
+
+ }
+
+ public BaseDto(String id){
+ this.id=id;
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/FolderDto.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/FolderDto.java
new file mode 100644
index 0000000..547a1e6
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/FolderDto.java
@@ -0,0 +1,55 @@
+package org.gcube.portlets.user.td.tablewidget.client.validation.tree;
+
+
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ *
+ */
+public class FolderDto extends BaseDto {
+
+ private static final long serialVersionUID = 4644048540524701598L;
+ protected String description;
+ protected ArrayList childrens;
+
+
+ public FolderDto(){
+
+ }
+
+ public FolderDto(String id,String description, ArrayList childrens){
+ super(id);
+ this.description=description;
+ this.childrens=childrens;
+ }
+
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public ArrayList getChildren() {
+ return childrens;
+ }
+
+ public void setChildren(ArrayList children) {
+ this.childrens = children;
+ }
+
+ @Override
+ public String toString() {
+ return "FolderDto [id="+id+", description=" + description + ", childrens="
+ + childrens + "]";
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/TreeDataGenerator.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/TreeDataGenerator.java
new file mode 100644
index 0000000..9e7625c
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/TreeDataGenerator.java
@@ -0,0 +1,46 @@
+package org.gcube.portlets.user.td.tablewidget.client.validation.tree;
+
+import java.util.ArrayList;
+
+import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
+import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
+import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+
+public class TreeDataGenerator {
+ protected DateTimeFormat sdf = DateTimeFormat
+ .getFormat("yyyy-MM-dd HH:mm:ss");
+
+ protected FolderDto root;
+
+ public TreeDataGenerator(ValidationsTasksMetadata validationsTasksMetadata) {
+ if (validationsTasksMetadata.getTasks().size() > 0) {
+ ArrayList childrens = new ArrayList();
+ for (TaskS task : validationsTasksMetadata.getTasks()) {
+ ArrayList jobs = new ArrayList();
+ for (JobS job : task.getJobs()) {
+ ArrayList validations = new ArrayList();
+ for (Validations v : job.getValidations()) {
+ ValidationDto validationDto = new ValidationDto(
+ v.getDescription(), v.isValid());
+ validations.add(validationDto);
+ }
+ FolderDto foldJob = new FolderDto(job.getId(),
+ job.getDescription(), validations);
+ jobs.add(foldJob);
+ }
+ FolderDto foldTask = new FolderDto(task.getId(),
+ sdf.format(task.getStartTime()), jobs);
+ childrens.add(foldTask);
+ }
+ root = new FolderDto("0", "root", childrens);
+ }
+ }
+
+ public FolderDto getRoot() {
+ return root;
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/ValidationDto.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/ValidationDto.java
new file mode 100644
index 0000000..0a88338
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/tree/ValidationDto.java
@@ -0,0 +1,49 @@
+package org.gcube.portlets.user.td.tablewidget.client.validation.tree;
+
+/**
+ *
+ * @author "Giancarlo Panichi"
+ *
+ */
+public class ValidationDto extends BaseDto {
+
+ private static final long serialVersionUID = -4353641080571614057L;
+
+ protected String description;
+ protected Boolean valid;
+
+ public ValidationDto(){
+
+ }
+
+ public ValidationDto(String description, Boolean valid){
+ this.description=description;
+ this.valid=valid;
+ }
+
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Boolean getValid() {
+ return valid;
+ }
+
+ public void setValid(Boolean valid) {
+ this.valid = valid;
+ }
+
+ @Override
+ public String toString() {
+ return "ValidationDto [description=" + description + ", valid=" + valid
+ + "]";
+ }
+
+
+
+}
diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png
new file mode 100644
index 0000000..eee1001
Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation.png differ
diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png
new file mode 100644
index 0000000..c253439
Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/table-validation_32.png differ