1 package com.sri.emo.wizard.creation;
2
3 import com.sri.emo.wizard.defaults.*;
4
5
6 /***
7 * Page Metadata base class that supports min/max settings.
8 *
9 * @author Michael Rimov
10 */
11 public class MinMaxPageMetadata extends EmoWizardMetadata implements CreationMetadata {
12
13 /***
14 * Default constructor.
15 */
16 public MinMaxPageMetadata() {
17 super();
18 }
19
20 /***
21 * Maximum entries allwoed.
22 */
23 protected Integer maxEntries = null;
24
25 /***
26 * Minimum entries.
27 */
28 protected Integer minEntries = null;
29
30 /***
31 * added by rich
32 */
33 private boolean search, browse, create, required;
34 private String searchText, browseText, createText;
35 /***
36 * Retrieve the maximum number of entries for the given page.
37 *
38 * @return Integer
39 */
40 public Integer getMaxEntries() {
41 return maxEntries;
42 }
43
44 /***
45 * Sets the maximum number of entries for a given page.
46 *
47 * @param maxEntries Integer
48 */
49 public void setMaxEntries(Integer maxEntries) {
50 assert maxEntries != null;
51 this.maxEntries = maxEntries;
52 if (this.minEntries != null) {
53 if (minEntries.intValue() > maxEntries.intValue()) {
54 throw new IllegalArgumentException(
55 "The Minimum (" + minEntries.intValue() + ") cannot be greater than the Maximum: (" + maxEntries.intValue() + ")");
56 }
57 }
58 }
59
60 /***
61 * Retrieve the minimum entries for the page.
62 *
63 * @return Integer
64 */
65 public Integer getMinEntries() {
66 return minEntries;
67 }
68
69 /***
70 * Sets the minimum number of entries for the page.
71 *
72 * @param minEntries Integer
73 */
74 public void setMinEntries(Integer minEntries) {
75 assert minEntries != null;
76
77 this.minEntries = minEntries;
78 if (this.maxEntries != null) {
79 if (minEntries.intValue() > maxEntries.intValue()) {
80 throw new IllegalArgumentException(
81 "The Minimum (" + minEntries.intValue() + ") cannot be greater than the Maximum: (" + maxEntries.intValue() + ")");
82 }
83 }
84 }
85
86 /***
87 * Set to true if the page has text entry. (Which is always the case
88 * for this type of page)
89 */
90 public boolean isHasEntry() {
91 return true;
92 }
93
94 public void setBrowse(boolean browse) {
95 this.browse = browse;
96 }
97
98 public void setCreate(boolean create) {
99 this.create = create;
100 }
101
102 public void setSearch(boolean search) {
103 this.search = search;
104 }
105
106 public void setRequired(boolean required) {
107 this.required = required;
108 }
109
110 public void setBrowseText(String browseText) {
111 this.browseText = browseText;
112 }
113
114 public void setCreateText(String createText) {
115 this.createText = createText;
116 }
117
118 public void setSearchText(String searchText) {
119 this.searchText = searchText;
120 }
121
122 public boolean isBrowse() {
123 return browse;
124 }
125
126 public boolean isCreate() {
127 return create;
128 }
129
130 public boolean isSearch() {
131 return search;
132 }
133
134 public boolean isRequired() {
135 return required;
136 }
137
138 public String getBrowseText() {
139 return browseText;
140 }
141
142 public String getCreateText() {
143 return createText;
144 }
145
146 public String getSearchText() {
147 return searchText;
148 }
149
150 }