/* (non-Javadoc)
* @see org.wicketstuff.datatable_autocomplete.provider.IModelProvider#model(java.lang.Object)
*/
public IModel<Method> model(Method obj) {
return new LoadableDetachableMethodModel (obj);
}
});
field = new AutoCompletingTextField<Method>(
"field", stringModel, new IColumn[] { new MethodColumn(
"Method Name", MethodColumnType.METHOD_NAME), new MethodColumn("Parameters", MethodColumnType.PARAMETERS), new MethodColumn("Class Name", MethodColumnType.CLASS_NAME) }, methodProvider,
new ITableRowSelectionHandler<Method>() {
/**
*
*/
private static final long serialVersionUID = 8814576423898775282L;
public void handleSelection(int index, Method modelObject,
AjaxRequestTarget target) {
/*
* If the matched row were being used to build part of another object.
*
* The assignment/setup of that other object can take place here.
*
* i.e. it occurs outside of the standard form processing logic.
*
*/
// target.prependJavascript("alert('selected method = "
// + modelObject.getName() + "');");
selectedMethodModel.setObject(modelObject);
target.addComponent(HomePage.this.field);
target.addComponent(HomePage.this.selectedMethodField);
}
}, new IAutocompleteControlPanelProvider() {
public Component getPanel(Component onChangeComponent, String controlPanelId) {
return new MatchControlPanel(controlPanelId, methodProvider, onChangeComponent);
}
}, new DefaultAutocompleteRenderingHints(25, true));
field.setOutputMarkupId(true);
classNameFilterField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
/* (non-Javadoc)
* @see org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
*/
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (target != null) {
target.addComponent(field);
}
}
});
selectedMethodField = new Label("selectedMethod", selectedMethodModel = new LoadableDetachableMethodModel(null));
selectedMethodField.setOutputMarkupId(true);
add(field);