Example usage for org.apache.wicket.util.template PackageTextTemplate getString

List of usage examples for org.apache.wicket.util.template PackageTextTemplate getString

Introduction

In this page you can find the example usage for org.apache.wicket.util.template PackageTextTemplate getString.

Prototype

@Override
public String getString() 

Source Link

Usage

From source file:org.artifactory.common.wicket.contributor.ResourcePackage.java

License:Open Source License

private String readInterpolatedString(String path) {
    try {/*  ww  w . j a va  2s  .  co  m*/
        PackageTextTemplate resource = new PackageTextTemplate(scope, path);
        return PropertyVariableInterpolator.interpolate(resource.getString(), this);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:org.wicketstuff.yui.markup.html.calendar.Calendar.java

License:Apache License

/**
 * Gets the initilization script for the javascript component.
 *
 * @return the initilization script//  w w  w.  ja  v a  2 s. com
 */
protected String getJavaScriptComponentInitializationScript() {
    CharSequence leftImage = RequestCycle.get()
            .urlFor(new PackageResourceReference(Calendar.class, "callt.gif"), null).toString();
    CharSequence rightImage = RequestCycle.get()
            .urlFor(new PackageResourceReference(Calendar.class, "calrt.gif"), null).toString();

    Map<String, Object> variables = new HashMap<String, Object>(4);
    variables.put("javaScriptId", javaScriptId);
    variables.put("elementId", elementId);
    variables.put("navigationArrowLeft", leftImage);
    variables.put("navigationArrowRight", rightImage);

    PackageTextTemplate template = new PackageTextTemplate(Calendar.class, "init.js");
    template.interpolate(variables);

    return template.getString();
}

From source file:ro.fortsoft.wicket.dashboard.web.DashboardColumnPanel.java

License:Apache License

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    CharSequence script = sortableAjaxBehavior.getCallbackFunctionBody();

    Map<String, String> vars = new HashMap<String, String>();
    vars.put("component", get("columnContainer").getMarkupId());
    vars.put("stopBehavior", script.toString());

    PackageTextTemplate template = new PackageTextTemplate(DashboardColumnPanel.class,
            "res/sort-behavior.template.js");
    template.interpolate(vars);/*  w  w w .j  a  va 2s .co  m*/

    response.render(OnDomReadyHeaderItem.forScript(template.getString()));
}

From source file:ro.fortsoft.wicket.pivot.web.PivotAreaPanel.java

License:Apache License

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    CharSequence script = sortableAjaxBehavior.getCallbackFunctionBody();

    Map<String, String> vars = new HashMap<String, String>();
    vars.put("component", get("fieldsContainer").getMarkupId());
    vars.put("stopBehavior", script.toString());

    PackageTextTemplate template = new PackageTextTemplate(PivotAreaPanel.class,
            "res/sort-behavior.template.js");
    template.interpolate(vars);//from  w w  w  . j a va2s.  c o  m

    response.render(OnDomReadyHeaderItem.forScript(template.getString()));
    try {
        template.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}