Example usage for org.apache.wicket.markup.html.link Link setModel

List of usage examples for org.apache.wicket.markup.html.link Link setModel

Introduction

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

Prototype

default C setModel(IModel<T> model) 

Source Link

Document

Typesafe setter for the model

Usage

From source file:gr.interamerican.wicket.bo2.factories.Bo2LinkFactory.java

License:Open Source License

/**
 * Creates a new Link that executes a {@link Bo2WicketBlock}.
 * //from w w w.  j  a  va2s .c om
 * @param id 
 *        Wicket id.
 * @param model
 *        Link model.
 * @param block
 *        Bo2WicketBlock that will be executed on link click.
 *        
 * @return Returns a new Link that will execute the specified
 *         Bo2WicketBlock.
 */
public static Link<String> createLink(final String id, final IModel<String> model, final Bo2WicketBlock block) {
    Link<String> link = new Bo2WicketBlockLink<String>(id, block);
    link.setModel(model);
    return link;
}

From source file:gr.interamerican.wicket.bo2.factories.Bo2LinkFactory.java

License:Open Source License

/**
 * Creates a new Link that executes a {@link Bo2WicketBlock}.
 * /*from   ww  w .  ja v  a  2s  . co m*/
 * The button will be created with a ResourceModel for the expression
 * link.id , where id is the id specified. 
 * 
 * @param id 
 *        Wicket id.
 * @param block
 *        Bo2WicketBlock that will be executed on link click.
 *        
 * @return Returns a new Link that will execute the specified
 *         Bo2WicketBlock.
 */
public static Link<String> createLink(final String id, final Bo2WicketBlock block) {
    Link<String> link = new Bo2WicketBlockLink<String>(id, block);
    link.setModel(new ResourceModel("link." + id)); //$NON-NLS-1$
    return link;
}

From source file:net.lunikon.rethul.web.pages.AbstractFilePage.java

License:Open Source License

/**
 * Constructs a new instance of this class.
 * //from   w  w  w .  j  a  va2 s . c o m
 * @param model
 * @param locale
 */
public AbstractFilePage(IModel<File> model, Locale locale) {
    super(model);
    this.fileLocale = locale;

    buildCaption();

    // link back to project page
    Link<File> projectLink = new BookmarkablePageLink<File>("projectLink", ProjectPage.class) {
        @Override
        public PageParameters getPageParameters() {
            String name = getModelObject().getProject().getName();

            PageParameters ps = super.getPageParameters();
            ps.add(ProjectPage.NAME_PARAM, name);

            return ps;
        }
    };
    projectLink.setModel(model);
    add(projectLink);
}

From source file:org.yes.cart.web.page.component.navigation.URLPagingNavigation.java

License:Apache License

/**
 * {@inheritDoc}//w w  w.j  a va2s.com
 */
protected AbstractLink newPagingNavigationLink(final String id, final IPageable pageable, final int pageIndex) {

    final LinksSupport links = ((AbstractWebPage) getPage()).getWicketSupportFacade().links();
    final PaginationSupport pagination = ((AbstractWebPage) getPage()).getWicketSupportFacade().pagination();

    final PageParameters pageParameters = links.getFilteredCurrentParameters(getPage().getPageParameters());
    pageParameters.set(WebParametersKeys.PAGE, pageIndex);

    final Link rez = links.newLink(id, pageParameters);
    if (pagination.markSelectedPageLink(rez, getPage().getPageParameters(), pageIndex)) {
        rez.setModel(new Model(Boolean.TRUE));
    }

    return rez;
}