Example usage for org.apache.wicket.markup.html.form FormComponent VALUE_SEPARATOR

List of usage examples for org.apache.wicket.markup.html.form FormComponent VALUE_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form FormComponent VALUE_SEPARATOR.

Prototype

String VALUE_SEPARATOR

To view the source code for org.apache.wicket.markup.html.form FormComponent VALUE_SEPARATOR.

Click Source Link

Document

The value separator

Usage

From source file:com.mylab.wicket.jpa.ui.pages.select2.AbstractSelect2Choice.java

License:Apache License

/**
 * @return current value, suitable for rendering as selected value in select2 component
 *//*www .j av a  2  s.  c om*/
protected final M getCurrentValue() {
    if (hasRawInput()) {
        // since raw input is retained, we need explicitly convert it to target value
        if (convertInputPerformed) {
            return getConvertedInput();
        } else {
            String raw = getRawInput();
            return raw == null ? null : convertValue(raw.split(FormComponent.VALUE_SEPARATOR));
        }
    } else {
        return getModelObject();
    }
}

From source file:org.artifactory.common.wicket.util.ComponentPersister.java

License:Open Source License

/**
 * Override wicket's cookie utils to enable encoding and decoding of cookie content.
 * See RTFACT-6086/*from  w ww  .  j  a  v  a  2 s  .  co  m*/
 * @param formComponent
 * @return
 */
protected static String load(final FormComponent<?> formComponent) {
    String value = COOKIE_UTILS.load(formComponent.getPageRelativePath());
    if (value != null) {
        // Assign the retrieved/persisted value to the component
        String[] values = value.split(FormComponent.VALUE_SEPARATOR);
        for (int i = 0; i < values.length; i++) {
            try {
                values[i] = URLDecoder.decode(values[i], "UTF-8");
            } catch (UnsupportedEncodingException e) {
                log.debug("Failed to decode cookie value: {}", e.getMessage());
            }
        }
        formComponent.setModelValue(values);
    }
    return value;
}