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%2FResultDetailView.java;h=6d9f901622e7881fe39161318947a79c96eafce2;hb=5d91de89b70a4ba96cd4d37c4fcc991118faf685;hp=755e4d9cb66840fc2046ce551c2fdba624610dbe;hpb=3a711eb9f0dbf0385627521a622c4c5d024173b3;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java index 755e4d9cb..6d9f90162 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java @@ -8,7 +8,10 @@ import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.part.ViewPart; /** @@ -23,7 +26,11 @@ public class ResultDetailView extends ViewPart { private final static Log log = LogFactory.getLog(ResultDetailView.class); public static final String ID = "org.argeo.slc.client.ui.resultDetailView"; + protected String[] columnNames = new String[] { "Test", "State", "Message", + "Id" }; + private TreeViewer viewer; + private Tree resultDetailTree; private String uuid; private TreeTestResult ttr; @@ -34,13 +41,48 @@ public class ResultDetailView extends ViewPart { private TreeTestResultDao treeTestResultDao; public void createPartControl(Composite parent) { - // log.debug("In create part Control &&& uuid = " + uuid); - viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + resultDetailTree = new Tree(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + resultDetailTree.setLayoutData(gd); + resultDetailTree.setLinesVisible(true); + resultDetailTree.setHeaderVisible(true); + + for (int i = 0; i < columnNames.length; i++) { + TreeColumn column = new TreeColumn(resultDetailTree, SWT.LEFT, i); + column.setText(columnNames[i]); + + // TIP: Don't forget to set the width. If not set it is set to + // 0 and it will look as if the column didn't exist. + switch (i) { + case 0: + column.setWidth(130); + case 1: + column.setWidth(200); + default: + column.setWidth(70); + } + } + viewer = new TreeViewer(resultDetailTree); + viewer.setColumnProperties(columnNames); + viewer.setContentProvider(contentProvider); + // viewer.setLabelProvider(new ResultDetailLabelProvider()); + log.debug("Injected LabelProvider :" + labelProvider.toString()); + + // TIP: It seems, that if the table has not defined any TreeColumns then + // a plain LabelProvider will be used. Since, we don't provide an + // instance of LabelProvider, a default one will be used and + // the TableLableProvider is ignored without notice. Took me quite + // a while to find that one out. viewer.setLabelProvider(labelProvider); + log.debug("Persisted labelProvider :" + + viewer.getLabelProvider().toString()); // viewer.setInput(getViewSite()); - if (log.isDebugEnabled()) - log.debug("PartControl CREATED."); + + // viewer.expandAll(); + } public void setFocus() { @@ -53,10 +95,10 @@ public class ResultDetailView extends ViewPart { public void retrieveResults() { ttr = treeTestResultDao.getTestResult(uuid); - log.debug("========= ttr: " + ttr); viewer.setInput(ttr); - log.debug("Input SET"); - setFocus(); + // viewer.setInput(getViewSite()); + + // setFocus(); } public void setUuid(String uuid) {