X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.client.ui%2Fsrc%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fviews%2FProcessListView.java;h=de85192810cd5da93c4dec1c726a341e881a235e;hb=d9c15eaa71f215d8193bbebb7c94b2e0aa952dc4;hp=12a450057aaafa4bee5072e5dd2b098d9f92bd5a;hpb=18cbb73fe261a6e0a14bb3467a04ba3bbfc4b857;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java index 12a450057..de8519281 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java @@ -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.client.core.TableContent; -import org.argeo.slc.dao.process.SlcExecutionDao; import org.argeo.slc.process.SlcExecution; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITableLabelProvider; @@ -21,14 +18,13 @@ 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"; private TableViewer viewer; // IoC - private SlcExecutionDao slcExecutionDao; private TableContent tableContent; public void createPartControl(Composite parent) { @@ -96,20 +92,7 @@ public class ProcessListView extends ViewPart { protected class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object obj, int index) { - SlcExecution se = (SlcExecution) obj; - // switch (index) { - // - // case 0: - // return getText(se.getStartDate()); - // case 1: - // return se.getHost(); - // case 2: - // return se.getUuid(); - // case 3: - // return se.currentStep().getType(); - // } - // return getText(obj); - return tableContent.getLabel(null, 0); + return tableContent.getLabel(obj, index); } public Image getColumnImage(Object obj, int index) { @@ -123,349 +106,12 @@ public class ProcessListView extends ViewPart { } public void retrieveResults() { - try { - List lst = slcExecutionDao.listSlcExecutions(); - - if (log.isTraceEnabled()) - log.trace("Slc Execution 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; } -} -// 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.process.SlcExecution; -// import org.eclipse.jface.viewers.IContentProvider; -// import org.eclipse.jface.viewers.IStructuredContentProvider; -// import org.eclipse.jface.viewers.ITableLabelProvider; -// import org.eclipse.jface.viewers.LabelProvider; -// import org.eclipse.jface.viewers.TableViewer; -// import org.eclipse.jface.viewers.Viewer; -// import org.eclipse.swt.SWT; -// import org.eclipse.swt.graphics.Image; -// import org.eclipse.swt.layout.GridData; -// import org.eclipse.swt.widgets.Composite; -// import org.eclipse.swt.widgets.Table; -// 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); -// -// public static final String ID = "org.argeo.slc.client.ui.processListView"; -// -// private TableViewer viewer; -// -// // IoC -// // We use external content & label provider to encapsulate them in an AOP -// // proxy; -// // In order to solve hibernate transaction issue. -// private IContentProvider contentProvider; -// private ITableLabelProvider tableLabelProvider; -// -// // private SessionFactory sessionFactory; -// -// private SlcExecutionDao slcExecutionDao; -// -// public void createPartControl(Composite parent) { -// Table table = createTable(parent); -// viewer = new TableViewer(table); -// viewer.setContentProvider(this.contentProvider); -// viewer.setLabelProvider(this.tableLabelProvider); -// viewer.setInput(getViewSite()); -// } -// -// protected Table createTable(Composite parent) { -// int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL -// | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; -// -// Table table = new Table(parent, style); -// -// GridData gridData = new GridData(GridData.FILL_BOTH); -// gridData.grabExcessVerticalSpace = true; -// gridData.grabExcessHorizontalSpace = true; -// gridData.horizontalSpan = 3; -// table.setLayoutData(gridData); -// -// table.setLinesVisible(true); -// table.setHeaderVisible(true); -// -// TableColumn column = new TableColumn(table, SWT.LEFT, 0); -// column.setText("Date"); -// column.setWidth(200); -// -// column = new TableColumn(table, SWT.LEFT, 1); -// column.setText("Host"); -// column.setWidth(100); -// -// column = new TableColumn(table, SWT.LEFT, 2); -// column.setText("Id"); -// column.setWidth(300); -// -// column = new TableColumn(table, SWT.LEFT, 3); -// column.setText("Status"); -// column.setWidth(100// 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.process.SlcExecution; -// import org.eclipse.jface.viewers.IContentProvider; -// import org.eclipse.jface.viewers.IStructuredContentProvider; -// import org.eclipse.jface.viewers.ITableLabelProvider; -// import org.eclipse.jface.viewers.LabelProvider; -// import org.eclipse.jface.viewers.TableViewer; -// import org.eclipse.jface.viewers.Viewer; -// import org.eclipse.swt.SWT; -// import org.eclipse.swt.graphics.Image; -// import org.eclipse.swt.layout.GridData; -// import org.eclipse.swt.widgets.Composite; -// import org.eclipse.swt.widgets.Table; -// 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); -// -// public static final String ID = "org.argeo.slc.client.ui.processListView"; -// -// private TableViewer viewer; -// -// // IoC -// // We use external content & label provider to encapsulate them in an AOP -// // proxy; -// // In order to solve hibernate transaction issue. -// private IContentProvider contentProvider; -// private ITableLabelProvider tableLabelProvider; -// -// // private SessionFactory sessionFactory; -// -// private SlcExecutionDao slcExecutionDao; -// -// public void createPartControl(Composite parent) { -// Table table = createTable(parent); -// viewer = new TableViewer(table); -// viewer.setContentProvider(this.contentProvider); -// viewer.setLabelProvider(this.tableLabelProvider); -// viewer.setInput(getViewSite()); -// } -// -// protected Table createTable(Composite parent) { -// int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL -// | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; -// -// Table table = new Table(parent, style); -// -// GridData gridData = new GridData(GridData.FILL_BOTH); -// gridData.grabExcessVerticalSpace = true; -// gridData.grabExcessHorizontalSpace = true; -// gridData.horizontalSpan = 3; -// table.setLayoutData(gridData); -// -// table.setLinesVisible(true); -// table.setHeaderVisible(true); -// -// TableColumn column = new TableColumn(table, SWT.LEFT, 0); -// column.setText("Date"); -// column.setWidth(200); -// -// column = new TableColumn(table, SWT.LEFT, 1); -// column.setText("Host"); -// column.setWidth(100); -// -// column = new TableColumn(table, SWT.LEFT, 2); -// column.setText("Id"); -// column.setWidth(300); -// -// column = new TableColumn(table, SWT.LEFT, 3); -// column.setText("Status"); -// column.setWidth(100); -// -// return table; -// } -// -// protected static class ViewContentProvider implements -// IStructuredContentProvider { -// -// public void inputChanged(Viewer arg0, Object arg1, Object arg2) { -// } -// -// public void dispose() { -// } -// -// @SuppressWarnings("unchecked") -// public Object[] getElements(Object obj) { -// if (obj instanceof List) { -// return ((List) obj).toArray(); -// } else { -// return new Object[0]; -// } -// } -// } -// -// protected class ViewLabelProvider extends LabelProvider implements -// ITableLabelProvider { -// public String getColumnText(Object obj, int index) { -// // log.debug(sessionFactory.getClass().toString()); -// -// SlcExecution se = (SlcExecution) obj; -// switch (index) { -// -// case 0: -// return getText(se.getStartDate()); -// case 1: -// return se.getHost(); -// case 2: -// return se.getUuid(); -// case 3: -// return se.currentStep().getType(); -// } -// return getText(obj); -// } -// -// public Image getColumnImage(Object obj, int index) { -// return null; -// } -// -// } -// -// public void setFocus() { -// viewer.getControl().setFocus(); -// } -// -// public void retrieveResults() { -// try { -// List lst = slcExecutionDao.listSlcExecutions(); -// -// if (log.isDebugEnabled()) -// log.debug("Result attributes count: " + lst.size()); -// viewer.setInput(lst); -// // viewer.refresh(); -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// // IoC -// public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { -// this.slcExecutionDao = slcExecutionDao; -// } -// -// public void setContentProvider(IContentProvider contentProvider) { -// this.contentProvider = contentProvider; -// } -// -// public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { -// this.tableLabelProvider = tableLabelProvider; -// } -// -// // public void setSessionFactory(SessionFactory sessionFactory) { -// // this.sessionFactory = sessionFactory; -// // } -// -// } -// ); -// -// return table; -// } -// -// protected static class ViewContentProvider implements -// IStructuredContentProvider { -// -// public void inputChanged(Viewer arg0, Object arg1, Object arg2) { -// } -// -// public void dispose() { -// } -// -// @SuppressWarnings("unchecked") -// public Object[] getElements(Object obj) { -// if (obj instanceof List) { -// return ((List) obj).toArray(); -// } else { -// return new Object[0]; -// } -// } -// } -// -// protected class ViewLabelProvider extends LabelProvider implements -// ITableLabelProvider { -// public String getColumnText(Object obj, int index) { -// // log.debug(sessionFactory.getClass().toString()); -// -// SlcExecution se = (SlcExecution) obj; -// switch (index) { -// -// case 0: -// return getText(se.getStartDate()); -// case 1: -// return se.getHost(); -// case 2: -// return se.getUuid(); -// case 3: -// return se.currentStep().getType(); -// } -// return getText(obj); -// } -// -// public Image getColumnImage(Object obj, int index) { -// return null; -// } -// -// } -// -// public void setFocus() { -// viewer.getControl().setFocus(); -// } -// -// public void retrieveResults() { -// try { -// List lst = slcExecutionDao.listSlcExecutions(); -// -// if (log.isDebugEnabled()) -// log.debug("Result attributes count: " + lst.size()); -// viewer.setInput(lst); -// // viewer.refresh(); -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// // IoC -// public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { -// this.slcExecutionDao = slcExecutionDao; -// } -// -// public void setContentProvider(IContentProvider contentProvider) { -// this.contentProvider = contentProvider; -// } -// -// public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { -// this.tableLabelProvider = tableLabelProvider; -// } -// -// // public void setSessionFactory(SessionFactory sessionFactory) { -// // this.sessionFactory = sessionFactory; -// // } -// -// } +} \ No newline at end of file