private String href;
private String alt;
+ private String title;
private AreaShape shape;
private int[] coords;
private final Map<String, String> attrs;
public MapArea() {
href = "";
alt = "";
+ title = "";
shape = AreaShape.Polygon;
coords = new int[0];
attrs = new HashMap<String, String>();
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;
}
tag
.attr("href", encodedHREF)
.attr("alt", alt)
- .attr("title", alt)
+ .attr("title", getTitle())
.attr("shape", shape.toString())
.attr("coords", getCoordsString());
// 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;
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();
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());
setLabel(comboLabel.getText());
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- comboLabel.setFocus();
comboLabel.setText(comboLabel.getText());
- }
+ comboLabel.forceFocus();
+ }
});
}
@Override
// 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();
}
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<array.length();i++)
+ String inputLine;
+ JSONObject object = null;
+ while ((inputLine = in.readLine()) != null)
+ {
+ System.out.println("Response coming as"+inputLine);
+ object = new JSONObject(inputLine);
+ }
+ JSONArray array = new JSONArray(object.getString("PO_term_search_response"));
+ String listElement;
+ for(int i=0; i<array.length();i++)
+ {
+ if(array.getJSONObject(i).getString("match_type").trim().equals("synonym"))
+ {
+ listElement = (array.getJSONObject(i).getString("match")+" {"+array.getJSONObject(i).getString("is_synonym_of")+"}");
+ comboLabel.add(listElement,i);
+ }
+ else if(array.getJSONObject(i).getString("match_type").equals("term"))
+ {
+ listElement = array.getJSONObject(i).getString("match");
+ comboLabel.add(listElement,i);
+ }
+ }
+ //comboLabel.setListVisible(true);
+ in.close();
+ }
+ else
{
- comboLabel.add(array.getJSONObject(i).getString("title"),i);
- comboLabel.setListVisible(true);
+ System.out.println("Response error");
}
- in.close();
}
catch(Exception ex)
{