// RegisteredOntologyInfo ontologyInfo = suggestions.get(suggestion);
// mainPanel.notifyWorkingOntologyAdded(OntologySelection.this, ontologyInfo, popup);
// }
// });
final TextBox textBox = createTextBox(suggestions, listBox, popup);
textBox.setWidth(width);
hp.add(textBox);
// // we use the star (*) to show the whole list of vocabs. If the user enters something
// // different, then remove the star:
// box.addKeyboardListener(new KeyboardListener() {
// public void onKeyPress(Widget sender, char keyCode, int modifiers) {
// // FIXME: if the user wants to use the down arrow to pick a suggestion after
// // entering *, it cannot do it!
// if ( keyCode != '*' && box.getText().trim().equals("*") ) {
// box.setText("");
// }
// }
// public void onKeyDown(Widget sender, char keyCode, int modifiers) {}
//
// public void onKeyUp(Widget sender, char keyCode, int modifiers) {
// if ( keyCode == KeyboardListener.KEY_ENTER ) {
// String selectedUri = box.getText().trim();
// Orr.log("addVocabulary: ENTER: '" + selectedUri + "'");
// if (selectedUri.length() > 0) {
// if ( VineMain.containsWorkingUri(selectedUri) ) {
// // ignore the Enter
// return;
// }
// BaseOntologyInfo ontologyInfo = VineMain.getOntologyInfo(selectedUri);
// if (ontologyInfo instanceof RegisteredOntologyInfo) {
// // It is a registered ontology -- load it as a working one:
// RegisteredOntologyInfo roi = (RegisteredOntologyInfo) ontologyInfo;
// mainPanel.notifyWorkingOntologyAdded(OntologySelection.this, roi, popup);
// }
// else {
// // try as an external ontology:
// OntologySelection.this.mainPanel.addExternalOntology(selectedUri, popup);
// }
// }
// }
// }
// });
popup.setText("Select an ontology");
// hp.add(new HTML("Elements are displayed as you type. Enter * to see the full list."));
listBox.setWidth(width);
listBox.setVisibleItemCount(Math.min(listBox.getItemCount() + 2, 12));
hp.add(listBox);
// listBox.addChangeListener(new ChangeListener () {
// public void onChange(Widget sender) {
// String value = listBox.getValue(listBox.getSelectedIndex());
// RegisteredOntologyInfo ontologyInfo = suggestions.get(value);
// mainPanel.notifyWorkingOntologyAdded(OntologySelection.this, ontologyInfo, popup);
// }
// });
// use a timer to request for focus in the suggest-box:
new Timer() {
public void run() {
// box.setFocus(true);
textBox.setFocus(true);
}
}.schedule(500);
popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {