1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.plugin.database.component;
17
18 import org.seasar.tuigwaa.controller.config.ValidatorUtils;
19
20 import com.isenshi.util.CharUtil;
21
22 public class ActionLink {
23
24 private String label;
25
26 private String path;
27
28 private boolean buttonFlag;
29
30 private boolean needConfirmation;
31
32 public ActionLink(String label, String path, boolean buttonFlag,
33 boolean needConfirmation) {
34 this.label = label;
35 this.path = path;
36 this.buttonFlag = buttonFlag;
37 this.needConfirmation = needConfirmation;
38 }
39
40 public String getLabel() {
41 return label;
42 }
43
44 public void setLabel(String label) {
45 this.label = label;
46 }
47
48 public String getPath() {
49 return doCreatePath(path);
50 }
51
52 public String getPath(Long id) {
53 return doCreatePath(CharUtil.replace(path, "id", "" + id));
54 }
55
56 public void setPath(String path) {
57 this.path = path;
58 }
59
60 public boolean isButtonFlag() {
61 return buttonFlag;
62 }
63
64 private String doCreatePath(String curPath) {
65 if (needConfirmation) {
66 boolean needMoreEncode = !buttonFlag;
67 return ValidatorUtils.getDeleteConfirmationFunc(curPath,
68 needMoreEncode);
69 } else {
70 return curPath;
71 }
72 }
73
74 }