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;
// 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
// 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;
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();
*/
private void init() {
initTools();
- createToolbar1();
- createToolbar2();
+
+ //create all visual controls
+ createToolMainToolbar();
+ createToolViewSelectionToolbar();
createToolTermLookupBar();
- //createToolTermDetailPanel();
+ createTermDetailTable();
+
+ // lay out the controls
layoutControls();
updatePainters();
addListeners();
}
- 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));
}
- 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();
}
/**
{
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
}
}
+ 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;
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();
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);
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- bar1.setEnabled(enabled);
- bar2.setEnabled(enabled);
+ mainToolbar.setEnabled(enabled);
+ viewSelectionToolbar.setEnabled(enabled);
view.setEnabled(enabled);
updateToolStates();
}
}
private void showBrushControl(Event e) {
- brushControl.showBelow(bar1, (ToolItem) e.widget);
+ brushControl.showBelow(mainToolbar, (ToolItem) e.widget);
}