##### Coverage Report - jp.co.y_net.amm.common.ChoiceElement

Classes in this File | Line Coverage | Branch Coverage | Complexity

ChoiceElement

0% | 0/14

0% | 0/4

1.2857142857142858;1.286

ChoiceElement$Renderer

0% | 0/2

N/A | N/A

1.2857142857142858;1.286

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

      * ChoiceElement : ドロップダウンリストの要素

11

      *

12

      * @version 1.0.0

13

      * @author y.soga

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

          * @param settingModel  指定するドロップダウンリストのModel

41

          * @param choices       選択リストコレクション

42

          * @param target        選択させる値

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