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.function.v1;
009:
010: //base classes
011: import javax.servlet.jsp.PageContext;
012:
013: //project specific classes
014: import org.jfolder.common.SelfArgumentlessConstructor;
015: import org.jfolder.common.StandardDataTypes;
016: import org.jfolder.common.UnexpectedSystemException;
017: import org.jfolder.common.function.BaseCommonFunctionCompatibilityTag;
018: import org.jfolder.common.function.ComponentsForReturnableWebPageTag;
019: import org.jfolder.common.function.WebPageTagHelper;
020: import org.jfolder.common.function.WebPageTagInstanceViewContext;
021: import org.jfolder.common.function.WebPageTagInstanceViewContextInfo;
022: import org.jfolder.common.tagging.AppraiseConceptTagContext;
023: import org.jfolder.common.tagging.ConceptTagCharacteristic;
024: import org.jfolder.common.tagging.ConceptTagConstraint;
025: import org.jfolder.common.tagging.ConceptTagConstraintHolder;
026: import org.jfolder.common.tagging.ConceptTagFlagsHelper;
027: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
028: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
029: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
030: import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
031: import org.jfolder.common.tagging.InitializeConceptTagContext;
032: import org.jfolder.common.tagging.SelectionCriteriaForReturnableConceptTag;
033: import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
034: import org.jfolder.common.tagging.StudioConceptTagCreParInfoContext;
035: import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
036: import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
037: import org.jfolder.common.tagging.ValueAndClassForConceptTag;
038: import org.jfolder.common.utils.misc.MiscHelper;
039:
040: //import org.jfolder.workflow.model.attributes.AttributeSet;
041: //import org.jfolder.workflow.model.instance.WorkflowInstance;
042:
043: //other classes
044:
045: public class CommonFunctionCompIsNotNullTag extends
046: BaseCommonFunctionCompatibilityTag implements
047: SelfArgumentlessConstructor {
048:
049: //
050: private ConceptTagCharacteristic valueCtchar = null;
051:
052: //value details
053: private final static String VALUE_CTCON = "value";
054: private final static String VALUE_TITLE = "Value";
055: private final static String VALUE_SHORT_DESCRIPTION = "Value of this string";
056:
057: //
058:
059: public void initialize(InitializeConceptTagContext inIctc) {
060:
061: //
062: ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
063: .newInstance(inIctc);
064: //
065: //rootCtconh.getAttributes().setStudioVisibleOnlyOnError(true);
066: //rootCtconh.getStyles().setStudioVisibleOnlyOnError(true);
067:
068: //constrain "value"
069: ConceptTagConstraint valueCtcon = ConceptTagConstraint
070: .newInstance(VALUE_CTCON, rootCtconh);
071: valueCtcon.setTitle(VALUE_TITLE);
072: valueCtcon.setShortDescription(VALUE_SHORT_DESCRIPTION);
073: valueCtcon.setMinimumLength(1);
074: valueCtcon.setMaximumLength(1);
075: //
076: DynamicConceptTagConstraintContext valueDctcc = DynamicConceptTagConstraintContext
077: .newInstance(valueCtcon);
078: valueDctcc.getValidator().filterDirectChildOfRootAndHtml();
079: //
080: //valueDctcc.addDefaultValue(
081: // TaglibLiteralBooleanWebPageTag.class);
082:
083: //
084: ConceptTagConstraint unconstrainedCtcon = rootCtconh
085: .getUndefinedConstraint();
086: //unconstrainedCtcon.setStudioVisibleOnlyOnError(true);
087:
088: //
089: ConceptTagFlagsHelper
090: .pushNonIterativeCommonFunctionDepth(inIctc);
091: inIctc.initialize();
092: ConceptTagFlagsHelper
093: .popNonIterativeCommonFunctionDepth(inIctc);
094:
095: //
096: //post initialization validation
097: //TO DO: compare class against value
098:
099: //
100: this .valueCtchar = valueCtcon.getCharacteristic();
101: }
102:
103: public void appraise(AppraiseConceptTagContext inActc) {
104:
105: if (inActc instanceof StudioConceptTagInstanceInfoContext) {
106:
107: StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inActc;
108:
109: sctiic.setInstanceTitle("Is Not Null");
110: sctiic.setInstanceDescription("Is Not Null");
111: } else if (inActc instanceof StudioConceptTagTypeInfoContext) {
112:
113: StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inActc;
114:
115: scttic.setTypeTitle("Is Not Null");
116: scttic.setTypeDescription("Is Not Null");
117: } else if (inActc instanceof WebPageTagInstanceViewContext) {
118:
119: WebPageTagInstanceViewContext wptivc = (WebPageTagInstanceViewContext) inActc;
120:
121: WebPageTagInstanceViewContextInfo info = wptivc
122: .getInfoAsNonHtml();
123:
124: //if (this.valueCtchar.getValueLength() == 1) {
125: WebPageTagInstanceViewContext.displayView(this .valueCtchar,
126: info, wptivc, "???");
127: info.setNonHtmlContent("", " IS NOT NULL");
128: //}
129: //else {
130: // info.setNonHtmlContent("??? IS NOT NULL");
131: //}
132: } else if (inActc instanceof SelectionCriteriaForReturnableConceptTag) {
133:
134: SelectionCriteriaForReturnableConceptTag scfrct = (SelectionCriteriaForReturnableConceptTag) inActc;
135:
136: scfrct.canReturnBoolean();
137: scfrct.declareFormatAsPlain();
138: } else if (inActc instanceof StudioConceptTagCreParInfoContext) {
139:
140: StudioConceptTagCreParInfoContext scpc = (StudioConceptTagCreParInfoContext) inActc;
141: }
142: }
143:
144: public void determineValueAndClass(
145: DetermineValueAndClassConceptTagContext inDvacctc) {
146:
147: try {
148: ValueAndClassForConceptTag vacfct = null;
149:
150: ValueAndClassForConceptTag valueVac = this .valueCtchar
151: .getDetermineValueAndClass(0, inDvacctc);
152:
153: vacfct = ValueAndClassForConceptTag.newBoolean(new Boolean(
154: valueVac.getValue() != null));
155:
156: inDvacctc.setDetermineValueAndClass(vacfct);
157: } catch (DetermineValueAndClassConceptTagException dvaccte) {
158: inDvacctc.setDetermineException(dvaccte);
159: }
160: }
161:
162: public void determineClass(DetermineClassConceptTagContext inDcctc) {
163:
164: inDcctc.setDetermineClass(StandardDataTypes.getBooleanClass());
165: }
166:
167: public Object createUninitializedSelf() {
168: return new CommonFunctionCompIsNotNullTag();
169: }
170: }
|