From: lingutln Date: Wed, 23 Nov 2011 21:02:47 +0000 (+0000) Subject: Save functionality. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=8b2922d6620437e9f8232de944ba3e22255df9e5;p=old-jaiswallab-svn%2F.git Save functionality. Done by Nikhil. svn path=/; revision=219 --- diff --git a/image_annotation/src/ie/dcu/apps/ist/export/imagemap/MapArea.java b/image_annotation/src/ie/dcu/apps/ist/export/imagemap/MapArea.java index 2dc7003..8bef6da 100644 --- a/image_annotation/src/ie/dcu/apps/ist/export/imagemap/MapArea.java +++ b/image_annotation/src/ie/dcu/apps/ist/export/imagemap/MapArea.java @@ -15,6 +15,7 @@ public class MapArea { private String href; private String alt; + private String title; private AreaShape shape; private int[] coords; private final Map attrs; @@ -22,6 +23,7 @@ public class MapArea { public MapArea() { href = ""; alt = ""; + title = ""; shape = AreaShape.Polygon; coords = new int[0]; attrs = new HashMap(); @@ -43,10 +45,18 @@ public class MapArea { return alt; } + public void setTitle(String alt) { + this.title = title == null ? "" : title; + } + + public String getTitle() { + return title; + } + public void setAlt(String alt) { this.alt = alt == null ? "" : alt; } - + public AreaShape getShape() { return shape; } @@ -108,7 +118,7 @@ public class MapArea { tag .attr("href", encodedHREF) .attr("alt", alt) - .attr("title", alt) + .attr("title", getTitle()) .attr("shape", shape.toString()) .attr("coords", getCoordsString()); diff --git a/image_annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/image_annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 6107725..b5287c4 100644 --- a/image_annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/image_annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -47,7 +47,10 @@ public class SegmentationView extends Composite { // Left and right tool bar private final ToolBar bar1, bar2, bar3; - + + private final Button assign; + + //private final StyledText text; // Control to change brush size private final BrushControl brushControl; @@ -109,6 +112,7 @@ public class SegmentationView extends Composite { bar1 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); bar2 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); bar3 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); + assign = new Button(bar3, SWT.PUSH); view = new AnnotatedImageControl(this, SWT.BORDER); brushControl = new BrushControl(getShell(), SWT.BORDER); eventHandler = new EventHandler(); @@ -186,7 +190,7 @@ public class SegmentationView extends Composite { bar2.pack(); } /** - * Third tool bar for holding the Annotate combo. + * Third tool bar for holding the Annotate Combo box. */ private void createToolbar3() { SwtUtils.addLabel(bar3, getAction(Tool.SetLabel).getText()); @@ -199,9 +203,9 @@ public class SegmentationView extends Composite { setLabel(comboLabel.getText()); Display.getCurrent().asyncExec(new Runnable() { public void run() { - comboLabel.setFocus(); comboLabel.setText(comboLabel.getText()); - } + comboLabel.forceFocus(); + } }); } @Override @@ -209,12 +213,21 @@ public class SegmentationView extends Composite { // TODO Auto-generated method stub } }); - /*ToolItem item = new ToolItem(bar3, SWT.SEPARATOR); - assign = new Button(bar3, SWT.PUSH); + ToolItem item = new ToolItem(bar3, SWT.SEPARATOR); assign.setText("Assign"); item.setWidth(50); item.setControl(assign); - bar3.pack();*/ + assign.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent arg0) { + System.out.println("selected"+comboLabel.getText()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + // TODO Auto-generated method stub + } + }); + bar3.pack(); } @@ -764,22 +777,41 @@ public class SegmentationView extends Composite { private void setLabel(String content) { try { - URL terms = new URL("http://palea.cgrb.oregonstate.edu/paw/services/TermSearch_JSON.php?user=paw&field=name&type=autocomplete&ontology=po&qval="+content+"&format=json&max=20"); - URLConnection conn = terms.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String inputLine; - JSONObject object = null; - while ((inputLine = in.readLine()) != null) + System.out.println("Content coming as"+content); + URL url = new URL("http://palea.cgrb.oregonstate.edu/services/PO_web_service.php?request_type=term_search&search_value="+content+"&inc_synonyms&branch_filter=plant_anatomy&max=20"); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + if(connection.getResponseCode() == 200) { - object = new JSONObject(inputLine); - } - JSONArray array = new JSONArray(object.getString("sfautocomplete")); - for(int i=0; i