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.*;
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.*;
// tool bars
private final ToolBar mainToolbar, viewSelectionToolbar, termLookupBar;
- private ToolBar termDetailToolbar;
-
// Composite for Term details
private Composite termDetailComposite;
// 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;
SetLabel,
AssignButton,
SetCurator,
- SegmenterOptions;
+ SegmenterOptions,
+ CollectionId;
private ToolAction action;
};
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();
* 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);
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) {
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;
gd.horizontalAlignment = SWT.FILL;
gd.heightHint = heightHint;
viewSelectionToolbar.setLayoutData(gd);
-
+
// Layout view
gd = new GridData();
gd.verticalIndent = 2;
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);
-
}
import ie.dcu.swt.event.*;
import ie.dcu.util.FileUtils;
-import java.awt.TextArea;
import java.io.*;
import org.eclipse.swt.*;
// 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.
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.
*