Example usage for org.apache.wicket.velocity.markup.html VelocityPanel forTemplateResource

List of usage examples for org.apache.wicket.velocity.markup.html VelocityPanel forTemplateResource

Introduction

In this page you can find the example usage for org.apache.wicket.velocity.markup.html VelocityPanel forTemplateResource.

Prototype

@SuppressWarnings("rawtypes")
public static VelocityPanel forTemplateResource(final String id, final IModel<? extends Map> model,
        final IResourceStream templateResource) 

Source Link

Document

Convenience factory method to create a VelocityPanel instance with a given IStringResourceStream template resource .

Usage

From source file:ca.travelagency.BasePrintPage.java

License:Apache License

public BasePrintPage(String velocityTemplate, IModel<?> model) {
    super(model);
    Validate.notBlank(velocityTemplate);

    Map<String, Object> map = getObjectMap();
    map.put("company", getCompany());
    map.put("dateUtils", new VelocityDateUtils());
    map.put("stringUtils", new VelocityStringUtils());
    MapModel<String, Object> context = new MapModel<String, Object>(map);

    URL resource = ContextClassLoaderUtils.getResource(velocityTemplate + EXTENSION);
    IResourceStream templateResource = new UrlResourceStream(resource);

    VelocityPanel velocityPanel = VelocityPanel.forTemplateResource(PREVIEW, context, templateResource);
    velocityPanel.add(new LogoImage(LOGO_IMAGE));
    add(velocityPanel);/*ww  w .ja  va 2s  . co m*/

    add(new Label(TITLE, getPageTitle()));
}

From source file:de.alpharogroup.wicket.components.socialnet.fb.like.and.share.FacebookLikeAndSharePanel.java

License:Apache License

/**
 * Instantiates a new {@link FacebookLikeAndSharePanel}.
 *
 * @param id/*from w  w  w.j av a2s . c  o  m*/
 *            the id
 * @param model
 *            the model
 */
public FacebookLikeAndSharePanel(final String id, final IModel<FacebookLikeAndShareModelBean> model) {
    super(id, model);
    final HashMap<String, String> values = new HashMap<String, String>();
    values.put("data-share", model.getObject().getDataShare().toString());
    values.put("data-width", model.getObject().getDataWith().toString());
    values.put("data-show-faces", model.getObject().getDataShowFaces().toString());
    final Model<HashMap<String, String>> context = Model.of(values);

    final UrlResourceStream template = new UrlResourceStream(
            FacebookLikeAndSharePanel.class.getResource("fbLikeShare.vm"));
    add(VelocityPanel.forTemplateResource("velocityPanel", context, template));
}

From source file:de.alpharogroup.wicket.components.velocity.VelocityFieldsPanel.java

License:Apache License

/**
 * Instantiates a new {@link VelocityFieldsPanel}.
 *
 * @param id//from   ww  w .j a v a2s  .c o  m
 *            the id
 * @param model
 *            the model
 * @param templateResource
 *            the template resource
 */
@SuppressWarnings("rawtypes")
public VelocityFieldsPanel(final String id, final IModel<? extends Map> model,
        final IResourceStream templateResource) {
    super(id, model);
    add(VelocityPanel.forTemplateResource("velocityPanel", model, templateResource));
}