use of org.apache.wicket.util.string.interpolator.MapVariableInterpolator in project the-app by devops-dojo.
the class AbstractBasePage method renderHead.
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
String contextPath = RequestCycle.get().getRequest().getContextPath();
Map<String, String> replacements = Collections.singletonMap("contextPath", getContextPath());
MapVariableInterpolator variableInterpolator = new MapVariableInterpolator(FAVICON_HEADER, replacements);
response.render(StringHeaderItem.forString(variableInterpolator.toString()));
String designUrl = String.format("/assets/css/bootstrap-%s.min.css", designSelector.getDesignType());
response.render(CssHeaderItem.forUrl(contextPath + designUrl));
response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-theme-shop.css"));
response.render(JavaScriptHeaderItem.forUrl(contextPath + "/assets/js/bootstrap.min.js"));
response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-addon.css"));
}
use of org.apache.wicket.util.string.interpolator.MapVariableInterpolator in project wicket by apache.
the class PackageTextTemplate method interpolate.
/**
* Interpolates a <code>Map</code> of variables with the content and replaces the content with
* the result. Variables are denoted in the <code>String</code> by the
* <code>syntax ${variableName}</code>. The contents will be altered by replacing each variable
* of the form <code>${variableName}</code> with the value returned by
* <code>variables.getValue("variableName")</code>.
* <p>
* WARNING: there is no going back to the original contents after the interpolation is done. If
* you need to do different interpolations on the same original contents, use the method
* {@link #asString(Map)} instead.
* </p>
*
* @param variables
* a <code>Map</code> of variables to interpolate
* @return this for chaining
*/
@Override
public final TextTemplate interpolate(Map<String, ?> variables) {
if (variables != null) {
load();
String result = new MapVariableInterpolator(buffer.toString(), variables).toString();
buffer.setLength(0);
buffer.append(result);
}
return this;
}
use of org.apache.wicket.util.string.interpolator.MapVariableInterpolator in project the-app by devops-dojo.
the class LoginPanel method usernameField.
private TextField<String> usernameField() {
TextField<String> usernameField = new TextField<>("username", usernameModel());
usernameField.add(new IValidator<String>() {
private static final long serialVersionUID = 1315522649098034068L;
@Override
public void validate(IValidatable<String> userNameValidatable) {
String username = userNameValidatable.getValue();
UserInfo userInfo = userService.findByUsername(username);
if (userInfo == null) {
error(new MapVariableInterpolator(getString("username.notKnown"), Collections.singletonMap("username", username)).toString());
}
}
});
usernameField.setRequired(true);
return usernameField;
}
Aggregations