| 1 | |
package jp.co.y_net.amm.common; |
| 2 | |
|
| 3 | |
import java.io.Serializable; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import org.apache.wicket.markup.html.form.ChoiceRenderer; |
| 7 | |
import org.apache.wicket.model.Model; |
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
public class ChoiceElement implements Serializable { |
| 16 | |
|
| 17 | |
private static final long serialVersionUID = 6210226619432905234L; |
| 18 | |
|
| 19 | |
private String id; |
| 20 | |
private String name; |
| 21 | |
|
| 22 | 0 | public ChoiceElement(String id,String name) { |
| 23 | 0 | this.id = id; |
| 24 | 0 | this.name = name; |
| 25 | 0 | } |
| 26 | |
public String getId() { |
| 27 | 0 | return id; |
| 28 | |
} |
| 29 | |
public void setId(String id) { |
| 30 | 0 | this.id = id; |
| 31 | 0 | } |
| 32 | |
public String getName() { |
| 33 | 0 | return name; |
| 34 | |
} |
| 35 | |
public void setName(String name) { |
| 36 | 0 | this.name = name; |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
public static void setDropDownList(Model<ChoiceElement> settingModel,List<ChoiceElement> choices ,String target) { |
| 45 | 0 | for (ChoiceElement che : choices) { |
| 46 | 0 | if (che.getId().equals(target)==true) { |
| 47 | 0 | settingModel.setObject(che); |
| 48 | |
} |
| 49 | |
} |
| 50 | 0 | } |
| 51 | |
|
| 52 | |
public static class Renderer extends ChoiceRenderer<ChoiceElement>{ |
| 53 | |
public Renderer() { |
| 54 | 0 | super("name","id"); |
| 55 | 0 | } |
| 56 | |
} |
| 57 | |
} |
| 58 | |
|