From 8e8df0c9129e70d4c754d0c7daf3e73921f10257 Mon Sep 17 00:00:00 2001 From: lingutln Date: Mon, 6 Feb 2012 22:25:11 +0000 Subject: [PATCH] Right panel elements added. Done by Nikhil. svn path=/; revision=295 --- .../dcu/apps/ist/views/SegmentationView.java | 9 ++++-- Annotation/src/ie/dcu/swt/SwtUtils.java | 30 +++++++++++++++---- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 2f5ce6f..9391788 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -26,6 +26,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; @@ -77,7 +78,7 @@ public class SegmentationView extends Composite { private static Button assign; - private static Text collectionText; + private static Text collectionId, comment; // Current segmentation tool private Segmenter segmenter; @@ -348,7 +349,10 @@ public class SegmentationView extends Composite { curatorCombo.add(curator); // text field for collection Id SwtUtils.addLabelToComposite(termDetailComposite, "Collection Id"); - collectionText = SwtUtils.addTextFieldToComposite(termDetailComposite, 150); + collectionId = SwtUtils.addTextFieldToComposite(termDetailComposite, 140); + // Comments Text Area + SwtUtils.addLabelToComposite(termDetailComposite, "Comments"); + comment = SwtUtils.addTextAreaToComposite(termDetailComposite, 150); } private void layoutControls() { @@ -406,6 +410,7 @@ public class SegmentationView extends Composite { gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; + gd.grabExcessVerticalSpace = true; termDetailComposite.setLayoutData(gd); // Layout term detail table diff --git a/Annotation/src/ie/dcu/swt/SwtUtils.java b/Annotation/src/ie/dcu/swt/SwtUtils.java index 2542032..6406999 100644 --- a/Annotation/src/ie/dcu/swt/SwtUtils.java +++ b/Annotation/src/ie/dcu/swt/SwtUtils.java @@ -1,5 +1,6 @@ package ie.dcu.swt; +import ie.dcu.apps.ist.AppWindow; import ie.dcu.swt.event.*; import ie.dcu.util.FileUtils; @@ -38,6 +39,8 @@ public class SwtUtils { */ public static final int RIGHT = java.awt.Rectangle.OUT_RIGHT; + private static AppWindow window; + /** * Clone a rectangle. */ @@ -585,6 +588,7 @@ public class SwtUtils { GridData data = new GridData(); data.grabExcessVerticalSpace = true; data.grabExcessHorizontalSpace = true; + //data.heightHint = heightInt; label.setLayoutData(data); } @@ -592,16 +596,30 @@ public class SwtUtils { 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); + // Create Single line TextField + Text text = new Text(box, SWT.BORDER | SWT.SINGLE); GridData data = new GridData(); data.verticalAlignment = SWT.CENTER; data.grabExcessHorizontalSpace = true; + data.widthHint = width; + text.setLayoutData(data); + return text; + } + + public static Text addTextAreaToComposite(Composite parent, int width) { + + Composite box = new Composite(parent, SWT.NONE); + box.setLayout(new GridLayout()); + + // Create TextArea + Text text = new Text(box, SWT.BORDER | SWT.MULTI); + + GridData data = new GridData(); + data.grabExcessVerticalSpace = true; + data.grabExcessHorizontalSpace = true; + data.heightHint = 100; + data.widthHint = 150; text.setLayoutData(data); return text; } -- 2.34.1