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

The following examples show how to use org.apache.wicket.util.string.interpolator.MapVariableInterpolator. 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 File: AbstractBasePage.java    From the-app with 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 File: AbstractBasePage.java    From AppStash with 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 File: NavigationPanel.java    From the-app with 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 File: ImageLinkModel.java    From the-app with 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 File: NavigationPanel.java    From AppStash with 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 File: ImageLinkModel.java    From AppStash with 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 File: ExternalPageWidget.java    From Orienteer with 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 File: ExternalPageWidget.java    From Orienteer with 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
Source File: BlockingDecorator.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
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 File: BrowseHtmlJsPaneWidget.java    From Orienteer with 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 File: ODocumentHtmlJsPaneWidget.java    From Orienteer with 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 File: ExternalViewWidget.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
protected String interpolate(String content) {
	return MapVariableInterpolator.interpolate(content, new ODocumentMapWrapper(getModelObject()));
}