use of com.googlecode.wicket.jquery.ui.widget.tooltip.TooltipBehavior in project webanno by webanno.
the class TextFeatureEditor method createFieldComboBox.
private AbstractTextComponent createFieldComboBox() {
AbstractTextComponent field;
if (getModelObject().feature.getTagset() != null) {
field = new StyledComboBox<Tag>("value", PropertyModel.of(getModel(), "tagset")) {
private static final long serialVersionUID = -1735694425658462932L;
@Override
protected void onInitialize() {
super.onInitialize();
// Ensure proper order of the initializing JS header items: first combo box
// behavior (in super.onInitialize()), then tooltip.
Options options = new Options(DescriptionTooltipBehavior.makeTooltipOptions());
options.set("content", FUNCTION_FOR_TOOLTIP);
add(new TooltipBehavior("#" + getMarkupId() + "_listbox *[title]", options) {
private static final long serialVersionUID = 1854141593969780149L;
@Override
protected String $() {
// with a slight delay hoping that all is set up after 1 second.
return "try {setTimeout(function () { " + super.$() + " }, 1000); } catch (err) {}; ";
}
});
}
@Override
protected void onConfigure() {
super.onConfigure();
// Trigger a re-loading of the tagset from the server as constraints may have
// changed the ordering
AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
if (target != null) {
LOG.trace("onInitialize() requesting datasource re-reading");
target.appendJavaScript(String.format("var $w = %s; if ($w) { $w.dataSource.read(); }", KendoUIBehavior.widget(this, ComboBoxBehavior.METHOD)));
}
}
};
} else {
field = new TextField<String>("value");
}
// Ensure that markup IDs of feature editor focus components remain constant across
// refreshes of the feature editor panel. This is required to restore the focus.
field.setOutputMarkupId(true);
field.setMarkupId(ID_PREFIX + getModelObject().feature.getId());
return field;
}
Aggregations