/*
 * Copyright [2014] [ShopWiki]
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shopwiki.vaadin;

/**
 * @owner rstewart
 */
public abstract class ParameterSelect<T> extends SWSelect {

	public ParameterSelect() {
		super();
	}

	protected abstract T parse(String s);

	public void set(UrlParams params, String key) {
		setComponentError(null);

		if (isNullSelectionAllowed()) {
			setValue(null);
		}

		String s = params.get(key);
		if (s == null || s.isEmpty()) {
			return;
		}

		try {
			T value = parse(s);
			setValue(value);
		} catch (NumberFormatException e) {
			Errors.set(this, "Invalid " + key + ": " + s);
		}
	}
}

@@ -706,21 +706,24 @@
 ct %7B%0A%0A%09p
-ublic
+rotected
  Paramet
@@ -750,16 +750,36 @@
 ();%0A%09%7D%0A%0A
+%09/** Deserialize */%0A
 %09protect
@@ -810,16 +810,145 @@
 ng s);%0A%0A
+%09/** Serialize */%0A%09protected abstract String toString(T value);%0A%0A%09/** Sets the value of the Select according to the UrlParams */%0A
 %09public 
@@ -1299,11 +1299,279 @@
 ;%0A%09%09%7D%0A%09%7D
+%0A%0A%09/** Sets the UrlParamsvalue of the Select according to the UrlParams */%0A%09public void put(UrlParams params, String key) %7B%0A%09%09T value = (T)getValue();%0A%09%09if (value == null) %7B%0A%09%09%09params.remove(key);%0A%09%09%7D else %7B%0A%09%09%09String s = toString(value);%0A%09%09%09params.add(key, s);%0A%09%09%7D%0A%09%7D
 %0A%7D%0A

Add a serialization abstract method (toString) to vaadin/ParameterSelect.java