]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java
solving the hibernate transaction problem
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.client.ui / src / org / argeo / slc / client / ui / views / ProcessListView.java
index 36a4b97640405eaf3d97a5466ff788b1908bcd3d..de85192810cd5da93c4dec1c726a341e881a235e 100644 (file)
@@ -2,10 +2,7 @@ package org.argeo.slc.client.ui.views;
 
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.core.test.tree.ResultAttributes;
-import org.argeo.slc.dao.process.SlcExecutionDao;
+import org.argeo.slc.client.core.TableContent;
 import org.argeo.slc.process.SlcExecution;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -21,14 +18,14 @@ import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.ui.part.ViewPart;
 
 public class ProcessListView extends ViewPart {
-       private final static Log log = LogFactory
-                       .getLog(ProcessListView.class);
+       // private final static Log log = LogFactory.getLog(ProcessListView.class);
 
-       public static final String ID = "org.argeo.slc.client.ui.ProcessListView";
+       public static final String ID = "org.argeo.slc.client.ui.processListView";
 
        private TableViewer viewer;
 
-       private SlcExecutionDao slcExecutionDao;
+       // IoC
+       private TableContent tableContent;
 
        public void createPartControl(Composite parent) {
                Table table = createTable(parent);
@@ -85,7 +82,7 @@ public class ProcessListView extends ViewPart {
                @SuppressWarnings("unchecked")
                public Object[] getElements(Object obj) {
                        if (obj instanceof List) {
-                               return ((List<ResultAttributes>) obj).toArray();
+                               return ((List<SlcExecution>) obj).toArray();
                        } else {
                                return new Object[0];
                        }
@@ -95,19 +92,7 @@ public class ProcessListView extends ViewPart {
        protected class ViewLabelProvider extends LabelProvider implements
                        ITableLabelProvider {
                public String getColumnText(Object obj, int index) {
-                       SlcExecution ra = (SlcExecution) obj;
-                       switch (index) {
-
-                       case 0:
-                               return getText(ra.getStartDate());
-                       case 1:
-                               return ra.getHost();
-                       case 2:
-                               return ra.getUuid();
-                       case 3:
-                               return ra.currentStep().getType();
-                       }
-                       return getText(obj);
+                       return tableContent.getLabel(obj, index);
                }
 
                public Image getColumnImage(Object obj, int index) {
@@ -121,21 +106,12 @@ public class ProcessListView extends ViewPart {
        }
 
        public void retrieveResults() {
-               try {
-                       List<SlcExecution> lst = slcExecutionDao.listSlcExecutions();
-
-                       if (log.isTraceEnabled())
-                               log.trace("Result attributes count: " + lst.size());
-                       viewer.setInput(lst);
-                       // viewer.refresh();
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
+               viewer.setInput(tableContent.getContent());
        }
 
-       public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
-               this.slcExecutionDao = slcExecutionDao;
+       // IoC
+       public void setTableContent(TableContent tableContent) {
+               this.tableContent = tableContent;
        }
 
-}
+}
\ No newline at end of file