Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Added two fields and alignments to the right panel. Done by Nikhil.
authorlingutln <lingutln@localhost>
Wed, 1 Feb 2012 23:47:37 +0000 (23:47 +0000)
committerlingutln <lingutln@localhost>
Wed, 1 Feb 2012 23:47:37 +0000 (23:47 +0000)
svn path=/; revision=292

Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/swt/SwtUtils.java

index d803e3484a6e3f9e643d5ee9b8662c42ca1522bb..2f5ce6f027451628f61e429bcd78b00370a6f7ab 100644 (file)
@@ -12,7 +12,6 @@ import ie.dcu.segment.options.SegmenterOptionDialog;
 import ie.dcu.segment.painters.SegmentationPainter;
 import ie.dcu.swt.*;
 import ie.dcu.swt.event.*;
-import ie.dcu.swt.layout.LayoutFactory;
 
 import java.lang.reflect.InvocationTargetException;
 import java.net.*;
@@ -20,7 +19,6 @@ import java.util.ArrayList;
 import java.util.Properties;
 import java.util.logging.*;
 
-import org.apache.commons.lang3.StringEscapeUtils;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.*;
 import org.eclipse.jface.operation.*;
@@ -49,8 +47,6 @@ public class SegmentationView extends Composite {
        // tool bars
        private final ToolBar mainToolbar, viewSelectionToolbar, termLookupBar;
        
-       private ToolBar termDetailToolbar;
-       
        // Composite for Term details
        private Composite termDetailComposite;
        
@@ -77,10 +73,12 @@ public class SegmentationView extends Composite {
        // Combo box housing the selectable views
        private Combo combo;
 
-       public static Combo comboLabel,curatorCombo;
+       public static Combo comboLabel,curatorCombo,dummyCombo;
        
        private static Button assign;
        
+       private static Text collectionText;
+       
        // Current segmentation tool
        private Segmenter segmenter;
        
@@ -116,7 +114,8 @@ public class SegmentationView extends Composite {
                SetLabel,
                AssignButton,
                SetCurator,
-               SegmenterOptions;
+               SegmenterOptions,
+               CollectionId;
                
                private ToolAction action;
        };
@@ -139,7 +138,7 @@ public class SegmentationView extends Composite {
                viewSelectionToolbar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
                termLookupBar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
                view = new AnnotatedImageControl(this, SWT.BORDER);
-               termDetailComposite = new Composite(this, SWT.BORDER | SWT.RIGHT | SWT.FLAT);
+               termDetailComposite = new Composite(this, SWT.BORDER);
                
                brushControl = new BrushControl(getShell(), SWT.BORDER);
                eventHandler = new EventHandler();
@@ -309,14 +308,11 @@ public class SegmentationView extends Composite {
         * Set initial properties of the Term Detail right pane
         */
        private void createTermDetailTable() {
-               termDetailTable = new Table(termDetailComposite, SWT.BORDER | SWT.FULL_SELECTION);
+               // Toolbar for holding detail fields
+               termDetailTable = SwtUtils.addTable(termDetailComposite);
                termDetailTable.setLinesVisible (true);
                termDetailTable.setHeaderVisible (true);
                
-               GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
-               //data.heightHint = 200;
-
-               termDetailTable.setLayoutData(data);
                String[] titles = {"Label","Data"};
                for (int i=0; i<titles.length; i++) {
                        TableColumn column = new TableColumn (termDetailTable, SWT.BORDER_SOLID);
@@ -334,12 +330,13 @@ public class SegmentationView extends Composite {
                        termDetailTable.getColumn (i).pack ();
                }
                termDetailTable.setEnabled(false);
+               termDetailTable.pack();
        }
        
        private void createTermDetailFields() {
-               termDetailToolbar = new ToolBar(termDetailComposite, SWT.RIGHT | SWT.FLAT); 
-               SwtUtils.addLabel(termDetailToolbar, getAction(Tool.SetCurator).getText());
-               curatorCombo = SwtUtils.addCombo(termDetailToolbar, 175, SWT.READ_ONLY);
+               // Combo box and label for curator
+               SwtUtils.addLabelToComposite(termDetailComposite, getAction(Tool.SetCurator).getText());
+               curatorCombo = SwtUtils.addComboToComposite(termDetailComposite, 150, SWT.READ_ONLY);
                curatorCombo.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
                curatorCombo.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
@@ -349,10 +346,13 @@ public class SegmentationView extends Composite {
                String[] curatorsList = AppWindow.props.getProperty("CuratorNamesList").split(",");
                for(String curator : curatorsList)
                        curatorCombo.add(curator);
-               termDetailToolbar.pack();
+               // text field for collection Id
+               SwtUtils.addLabelToComposite(termDetailComposite, "Collection Id");
+               collectionText = SwtUtils.addTextFieldToComposite(termDetailComposite, 150);
        }
        
        private void layoutControls() {
+
                GridLayout layout = new GridLayout(3, false);
                layout.marginHeight = 1;
                layout.marginWidth = 2;
@@ -378,7 +378,7 @@ public class SegmentationView extends Composite {
                gd.horizontalAlignment = SWT.FILL;
                gd.heightHint = heightHint;
                viewSelectionToolbar.setLayoutData(gd);
-               
+
                // Layout view
                gd = new GridData();
                gd.verticalIndent = 2;
@@ -397,33 +397,22 @@ public class SegmentationView extends Composite {
                gd.verticalIndent = 1;
                gd.verticalSpan = 1;
                termLookupBar.setLayoutData(gd);
-               
+
+               // Layout term detail Composite
+               GridLayout termDetailLayout = new GridLayout(2, false);
+               termDetailComposite.setLayout(termDetailLayout);
+
                // Inner composite properties
                gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
                gd.verticalAlignment = GridData.BEGINNING;
-               gd.verticalIndent = 1;
-               gd.verticalSpan = 1;
+               gd.grabExcessHorizontalSpace = true;
                termDetailComposite.setLayoutData(gd);
                
-               // Layout term detail Composite
-               GridLayout termDetailLayout = new GridLayout(1, true);
-               termDetailComposite.setLayout(termDetailLayout);
-               
                // Layout term detail table                             
                gd = new GridData(SWT.FILL,SWT.FILL,true,true);
-               gd.grabExcessHorizontalSpace = true;
-               gd.grabExcessVerticalSpace = true;
+               gd.horizontalSpan = 2;
                termDetailTable.setLayoutData(gd);
                
-               // Layout term lookup toolbar within ineer composite
-               gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
-               gd.verticalAlignment = GridData.BEGINNING;
-               gd.verticalIndent = 1;
-               gd.verticalSpan = 1;
-               termDetailToolbar.setLayoutData(gd);
-               
        }
        
        
index 84fe86481216aff289111297a6af6e6c85a586a0..25420328e5f31a0ce5d465840b33c1b56cff26ab 100644 (file)
@@ -3,7 +3,6 @@ package ie.dcu.swt;
 import ie.dcu.swt.event.*;
 import ie.dcu.util.FileUtils;
 
-import java.awt.TextArea;
 import java.io.*;
 
 import org.eclipse.swt.*;
@@ -574,6 +573,52 @@ public class SwtUtils {
                // Set control
                item.setControl(box);
        }
+
+       public static void addLabelToComposite(Composite parent, String text) {
+               Composite box = new Composite(parent, SWT.NONE);
+               box.setLayout(new GridLayout());
+               
+               // Create label
+               Label label = new Label(box, SWT.NONE);
+               label.setText(text);
+               
+               GridData data = new GridData();
+               data.grabExcessVerticalSpace = true;
+               data.grabExcessHorizontalSpace = true;
+               label.setLayoutData(data);
+       }
+       
+       public static Text addTextFieldToComposite(Composite parent, int width) {
+               Composite box = new Composite(parent, SWT.NONE);
+               box.setLayout(new GridLayout(SWT.FILL,false));
+               
+               // Create label
+               ToolBar bar = new ToolBar(box,SWT.NONE);
+               ToolItem item = new ToolItem(bar, SWT.SEPARATOR);
+               Text text = new Text(bar, SWT.NONE);
+               item.setWidth(width);
+               item.setControl(text);
+               
+               GridData data = new GridData();
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessHorizontalSpace = true;
+               text.setLayoutData(data);
+               return text;
+       }
+       
+       /**
+        * Add a able to the given ToolBar. 
+        * 
+        * @param bar
+        *            A ToolBar.
+        * @param text
+        *            The label text.
+        */
+       public static Table addTable(Composite parent) {
+               // Create table
+               Table table = new Table(parent,SWT.NONE);
+               return table;
+       }
        
        /**
         * Add a separator to the given ToolBar. 
@@ -603,6 +648,22 @@ public class SwtUtils {
                return combo;
        }
        
+       public static Combo addComboToComposite(Composite parent, int width, int style) {
+               Composite box = new Composite(parent, SWT.NONE);
+               box.setLayout(new GridLayout(SWT.FILL,false));
+               
+               ToolBar bar = new ToolBar(box,SWT.NONE);
+               // Create label
+               Combo combo = addCombo(bar,width,SWT.NONE);
+               
+               GridData data = new GridData();
+               data.verticalAlignment = SWT.CENTER;
+               data.grabExcessHorizontalSpace = true;
+               combo.setLayoutData(data);
+               
+               return combo;
+       }
+       
        /**
         * Add a button to the given ToolBar. 
         *