From 6241237de4ea156a94d8012a66231a8f31c6e4f2 Mon Sep 17 00:00:00 2001 From: preecej Date: Thu, 26 Jan 2012 23:50:30 +0000 Subject: [PATCH] Stubbed out termDetailTable control on the right panel svn path=/; revision=281 --- .../dcu/apps/ist/views/SegmentationView.java | 105 ++++++++++++------ 1 file changed, 73 insertions(+), 32 deletions(-) diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 6840180..bb01738 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -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