// final SuggestBox box = new SuggestBox(oracle);
// box.setWidth(width);
CellPanel hp = new VerticalPanel();
final MyDialog popup = new MyDialog(hp) {
public boolean onKeyUpPreview(char key, int modifiers) {
if ( key == KeyboardListener.KEY_ESCAPE ) {
hide();
return false;
}
return true;
}
};
hp.add(new TLabel("Ontology URI:",
"Select or enter the URL of the ontology you want to include in the list of working ontologies. " +
"<br/>" +
"As you type, URIs are displayed according to matching components in the " +
"URI or the associated title."
));
// hp.add(box);
// box.addEventHandler(new SuggestionHandler() {
// public void onSuggestionSelected(SuggestionEvent event) {
// String suggestion = event.getSelectedSuggestion().getReplacementString();
// 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);