##### Coverage Report - jp.co.y_net.amm.page.CommonConfirmPage

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

CommonConfirmPage

0% | 0/13

N/A | N/A

1.0;1

CommonConfirmPage$1

0% | 0/3

0% | 0/2

1.0;1

CommonConfirmPage$2

0% | 0/7

N/A | N/A

1.0;1

CommonConfirmPage$3

0% | 0/5

N/A | N/A

1.0;1

CommonConfirmPage$Callback

0% | 0/1

N/A | N/A

1.0;1

CommonConfirmPage$Executable

0% | 0/1

N/A | N/A

1.0;1

1

0

     package jp.co.y_net.amm.page;

2

3

     import java.io.Serializable;

4

5

     import org.apache.commons.lang.StringUtils;

6

     import org.apache.wicket.ajax.AjaxRequestTarget;

7

     import org.apache.wicket.ajax.markup.html.form.AjaxButton;

8

     import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;

9

     import org.apache.wicket.markup.html.WebPage;

10

     import org.apache.wicket.markup.html.basic.Label;

11

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

12

     import org.apache.wicket.markup.html.panel.FeedbackPanel;

13

     import org.apache.wicket.model.PropertyModel;

14

15

     public class CommonConfirmPage extends WebPage {

16

         private static final long serialVersionUID = 1L;

17

18

         /** 確認メッセージ */

19

0

         public String confirmMessage = ""; // 変数名変更禁止

20

0

         public String confirmMessageStrong = ""; // 変数名変更禁止

21

22

         /**

23

          * コールバックオブジェクト

24

          */

25

         public Callback callback;

26

0

         public static abstract class Callback implements Serializable {

27

             abstract void callback(AjaxRequestTarget target);

28

         }

29

30

         /**

31

          * 処理実行オブジェクト

32

          */

33

         public Executable executable;

34

0

         public static abstract class Executable {

35

             abstract void execute();

36

         }

37

38

0

         public CommonConfirmPage() {

39

40

             /* フィードバックパネル */

41

0

             final FeedbackPanel fbPanel = new FeedbackPanel("feedback");

42

0

             fbPanel.setOutputMarkupId(true);

43

0

             add(fbPanel);

44

45

0

             Form<Void> form = new Form<Void>("form");

46

0

             add(form);

47

48

             /* 確認メッセージ */

49

0

             form.add(new Label("confirmMessage", new PropertyModel<String>(this, "confirmMessage")));

50

0

             form.add(new Label("confirmMessageStrong", new PropertyModel<String>(this, "confirmMessageStrong")){

51

                 @Override

52

                 public boolean isVisible() {

53

0

                     return StringUtils.isEmpty(confirmMessageStrong) == false;

54

                 }

55

56

             });

57

58

59

             /* 実行ボタン */

60

0

             form.add(new AjaxButton("btnExecute"){

61

                 @Override

62

                 protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

63

0

                     executable.execute(); // executableの実行

64

0

                     callback.callback(target); // コールバックに通知

65

0

                     ModalWindow.closeCurrent(target); // 画面を閉じる

66

0

                 }

67

68

                 @Override

69

                 protected void onError(AjaxRequestTarget target, Form<?> form) {

70

                     // 処理なし

71

0

                 }

72

             });

73

74

             /* 戻る/キャンセル ボタン */

75

0

             form.add(new AjaxButton("btnBack") {

76

                 @Override

77

                 protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

78

0

                     ModalWindow.closeCurrent(target); // 画面を閉じる

79

0

                 }

80

81

                 @Override

82

                 protected void onError(AjaxRequestTarget target, Form<?> form) {

83

                     // 処理なし

84

0

                 }

85

             });

86

0

         }

87

88

     }