001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.common.tagging;
009:
010: //base classes
011: import java.util.ArrayList;
012:
013: //project specific classes
014:
015: //other classes
016:
017: public class StaticConceptTagConstraintContext extends
018: AbstractConceptTagConstraintContext {
019:
020: //
021: private String regEx = null;
022: private String regExErrorMessage = null;
023: private boolean multiLine = false;
024: //private String defaultValue = null;
025:
026: //length
027: private int minimumStringLength = 0;
028: private int maximumStringLength = 0;
029: private boolean stringLengthUnbounded = true;
030:
031: //entry set
032: private ArrayList entryDescriptions = null;
033: private ArrayList entryValues = null;
034: private boolean entrySetExclusive = false;
035: private boolean entrySetRefreshOnChange = false;
036:
037: private StaticConceptTagConstraintContext(
038: ConceptTagConstraintOrTemplate inCtcot) {
039: //
040: super (inCtcot);
041: //
042: this .entryDescriptions = new ArrayList();
043: this .entryValues = new ArrayList();
044: //
045: //if (inCtcot instanceof ConceptTagConstraint) {
046: // ConceptTagConstraint ctcon = (ConceptTagConstraint)inCtcot;
047: // ConceptTagCharacteristic ctchar = ctcon.getCharacteristic();
048: // ctchar.registerLabels(this.entryDescriptions, this.entryValues);
049: //}
050: }
051:
052: public final static StaticConceptTagConstraintContext newInstance(
053: ConceptTagConstraintOrTemplate inCtcot) {
054:
055: StaticConceptTagConstraintContext outValue = null;
056:
057: //if (!inCtcot.getPreferences().isValidateOnlyMode()) {
058: outValue = new StaticConceptTagConstraintContext(inCtcot);
059: //}
060: //else {
061: // outValue = inCtcot.getStaticContext();
062: //}
063:
064: return outValue;
065: }
066:
067: public void addDefaultValue(String inValue) {
068: getConstraintOrTemplate().addDefaultValue(inValue);
069: }
070:
071: //public String getDefaultValueAsString() {
072: // return this.defaultValue;
073: //}
074:
075: //public void setDefaultValueAsString(String inDefaultValue) {
076: // this.defaultValue = inDefaultValue;
077: //}
078:
079: public boolean isMultiLine() {
080: return this .multiLine;
081: }
082:
083: public void setMultiLine(boolean inMultiLine) {
084: this .multiLine = inMultiLine;
085: }
086:
087: public String getRegularExpression() {
088: return this .regEx;
089: }
090:
091: public String getRegularExpressionErrorMessage() {
092: return this .regExErrorMessage;
093: }
094:
095: public void setRegularExpression(String inRegEx) {
096: this .regEx = inRegEx;
097: }
098:
099: public void setRegularExpression(String inRegEx, String inError) {
100: this .regEx = inRegEx;
101: this .regExErrorMessage = inError;
102: }
103:
104: //length
105: public int getMinimumStringLength() {
106: return this .minimumStringLength;
107: }
108:
109: public void setMinimumStringLength(int inLength) {
110: this .minimumStringLength = inLength;
111: }
112:
113: public int getMaximumStringLength() {
114: return this .maximumStringLength;
115: }
116:
117: public void setMaximumStringLength(int inLength) {
118: this .maximumStringLength = inLength;
119: }
120:
121: public boolean isStringLengthUnbounded() {
122: return this .stringLengthUnbounded;
123: }
124:
125: public void setLengthStringUnbounded(boolean inUnboundedLength) {
126: this .stringLengthUnbounded = inUnboundedLength;
127: }
128:
129: public String getEntryDescription(int inIndex) {
130: return (String) this .entryDescriptions.get(inIndex);
131: }
132:
133: public String getEntryValue(int inIndex) {
134: return (String) this .entryValues.get(inIndex);
135: }
136:
137: public int getEntrySetLength() {
138:
139: int outValue = 0;
140: if (this .entryDescriptions != null) {
141: outValue = this .entryDescriptions.size();
142: }
143:
144: return outValue;
145: }
146:
147: public void registerEntry(String inLabel, String inValue) {
148: this .entryDescriptions.add(inLabel);
149: this .entryValues.add(inValue);
150: }
151:
152: public void setEntrySetExclusive(boolean inExclusive) {
153: this .entrySetExclusive = inExclusive;
154: }
155:
156: public boolean isEntrySetExclusive() {
157: return this .entrySetExclusive;
158: }
159:
160: public boolean isEntrySetRefreshOnChange() {
161: return this .entrySetRefreshOnChange;
162: }
163:
164: public void setEntrySetRefreshOnChange(
165: boolean inEntrySetRefreshOnChange) {
166: this.entrySetRefreshOnChange = inEntrySetRefreshOnChange;
167: }
168: }
|