Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Stubbed out termDetailTable control on the right panel
authorpreecej <preecej@localhost>
Thu, 26 Jan 2012 23:50:30 +0000 (23:50 +0000)
committerpreecej <preecej@localhost>
Thu, 26 Jan 2012 23:50:30 +0000 (23:50 +0000)
svn path=/; revision=281

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

index 6840180f226f589f21a502322a2b5a3877b8d3db..bb017380cfe649bb4f2fa7cf195834117441b95f 100644 (file)
@@ -41,17 +41,18 @@ public class SegmentationView extends Composite {
        private final PainterRegistry painters;
        
        
-       // View handling annotations
+       // View handling annotations (image pane)
        private final AnnotatedImageControl view;
        
+       // tool bars
+       private final ToolBar mainToolbar, viewSelectionToolbar, termLookupBar;
        
-       // Left and right tool bar
-       private final ToolBar bar1, bar2, termLookupBar;
+       // term detail table
+       private final Table termDetailTable;
        
        // Control to change brush size
        private final BrushControl brushControl;
-       
-       
+               
        // Handles various events
        private final EventHandler eventHandler;
        
@@ -63,7 +64,7 @@ public class SegmentationView extends Composite {
        // Auto segment on update flag
        private boolean auto = true;
 
-       // Inorder to toggle between segmentation and Labelling mode. Initially under Segmentation Mode
+       // Inorder to toggle between segmentation and Labeling mode. Initially under Segmentation Mode
        private static boolean labelMode = false;
        
        // Combo box housing the selectable views
@@ -84,7 +85,7 @@ public class SegmentationView extends Composite {
        // Flag to indicate that the runnable context blocks when fork is true
        private boolean blocksOnFork;
        
-       // For getting the Labels through Webservice
+       // For getting the Labels through Web service
        private Labels labels;
        
        
@@ -112,16 +113,19 @@ public class SegmentationView extends Composite {
                private ToolAction action;
        };
        
-       
+       // constructor
        public SegmentationView(Properties props, Composite parent, int style) {
                super(parent, style);
                this.props = props;
                
                painters = new PainterRegistry();
-               bar1 = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
-               bar2 = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
+               
+               mainToolbar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
+               viewSelectionToolbar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
                termLookupBar = new ToolBar(this, SWT.RIGHT | SWT.FLAT);
                view = new AnnotatedImageControl(this, SWT.BORDER);
+               termDetailTable = new Table(this, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
+               
                brushControl = new BrushControl(getShell(), SWT.BORDER);
                eventHandler = new EventHandler();
                segmenterProxy = new RobustSegmenterProxy();
@@ -135,10 +139,14 @@ public class SegmentationView extends Composite {
         */
        private void init() {
                initTools();
-               createToolbar1();
-               createToolbar2();
+               
+               //create all visual controls
+               createToolMainToolbar();
+               createToolViewSelectionToolbar();
                createToolTermLookupBar();
-               //createToolTermDetailPanel();
+               createTermDetailTable();
+               
+               // lay out the controls
                layoutControls();
                updatePainters();
                addListeners();
@@ -166,8 +174,8 @@ public class SegmentationView extends Composite {
        }
 
 
-       private void createToolbar1() {
-               ToolBarManager m = new ToolBarManager(bar1);
+       private void createToolMainToolbar() {
+               ToolBarManager m = new ToolBarManager(mainToolbar);
                m.add(getAction(Tool.Foreground));
                m.add(getAction(Tool.Background));
                m.add(getAction(Tool.OperatingMode));
@@ -192,16 +200,16 @@ public class SegmentationView extends Composite {
        }
        
        
-       private void createToolbar2() {
-               SwtUtils.addLabel(bar2, getAction(Tool.SetPainter).getText());
-               combo = SwtUtils.addCombo(bar2, 115, SWT.READ_ONLY);
+       private void createToolViewSelectionToolbar() {
+               SwtUtils.addLabel(viewSelectionToolbar, getAction(Tool.SetPainter).getText());
+               combo = SwtUtils.addCombo(viewSelectionToolbar, 115, SWT.READ_ONLY);
                combo.setToolTipText( getAction(Tool.SetPainter).getToolTipText());
                combo.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                execute(Tool.SetPainter, null);
                        }
                });
-               bar2.pack();
+               viewSelectionToolbar.pack();
        }
        
        /**
@@ -249,7 +257,7 @@ public class SegmentationView extends Composite {
                {
                        comboLabel.setListVisible(true);
                }
-               // If key pressed is only a number of charecter or space.
+               // If key pressed is only a number of character or space.
                else if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32)
                {
                        //For removing all previously assigned labels
@@ -264,6 +272,31 @@ public class SegmentationView extends Composite {
                }
        }
                
+       private void createTermDetailTable() {
+               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.NONE);
+                       column.setText (titles [i]);
+               }
+               
+               int count = 6;
+               for (int i=0; i<count; i++) {
+                       TableItem item = new TableItem (termDetailTable, SWT.NONE);
+                       item.setText (0, "x");
+                       item.setText (1, "y");
+               }
+               for (int i=0; i<titles.length; i++) {
+                       termDetailTable.getColumn (i).pack ();
+               }
+       }
+       
        private void layoutControls() {
                GridLayout layout = new GridLayout(3, false);
                layout.marginHeight = 1;
@@ -272,23 +305,24 @@ public class SegmentationView extends Composite {
                layout.verticalSpacing = 1;
                setLayout(layout);
                
-               Point sz1 = bar1.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-               Point sz2 = bar2.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+               Point sz1 = mainToolbar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+               Point sz2 = viewSelectionToolbar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                
                int heightHint = Math.max(sz1.y, sz2.y);
-               
-               // Layout toolbar 1
+
                GridData gd = new GridData();
+
+               // Layout mainToolbar
                gd.grabExcessHorizontalSpace = true;
                gd.horizontalAlignment = SWT.FILL;
                gd.heightHint = heightHint;
-               bar1.setLayoutData(gd);
+               mainToolbar.setLayoutData(gd);
                
-               // Layout toolbar 2
+               // Layout viewSelectionToolbar
                gd = new GridData();
                gd.horizontalAlignment = SWT.FILL;
                gd.heightHint = heightHint;
-               bar2.setLayoutData(gd);
+               viewSelectionToolbar.setLayoutData(gd);
                
                // Layout view
                gd = new GridData();
@@ -300,14 +334,21 @@ public class SegmentationView extends Composite {
                gd.verticalAlignment = SWT.FILL;
                view.setLayoutData(gd);
                
-               // Layout right panel
+               // Layout term lookup toolbar
                gd = new GridData();
                gd.horizontalAlignment = SWT.FILL;
                gd.verticalAlignment = GridData.BEGINNING;
                gd.verticalIndent = 1;
-               gd.verticalSpan = 2;
+               gd.verticalSpan = 1;
                termLookupBar.setLayoutData(gd);
                
+               // Layout term detail table
+               gd = new GridData();
+               gd.horizontalAlignment = SWT.FILL;
+               gd.verticalAlignment = GridData.BEGINNING;
+               gd.verticalIndent = 1;
+               gd.verticalSpan = 1;
+               termDetailTable.setLayoutData(gd);
        }
        
        
@@ -584,8 +625,8 @@ public class SegmentationView extends Composite {
        
        public void setEnabled(boolean enabled) {
                super.setEnabled(enabled);
-               bar1.setEnabled(enabled);
-               bar2.setEnabled(enabled);
+               mainToolbar.setEnabled(enabled);
+               viewSelectionToolbar.setEnabled(enabled);
                view.setEnabled(enabled);
                updateToolStates();
        }
@@ -880,7 +921,7 @@ public class SegmentationView extends Composite {
        }
 
        private void showBrushControl(Event e) {
-               brushControl.showBelow(bar1, (ToolItem) e.widget);
+               brushControl.showBelow(mainToolbar, (ToolItem) e.widget);
        }