Example usage for org.apache.wicket.ajax.markup.html AjaxLink setModel

List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink setModel

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.markup.html AjaxLink setModel.

Prototype

default C setModel(IModel<T> model) 

Source Link

Document

Typesafe setter for the model

Usage

From source file:gr.interamerican.wicket.factories.LinkFactory.java

License:Open Source License

/**
 * creates a new AjaxButton that executes a {@link CallbackAction}.
 * //ww w .  ja  v a2 s .  c  o m
 * @param id 
 *        Button id.
 * @param model
 *        Link model.
 * @param action
 *        CallbackAction that will be executed on button press.
 *        
 * @return Returns a new AjaxButton that will execute the specified
 *         Bo2WicketBlock.
 */
public static AjaxLink<String> createLink(final String id, final IModel<String> model,
        final CallbackAction action) {
    AjaxLink<String> link = new CallbackAjaxLink<String>(id, action);
    link.setModel(model);
    return link;
}

From source file:gr.interamerican.wicket.factories.LinkFactory.java

License:Open Source License

/**
 * Creates a new AjaxLink that executes a {@link CallbackAction}.
 * //from w w  w. jav a  2 s  . c  o  m
 * The button will be created with a ResourceModel for the expression
 * link.id , where id is the id specified. 
 * 
 * @param id 
 *        Button id.
 * @param action
 *        CallbackAction that will be executed on button press.
 *        
 * @return Returns a new AjaxButton that will execute the specified
 *         Bo2WicketBlock.
 */
public static AjaxLink<String> createLink(final String id, final CallbackAction action) {
    AjaxLink<String> link = new CallbackAjaxLink<String>(id, action);
    link.setModel(new ResourceModel("link." + id)); //$NON-NLS-1$
    return link;
}

From source file:org.hippoecm.frontend.plugins.reviewedactions.PublishAllShortcutPlugin.java

License:Apache License

public PublishAllShortcutPlugin(final IPluginContext context, final IPluginConfig config) {
    super(context, config);

    AjaxLink<String> link = new AjaxLink<String>("link") {
        @Override/* w w  w.j a v a2s .c o m*/
        public void onClick(AjaxRequestTarget target) {
            IDialogService dialogService = getDialogService();
            dialogService.show(new PublishAllShortcutPlugin.Dialog(config));
        }
    };
    link.setModel(new StringResourceModel(config.getString("label.link"), this, null));
    add(link);
    Label label = new Label("label");
    label.setDefaultModel(new StringResourceModel(config.getString("label.link"), this, null));
    link.add(label);
}