From: lingutln Date: Thu, 22 Dec 2011 22:26:25 +0000 (+0000) Subject: Down arrow functionality for annotation combo box. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=70b8d0ca489662793cc675f35d7af58f021d445c;p=old-jaiswallab-svn%2F.git Down arrow functionality for annotation combo box. Done by Nikhil. svn path=/; revision=232 --- diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 460c785..9104c26 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -204,14 +204,16 @@ public class SegmentationView extends Composite { comboLabel.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { - comboLabel.remove(0,comboLabel.getItemCount()-1); - setLabel(comboLabel.getText()); - Display.getCurrent().asyncExec(new Runnable() { - public void run() { - comboLabel.setText(comboLabel.getText()); - comboLabel.forceFocus(); - } - }); + if(e.keyCode == 16777218) + { + comboLabel.setListVisible(true); + } + else if (!(e.keyCode == 13)) + { + comboLabel.setListVisible(false); + setLabel(comboLabel.getText()); + } + //comboLabel.setSelection(arg0); } @Override public void keyPressed(KeyEvent arg0) { @@ -800,10 +802,11 @@ public class SegmentationView extends Composite { private void setLabel(String content) { try { - String content1 = URLEncoder.encode(content.toString(),"UTF-8"); - URL url = new URL("http://palea.cgrb.oregonstate.edu/services/PO_web_service.php?request_type=term_search&search_value="+content1+"&inc_synonyms&branch_filter=plant_anatomy&max=20"); + comboLabel.remove(0,comboLabel.getItemCount()-1); + String encodedContent = URLEncoder.encode(content.toString(),"UTF-8"); + URL url = new URL("http://palea.cgrb.oregonstate.edu/services/PO_web_service.php?request_type=term_search&search_value="+encodedContent+"&inc_synonyms&branch_filter=plant_anatomy&max=20"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); if(connection.getResponseCode() == 200) { String inputLine; @@ -839,6 +842,10 @@ public class SegmentationView extends Composite { catch(Exception ex) { } + /*if(comboLabel.getText().equals(null) && comboLabel.getItemCount()>0) + { + comboLabel.setText(comboLabel.getItem(0)); + }*/ assign.setEnabled(!(comboLabel.getText().isEmpty())); }