Reputation: 55
Is there a way to * out the selection made from a wicket select list similar to how you * out the text in a password field?
(im using java, HTML and wicket in my project)
Upvotes: 0
Views: 53
Reputation: 17513
You could use wicket-extensions's AjaxEditableChoiceLabel
.
List<String> options = Arrays.asList("One", "Two", "Three");
form.add(new AjaxEditableChoiceLabel<>("choice", options) {
@Override protected WebComponent newLabel(final MarkupContainer parent, final String componentId, final IModel<T> model) {
return new Label(componentId, "********");
}
});
See a demo at https://examples9x.wicket.apache.org/ajax/editable-label
By default it uses a Label
to show the view
mode, but you could use any custom Component that shows a mask by overriding its protected WebComponent newLabel(final MarkupContainer parent, final String componentId, final IModel<T> model)
method.
See https://github.com/apache/wicket/blob/5897251e6fdc2d3d51bbb607dd908dd2f72e833a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EditableLabelPage.java for sample code.
Upvotes: 2