Java Code Examples for org.apache.wicket.util.string.interpolator.MapVariableInterpolator

The following examples show how to use org.apache.wicket.util.string.interpolator.MapVariableInterpolator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: the-app   Source File: AbstractBasePage.java    License: Apache License 2.0 6 votes vote down vote up
@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"));
}
 
Example 2
Source Project: AppStash   Source File: AbstractBasePage.java    License: Apache License 2.0 6 votes vote down vote up
@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"));
}
 
Example 3
Source Project: the-app   Source File: NavigationPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getObject() {
    NavigationEntry navigationEntry = this.navigationEntryModel.getObject();
    String type = navigationEntry.getPageParameters().get(TYPE).toString();
    Map<String, String> replacements = Collections.singletonMap(TYPE, type);
    return new MapVariableInterpolator(linkTemplateModel.getObject(), replacements).toString();
}
 
Example 4
Source Project: the-app   Source File: ImageLinkModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getObject() {
    VariableInterpolator interpolator = new MapVariableInterpolator(TEMPLATE, ImmutableMap.builder()
            .put("contextPath", parent.getRequestCycle().getRequest().getContextPath())
            .put("type", productInfoModel.getObject().getType().getUrlname())
            .put("name", productInfoModel.getObject().getUrlname())
            .build());
    return interpolator.toString();
}
 
Example 5
Source Project: AppStash   Source File: NavigationPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getObject() {
    NavigationEntry navigationEntry = this.navigationEntryModel.getObject();
    String type = navigationEntry.getPageParameters().get(TYPE).toString();
    Map<String, String> replacements = Collections.singletonMap(TYPE, type);
    return new MapVariableInterpolator(linkTemplateModel.getObject(), replacements).toString();
}
 
Example 6
Source Project: AppStash   Source File: ImageLinkModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getObject() {
    VariableInterpolator interpolator = new MapVariableInterpolator(TEMPLATE, ImmutableMap.builder()
            .put("contextPath", parent.getRequestCycle().getRequest().getContextPath())
            .put("type", productInfoModel.getObject().getType().getUrlname())
            .put("name", productInfoModel.getObject().getUrlname())
            .build());
    return interpolator.toString();
}
 
Example 7
Source Project: Orienteer   Source File: ExternalPageWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected IModel<String> getDefaultTitleModel() {
    return new LoadableDetachableModel<String>() {
        @Override
        protected String load() {
            return MapVariableInterpolator.interpolate(externalPageUrl, new ODocumentMapWrapper(getModelObject()));
        }
    };
}
 
Example 8
Source Project: Orienteer   Source File: ExternalPageWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();

    if (!Strings.isNullOrEmpty(externalPageUrl)) {
        String interpolatedUrl = MapVariableInterpolator.interpolate(externalPageUrl, new ODocumentMapWrapper(getModelObject()));
        RedirectPage page = new RedirectPage(interpolatedUrl);
        final InlineFrame frame = new InlineFrame("embeddedPage", page);
        frame.add(new AttributeModifier("style", style));
        add(frame);
    } else {
        add(new EmptyPanel("embeddedPage"));
    }
}
 
Example 9
public CharSequence decorateScript(Component component, CharSequence script) {
	switch (callback.getCalendar().getAjaxConcurrency()) {
	case QUEUE:
		return script;
	case DROP_PER_CALLBACK:
	case DROP:
		return new MapVariableInterpolator(template, new MicroMap<String, String>("var", var())).toString()
			+ script;

	default:
		throw new IllegalStateException();
	}
}
 
Example 10
Source Project: Orienteer   Source File: BrowseHtmlJsPaneWidget.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected String interpolate(String content) {
	Map<String, Object> params = new HashMap<String, Object>();
	params.put("className", getModelObject().getName());
	return MapVariableInterpolator.interpolate(super.interpolate(content), params);
}
 
Example 11
Source Project: Orienteer   Source File: ODocumentHtmlJsPaneWidget.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected String interpolate(String content) {
	return MapVariableInterpolator.interpolate(super.interpolate(content), new ODocumentMapWrapper(getModelObject()));
}
 
Example 12
Source Project: Orienteer   Source File: ExternalViewWidget.java    License: Apache License 2.0 4 votes vote down vote up
protected String interpolate(String content) {
	return MapVariableInterpolator.interpolate(content, new ODocumentMapWrapper(getModelObject()));
}