I can’t view your HTML in my email client, but here’s a quick example of what I think you’re asking for:
HTML: <html xmlns:wicket="http://wicket.apache.org"> <wicket:panel> <span wicket:id="label">[[label]]</span><input wicket:id="textField" type="text" onkeypress="return suppressEnterKey(event)" onkeydown="return suppressEnterKey(event)"> </wicket:panel> </html> Java: import java.util.Collections; import java.util.Iterator; import java.util.List; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.OnChangeAjaxBehavior; import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings; import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.IModel; public class LabeledEditTextField<T> extends Panel { private boolean editable; private Label label; private TextField<T> textField; public LabelEditTextField(String id, IModel<String> labelModel, IModel<T> textFieldModel) { this(id, labelModel, textFieldModel, false); } /** * Create a {@link Label} that can turn into an {@link AutoCompleteTextField} * if the <b>autoCompleteChoices</b> is not <code>null</code>. * * @param id {@link Component} id * @param labelModel {@link IModel} to use for the {@link Label} * @param textFieldModel {@link IModel} to use for the {@link AjaxTextField} or the {@link AutoCompleteTextField} * @param autoCompleteTextField <code>true</code> if an {@link AutoCompleteTextField} is to be used in which case you * must override {@link #getAutoCompleteChoices(String)}. <code>false</code> is a simple * {@link AjaxTextField} is to be used. */ public LabelEditTextField(String id, IModel<String> labelModel, IModel<T> textFieldModel, boolean autoCompleteTextField) { super(id); label = new Label("label", labelModel); textField = (autoCompleteTextField) ? new AutoCompleteTextField<T>("textField", textFieldModel, new AutoCompleteSettings().setPreselect(false)) { @Override protected Iterator getChoices(String input) { return getAutoCompleteChoices(input); } } : new AjaxTextField<T>("textField", textFieldModel) { @Override public void doAjaxUpdates(AjaxRequestTarget target) { LabelEditTextField.this.ajaxCallback(target); } @Override public void doAjaxUpdatesOnError(AjaxRequestTarget target) { LabelEditTextField.this.ajaxCallbackOnError(target); } }; if(autoCompleteTextField) { textField.add(new OnChangeAjaxBehavior() { @Override public void onUpdate(AjaxRequestTarget target) { LabelEditTextField.this.ajaxCallback(target); } @Override public void onError(AjaxRequestTarget target, RuntimeException re) { LabelEditTextField.this.ajaxCallbackOnError(target); } }); } adjustVisibility(); add(label); add(textField); } /** * Provides list of auto-complete choices for the AutoCompleteTextField. * * @param input User input * @return Iterator to the list of auto-complete choices based on the user input. */ protected Iterator<String> getAutoCompleteChoices(String userInput) { List<String> emptyList = Collections.emptyList(); return emptyList.iterator(); } private void adjustVisibility() { if(isEditable()) { label.setVisible(false); textField.setVisible(true); } else { label.setVisible(true); textField.setVisible(false); } } /** * Toggle between the view mode and the edit mode. * * @param editable <code>false</code> by default if the Label is to be displayed, * <code>true</code> if the Text Field is to be displayed. */ public void setEditable(boolean editable) { this.editable = editable; adjustVisibility(); } public TextField<T> getEditComponent() { return this.textField; } public boolean isEditable() { return this.editable; } public void ajaxCallback(AjaxRequestTarget target) { // Optionally overridden by subclasses } public void ajaxCallbackOnError(AjaxRequestTarget target) { // Optionally overridden by subclasses } } I advise you take the common functionality like the setEditable(), isEditable() and getEditComponent() place them into an interface that returns only FormComponents so that you can have other types of LabelledEdit***Component but the TextField. Then provide a factory class for them all. Once you have this composite component that toggles between a form component and a label, you can add it instead of your label. On Jun 27, 2014, at 10:58 PM, kumar ramanathan <kumarramana...@gmail.com> wrote: > Hi Friends , > > Am using the dataview to show my output in table format dep upon by input > search.For the headings am using the below HTML codes. If we have output for > the inputs i like to display the headings else i want to hide the > headings.how can we achieve this. Kindly share your thoughts. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/HTML-headings-tp4666405.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org