1 package com.sri.emo.wizard.completion;
2
3 import com.sri.emo.wizard.defaults.EmoWizardMetadata;
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 {
12
13 /***
14 *
15 */
16 private static final long serialVersionUID = 1L;
17
18
19 /***
20 * Default constructor.
21 */
22 public MinMaxPageMetadata() {
23 super();
24 }
25
26 /***
27 * Maximum entries allwoed.
28 */
29 protected Integer maxEntries = null;
30
31 /***
32 * Minimum entries.
33 */
34 protected Integer minEntries = null;
35
36
37 /***
38 * Retrieve the maximum number of entries for the given page.
39 *
40 * @return Integer
41 */
42 public Integer getMaxEntries() {
43 return maxEntries;
44 }
45
46 /***
47 * Sets the maximum number of entries for a given page.
48 *
49 * @param maxEntries Integer
50 */
51 public void setMaxEntries(Integer maxEntries) {
52 assert maxEntries != null;
53 this.maxEntries = maxEntries;
54 if (this.minEntries != null && minEntries.intValue() > maxEntries.intValue()) {
55 throw new IllegalArgumentException(
56 "The Minimum (" + minEntries.intValue() + ") cannot be greater than the Maximum: (" + maxEntries.intValue() + ")");
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 && minEntries.intValue() > maxEntries.intValue()) {
79 throw new IllegalArgumentException(
80 "The Minimum (" + minEntries.intValue() + ") cannot be greater than the Maximum: (" + maxEntries.intValue() + ")");
81 }
82 }
83
84 /***
85 * Set to true if the page has text entry. (Which is always the case
86 * for this type of page)
87 */
88 public boolean isHasEntry() {
89 return true;
90 }
91
92 }