Example usage for org.apache.wicket MarkupContainer setEscapeModelStrings

List of usage examples for org.apache.wicket MarkupContainer setEscapeModelStrings

Introduction

In this page you can find the example usage for org.apache.wicket MarkupContainer setEscapeModelStrings.

Prototype

public final Component setEscapeModelStrings(final boolean escapeMarkup) 

Source Link

Document

Sets whether model strings should be escaped.

Usage

From source file:com.userweave.module.methoden.rrt.page.survey.RrtSurveyUI.java

License:Open Source License

private void addDescriptionList(IModel termsModel) {
    final List<RrtTerm> terms = (List<RrtTerm>) termsModel.getObject();

    // this is a hack!!
    add(new ListView("scale", Collections.singletonList(terms.size() + "")) {

        @Override// w ww.j  av a  2  s  . c o m
        protected void populateItem(ListItem item) {
            String height = (String) item.getModelObject();
            item.add(new StyleHeightAttributeModifier(true, new Model(height), "height"));
        }
    });

    // this is a hack, as above!!
    // Beschreibung Start
    add(new ListView("desc_box", Collections.singletonList(terms.size() + "")) {

        @Override
        protected void populateItem(ListItem item) {
            String height = (String) item.getModelObject();
            item.add(new StyleHeightAttributeModifier(true, new Model(height), "min-height"));
            RepeatingView termsRepeatingView = new RepeatingView("termValueAndDescription");
            int count = 0;
            for (RrtTerm term : terms) {

                MarkupContainer markupContainer = new WebMarkupContainer(Integer.toString(count));
                termsRepeatingView.add(markupContainer);
                markupContainer.add(
                        new AttributeModifier("id", true, new Model("destermid_" + term.getId().toString())));
                markupContainer.setEscapeModelStrings(false);

                markupContainer.add(new Label("value",
                        new LocalizedPropertyModel(term, "value", RrtSurveyUI.this.getLocale())));
                markupContainer.add(new Label("description",
                        new LocalizedPropertyModel(term, "description", RrtSurveyUI.this.getLocale())));

                count++;
            }
            item.add(termsRepeatingView);
        }
    });
}

From source file:com.userweave.module.methoden.rrt.page.survey.RrtSurveyUI.java

License:Open Source License

private void addTermsWithTermId(IModel termsModel) {
    RepeatingView termsRepeatingView = new RepeatingView("term");
    int count = 0;
    for (RrtTerm term : (List<RrtTerm>) termsModel.getObject()) {

        MarkupContainer markupContainer = new WebMarkupContainer(Integer.toString(count));
        termsRepeatingView.add(markupContainer);
        markupContainer.add(new AttributeModifier("id", new Model("termid_" + term.getId().toString())));
        markupContainer.setEscapeModelStrings(false);

        Label value = new Label("value",
                new Model(StringUtils.shorten(LocalizationUtils.getValue(term.getValue(), getLocale()), 25)));
        markupContainer.add(value);//from   www.  jav a  2s.c  o m

        count++;
    }
    add(termsRepeatingView);
}