/**

   Copyright 2009 OpenEngSB Division, Vienna University of Technology

   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 org.openengsb.config.view.util;

import org.apache.wicket.markup.html.form.ChoiceRenderer;

/**
 * Helper class to seperate display and identifier for items in a {@code
 * DropDownChoice}. Use in combination with a {@code new
 * ChoiceRenderer<ChoiceOption>("display", "id")}.
 */
public class ChoiceOption {
    private final String id;
    private final String display;

    public ChoiceOption(String id, String display) {
        super();
        this.id = id;
        this.display = display;
    }

    public String getId() {
        return id;
    }

    public String getDisplay() {
        return display;
    }

    public static ChoiceRenderer<ChoiceOption> createRenderer() {
        return new ChoiceRenderer<ChoiceOption>("display", "id");
    }
}

/**

   Copyright 2009 OpenEngSB Division, Vienna University of Technology

   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 org.openengsb.config.view.util;

import java.io.Serializable;

import org.apache.wicket.markup.html.form.ChoiceRenderer;

/**
 * Helper class to seperate display and identifier for items in a {@code
 * DropDownChoice}. Use in combination with a {@code new
 * ChoiceRenderer<ChoiceOption>("display", "id")}.
 */
public class ChoiceOption implements Serializable {
    private static final long serialVersionUID = 1L;
    private final String id;
    private final String display;

    public ChoiceOption(String id, String display) {
        super();
        this.id = id;
        this.display = display;
    }

    public String getId() {
        return id;
    }

    public String getDisplay() {
        return display;
    }

    public static ChoiceRenderer<ChoiceOption> createRenderer() {
        return new ChoiceRenderer<ChoiceOption>("display", "id");
    }
}

make ChoiceOption Serializable