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;
009:
010: //base classes
011: import java.util.ArrayList;
012: import java.util.HashMap;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.tagging.ConceptTagCharacteristic;
017: import org.jfolder.common.tagging.ConceptTagCharacteristicHolder;
018: import org.jfolder.common.tagging.ConceptTagPreferences;
019:
020: //other classes
021:
022: public class WebPageTagInstanceViewContextInfo {
023:
024: //
025: private final static int DISPLAY_TYPE__UNINITIALIZED = 0;
026: //
027: private final static int DISPLAY_TYPE__HTML = 1;
028: private final static int DISPLAY_TYPE__NON_HTML = 2;
029: //
030: private final static int DISPLAY_TYPE__ITERATIVE_NON_HTML = 3;
031: //
032: private int displayType = 0;
033: //
034: private boolean iterativeMiddleContent = false;
035: //
036: private String nonHtmlStartContent = null;
037: private String nonHtmlEndContent = null;
038: //
039: private WebPageTagInstanceViewContextSubHtmlInfo htmlWptivcshi = null;
040: //
041: private String htmlStartContent = null;
042: private String htmlEndContent = null;
043: private boolean htmlContentFormatted = false;
044: //private String startFirstHalfContent = null;
045: //private String startLastHalfContent = null;
046: //
047: //
048: private String iterativeOuterStart = null;
049: private String iterativeInnerStart = null;
050: private String iterativeInnerEnd = null;
051: private String iterativeOuterEnd = null;
052: //
053: //private boolean useIndentWithSubBlock = false;
054: //
055: private ArrayList content = null;
056: private WebPageTagInstanceViewContextInfo subEarmark = null;
057: //
058: private Object idHandle[] = null;
059: //
060: private WebPageTagInstanceViewContextInfo parentWptivci = null;
061: //
062: private boolean earmarkToParent = false;
063: //
064: //
065: private String defaultConstraint = null;
066: //
067: private boolean occurredPush = false;
068: private boolean occurredPop = false;
069: //
070: private String mouseOutBorderWidth = null;
071: private String mouseOutBorderStyle = null;
072: private String mouseOutBorderColor = null;
073: //
074: private String mouseOverBorderWidth = null;
075: private String mouseOverBorderStyle = null;
076: private String mouseOverBorderColor = null;
077: //
078: //private boolean rootWptivci = false;
079: //
080: private Boolean notEmpty = null;
081:
082: //
083: private WebPageTagInstanceViewContextInfo(
084: WebPageTagInstanceViewContextInfo inParentWptivci,
085: boolean inEarmark) {
086: //
087: this .displayType = DISPLAY_TYPE__UNINITIALIZED;
088: this .content = new ArrayList();
089: //
090: this .iterativeOuterStart = "";
091: this .iterativeInnerStart = "";
092: this .iterativeInnerEnd = "";
093: this .iterativeOuterEnd = "";
094: //
095: //this.nonHtmlStartContent = "";
096: resetContent();
097: //this.nonHtmlEndContent = "";
098: //
099: this .idHandle = new Object[0];
100: //
101: this .parentWptivci = inParentWptivci;
102: //
103: this .earmarkToParent = inEarmark;
104: //
105: //
106: //
107: this .mouseOutBorderWidth = "";
108: this .mouseOutBorderStyle = "";
109: this .mouseOutBorderColor = "";
110: //
111: //
112: this .mouseOverBorderWidth = "1px";
113: this .mouseOverBorderStyle = "dashed";
114: this .mouseOverBorderColor = "blue";
115: }
116:
117: //
118: public Object[] getIdHandle() {
119: return this .idHandle;
120: }
121:
122: //
123: //
124: public boolean isEarmarkToParent() {
125: return this .earmarkToParent;
126: }
127:
128: //
129: public WebPageTagInstanceViewContextInfo createEarmarkInfo() {
130:
131: WebPageTagInstanceViewContextInfo outValue = null;
132:
133: if (this .idHandle.length > 0) {
134: outValue = new WebPageTagInstanceViewContextInfo(this , true);
135: outValue.markAsNonHtml();
136: this .subEarmark = outValue;
137: } else {
138: throw new UnexpectedSystemException(
139: "Cannot create an earmark unless an ID is declared");
140: }
141:
142: return outValue;
143: }
144:
145: //
146: public WebPageTagInstanceViewContextInfo getSubEarmark() {
147: return this .subEarmark;
148: }
149:
150: public boolean isSubEarmarkPresent() {
151: return (this .subEarmark != null);
152: }
153:
154: //
155: //
156: private void markAsIterativeMiddleContent() {
157: this .iterativeMiddleContent = true;
158: }
159:
160: private boolean isIterativeMiddleContent() {
161: return this .iterativeMiddleContent;
162: }
163:
164: //
165: //public void setIdHandle(String inIdHandle[]) {
166: // this.idHandle = inIdHandle;
167: //}
168: //
169: protected void setIterativeOuterStart(String inIterativeOuterStart) {
170: this .iterativeOuterStart = inIterativeOuterStart;
171: }
172:
173: public String getIterativeOuterStart() {
174: return this .iterativeOuterStart;
175: }
176:
177: //
178: protected void setIterativeInnerStart(String inIterativeInnerStart) {
179: this .iterativeInnerStart = inIterativeInnerStart;
180: }
181:
182: public String getIterativeInnerStart() {
183: return this .iterativeInnerStart;
184: }
185:
186: //
187: protected void setIterativeInnerEnd(String inIterativeInnerEnd) {
188: this .iterativeInnerEnd = inIterativeInnerEnd;
189: }
190:
191: public String getIterativeInnerEnd() {
192: return this .iterativeInnerEnd;
193: }
194:
195: //
196: protected void setIterativeOuterEnd(String inIterativeOuterEnd) {
197: this .iterativeOuterEnd = inIterativeOuterEnd;
198: }
199:
200: public String getIterativeOuterEnd() {
201: return this .iterativeOuterEnd;
202: }
203:
204: //
205: public boolean isInitialized() {
206: return !(this .displayType == DISPLAY_TYPE__UNINITIALIZED);
207: }
208:
209: //public boolean isIndentWithSubBlockInUse() {
210: // return this.useIndentWithSubBlock;
211: //}
212: //
213: private void resetContent() {
214: //
215: this .nonHtmlStartContent = null;
216: this .nonHtmlEndContent = null;
217: //
218: this .htmlWptivcshi = null;
219: //
220: this .htmlStartContent = null;
221: this .htmlEndContent = null;
222: this .htmlContentFormatted = false;
223: }
224:
225: //
226: public boolean isMultiPartHtmlContentPresent() {
227: return (this .htmlWptivcshi != null);
228: }
229:
230: public boolean isHtmlContentPresent() {
231: return (this .htmlStartContent != null || this .htmlEndContent != null);
232: }
233:
234: public String getHtmlStartContent() {
235: return this .htmlStartContent;
236: }
237:
238: public String getHtmlEndContent() {
239: return this .htmlEndContent;
240: }
241:
242: public boolean isHtmlContentFormatted() {
243: return this .htmlContentFormatted;
244: }
245:
246: public boolean isNonHtmlPresent() {
247: return (this .nonHtmlStartContent != null || this .nonHtmlEndContent != null);
248: }
249:
250: //
251: //
252: //
253: public void setHtmlContent(String inStartContent,
254: boolean inFormatted) {
255: setHtmlContent(inStartContent, "", inFormatted);
256: }
257:
258: public void setHtmlContent(String inStartContent,
259: String inEndContent, boolean inFormatted) {
260: //
261: if (this .displayType == DISPLAY_TYPE__HTML) {
262: //
263: resetContent();
264: //
265: this .htmlStartContent = inStartContent;
266: this .htmlEndContent = inEndContent;
267: this .htmlContentFormatted = inFormatted;
268: //
269: //this.startFirstHalfContent = inFirstHalf;
270: //this.startLastHalfContent = inLastHalf;
271: } else {
272: throw UnexpectedSystemException.unknownState();
273: }
274: }
275:
276: public void setHtmlContent(
277: WebPageTagInstanceViewContextSubHtmlInfo inWptivcshi) {
278: //
279: if (this .displayType == DISPLAY_TYPE__HTML) {
280: //
281: resetContent();
282: //
283: this .htmlWptivcshi = inWptivcshi;
284: //
285: //this.startFirstHalfContent = inFirstHalf;
286: //this.startLastHalfContent = inLastHalf;
287: } else {
288: throw UnexpectedSystemException.unknownState();
289: }
290: }
291:
292: //
293: //
294: //
295: //public String getStartFirstHalfContent() {
296: // return this.startFirstHalfContent;
297: //}
298: //public String getStartLastHalfContent() {
299: // return this.startLastHalfContent;
300: //}
301: //
302: public WebPageTagInstanceViewContextSubHtmlInfo getContentAsSubHtml() {
303: return this .htmlWptivcshi;
304: }
305:
306: //
307: //
308: //
309: //
310: public void setNonHtmlContent(String inStartContent) {
311: setNonHtmlContent(inStartContent, "");
312: }
313:
314: public void setNonHtmlContent(String inStartContent,
315: String inEndContent) {
316: //
317: if (this .displayType == DISPLAY_TYPE__NON_HTML) {
318: //
319: resetContent();
320: this .nonHtmlStartContent = inStartContent;
321: this .nonHtmlEndContent = inEndContent;
322: } else {
323: throw UnexpectedSystemException.unknownState();
324: }
325: }
326:
327: //
328: public String getNonHtmlStartContent() {
329: //MiscHelper.println(
330: // "WebPagTagInstViewConInfo getStartCon() = " + this.startContent);
331: return this .nonHtmlStartContent;
332: }
333:
334: //
335: //public void setNonHtmlEndContent(String inEndContent) {
336: // if (this.displayType == DISPLAY_TYPE__NON_HTML) {
337: // resetContent();
338: // this.nonHtmlEndContent = inEndContent;
339: // }
340: // else {
341: // throw UnexpectedSystemException.unknownState();
342: // }
343: //}
344: public String getNonHtmlEndContent() {
345: //MiscHelper.println(
346: // "WebPagTagInstViewConInfo getEndContent() = " + this.endContent);
347: return this .nonHtmlEndContent;
348: }
349:
350: //
351: public int getContentLength() {
352: return this .content.size();
353: }
354:
355: //
356: public boolean isDefaultConstraintPresent() {
357: return (this .defaultConstraint != null);
358: }
359:
360: public String getDefaultConstraint() {
361: return this .defaultConstraint;
362: }
363:
364: protected void setDefaultConstraint(String inDefaultConstraint) {
365: this .defaultConstraint = inDefaultConstraint;
366: }
367:
368: //
369: //
370: //
371: //
372: //
373: public WebPageTagInstanceViewContextInfo getContentAsInfo(
374: int inIndex) {
375:
376: WebPageTagInstanceViewContextInfo outValue = null;
377:
378: Object o = this .content.get(inIndex);
379: outValue = ((WebPageTagInstanceViewContextInfo) o);
380:
381: return outValue;
382: }
383:
384: //
385: protected final static WebPageTagInstanceViewContextInfo createRootInfo() {
386:
387: WebPageTagInstanceViewContextInfo outValue = null;
388:
389: //
390: outValue = new WebPageTagInstanceViewContextInfo(null, false);
391: outValue.markAsHtml();
392: //outValue.markAsNonHtml();
393: //
394: //outValue.setIdHandle(inRootIdHandle);
395:
396: return outValue;
397: }
398:
399: public final static WebPageTagInstanceViewContextInfo createErrorInfo() {
400:
401: WebPageTagInstanceViewContextInfo outValue = null;
402:
403: //
404: outValue = new WebPageTagInstanceViewContextInfo(null, false);
405: outValue.markAsNonHtml();
406: //outValue.markAsNonHtml();
407: //
408: //outValue.setIdHandle(inRootIdHandle);
409:
410: return outValue;
411: }
412:
413: //
414: //
415: //
416: public WebPageTagInstanceViewContextInfo createHtmlInfo() {
417: return createHtmlInfo(null, 0, null);
418: }
419:
420: public WebPageTagInstanceViewContextInfo createHtmlInfo(
421: String inDefaultConstraint) {
422: return createHtmlInfo(null, 0, inDefaultConstraint);
423: }
424:
425: public WebPageTagInstanceViewContextInfo createHtmlInfo(
426: ConceptTagCharacteristic inCtchar, int inIndex,
427: String inDefaultConstraint) {
428:
429: if (this .displayType == DISPLAY_TYPE__HTML) {
430: WebPageTagInstanceViewContextInfo outValue = createInfo(
431: inCtchar, inIndex, inDefaultConstraint);
432:
433: outValue.markAsHtml();
434:
435: return outValue;
436: } else {
437: throw new UnexpectedSystemException(
438: "Cannot call this function from iterative type");
439: }
440: }
441:
442: //
443: //
444: //
445: public WebPageTagInstanceViewContextInfo createNonHtmlInfo() {
446: return createNonHtmlInfo(null, 0, null);
447: }
448:
449: public WebPageTagInstanceViewContextInfo createNonHtmlInfo(
450: String inDefaultConstraint) {
451: //
452: return createNonHtmlInfo(null, 0, inDefaultConstraint);
453: }
454:
455: public WebPageTagInstanceViewContextInfo createNonHtmlInfo(
456: ConceptTagCharacteristic inCtchar, int inIndex,
457: String inDefaultConstraint) {
458:
459: if (this .displayType != DISPLAY_TYPE__ITERATIVE_NON_HTML) {
460: WebPageTagInstanceViewContextInfo outValue = createInfo(
461: inCtchar, inIndex, inDefaultConstraint);
462:
463: outValue.markAsNonHtml();
464:
465: return outValue;
466: } else {
467: throw new UnexpectedSystemException(
468: "Cannot call this function from iterative type");
469: }
470: }
471:
472: //
473: //
474: //
475: public WebPageTagInstanceViewContextInfo createIterativeNonHtmlInfo() {
476: return createIterativeNonHtmlInfo(null, 0, null);
477: }
478:
479: public WebPageTagInstanceViewContextInfo createIterativeNonHtmlInfo(
480: String inDefaultConstraint) {
481: return createIterativeNonHtmlInfo(null, 0, inDefaultConstraint);
482: }
483:
484: public WebPageTagInstanceViewContextInfo createIterativeNonHtmlInfo(
485: ConceptTagCharacteristic inCtchar, int inIndex,
486: String inDefaultConstraint) {
487:
488: if (this .displayType != DISPLAY_TYPE__ITERATIVE_NON_HTML) {
489: WebPageTagInstanceViewContextInfo outValue = createInfo(
490: inCtchar, inIndex, inDefaultConstraint);
491:
492: outValue.markAsIterativeNonHtml();
493:
494: return outValue;
495: } else {
496: throw new UnexpectedSystemException(
497: "Cannot call this function from iterative type");
498: }
499: }
500:
501: public void createIterativeSubParts(
502: WebPageTagInstanceViewContextInfo inStartInfo[],
503: WebPageTagInstanceViewContextInfo inMiddleInfo[],
504: WebPageTagInstanceViewContextInfo inEndInfo[]) {
505: //
506: createIterativeSubParts(inStartInfo, inMiddleInfo, inEndInfo,
507: null, 0);
508: }
509:
510: public void createIterativeSubParts(
511: WebPageTagInstanceViewContextInfo inStartInfo[],
512: WebPageTagInstanceViewContextInfo inMiddleInfo[],
513: WebPageTagInstanceViewContextInfo inEndInfo[],
514: ConceptTagCharacteristic inCtchar, int inIndex) {
515:
516: if (this .displayType == DISPLAY_TYPE__ITERATIVE_NON_HTML) {
517: //
518: inStartInfo[0] = createInfo(inCtchar, inIndex, null);
519: inMiddleInfo[0] = createInfo(inCtchar, inIndex, null);
520: inEndInfo[0] = createInfo(inCtchar, inIndex, null);
521: //
522: (inStartInfo[0]).markAsNonHtml();
523: (inMiddleInfo[0]).markAsNonHtml();
524: (inEndInfo[0]).markAsNonHtml();
525: //
526: (inMiddleInfo[0]).markAsIterativeMiddleContent();
527: } else {
528: throw new UnexpectedSystemException(
529: "Cannot call this function from other than iterative type");
530: }
531: }
532:
533: public void createIterativeSubParts(
534: WebPageTagInstanceViewContextInfo inStartInfo[],
535: WebPageTagInstanceViewContextInfo inMiddleInfo[],
536: WebPageTagInstanceViewContextInfo inEndInfo[],
537: String inCtconName) {
538:
539: if (this .displayType == DISPLAY_TYPE__ITERATIVE_NON_HTML) {
540: //
541: inStartInfo[0] = createInfo(null, 0, inCtconName);
542: inMiddleInfo[0] = createInfo(null, 0, inCtconName);
543: inEndInfo[0] = createInfo(null, 0, inCtconName);
544: //
545: (inStartInfo[0]).markAsNonHtml();
546: (inMiddleInfo[0]).markAsNonHtml();
547: (inEndInfo[0]).markAsNonHtml();
548: } else {
549: throw new UnexpectedSystemException(
550: "Cannot call this function from other than iterative type");
551: }
552: }
553:
554: private WebPageTagInstanceViewContextInfo createInfo(
555: ConceptTagCharacteristic inCtchar, int inIndex,
556: String inDefaultConstraint) {
557:
558: WebPageTagInstanceViewContextInfo outValue = null;
559:
560: //
561: if (inCtchar != null && inDefaultConstraint != null) {
562: //
563: throw new UnexpectedSystemException(
564: "Characteristic and default constraint cannot be defined "
565: + "simultaneously");
566: }
567: //
568: outValue = new WebPageTagInstanceViewContextInfo(this , false);
569: if (inDefaultConstraint != null) {
570: outValue.defaultConstraint = inDefaultConstraint;
571: }
572: addInfo(outValue);
573: //
574: if (inCtchar != null) {
575: outValue.idHandle = new Object[] { inCtchar,
576: new Integer(inIndex) };
577: outValue.validateIdHandle();
578: }
579:
580: return outValue;
581: }
582:
583: private void addInfo(WebPageTagInstanceViewContextInfo inWptivci) {
584: this .content.add(inWptivci);
585: }
586:
587: //
588: public boolean isMarkedAsHtml() {
589: return (this .displayType == DISPLAY_TYPE__HTML);
590: }
591:
592: public boolean isMarkedAsNonHtml() {
593: return (this .displayType == DISPLAY_TYPE__NON_HTML);
594: }
595:
596: public boolean isMarkedAsIterativeNonHtml() {
597: return (this .displayType == DISPLAY_TYPE__ITERATIVE_NON_HTML);
598: }
599:
600: //
601: protected void markAsHtml() {
602:
603: //
604: boolean errorFound = true;
605: //
606: WebPageTagInstanceViewContextInfo currentParentWptivci = this .parentWptivci;
607: //
608: while (true) {
609: //
610: if (currentParentWptivci == null) {
611: errorFound = false;
612: break;
613: } else if (currentParentWptivci.isMarkedAsNonHtml()
614: && !currentParentWptivci.isIterativeMiddleContent()) {
615: //
616: errorFound = true;
617: break;
618: } else if (currentParentWptivci.isMarkedAsNonHtml()
619: && currentParentWptivci.isIterativeMiddleContent()) {
620: //
621: //check parent
622: } else if (currentParentWptivci
623: .isMarkedAsIterativeNonHtml()) {
624: //
625: //check parent
626: } else if (currentParentWptivci.isMarkedAsHtml()) {
627: errorFound = false;
628: break;
629: } else {
630: throw UnexpectedSystemException.unknownState();
631: }
632: //
633: currentParentWptivci = currentParentWptivci.parentWptivci;
634: }
635: //
636: if (isParentMarkedAsNonHtml()
637: && !this .parentWptivci.isIterativeMiddleContent()) {
638: //
639: ////
640: //if (this.parentWptivci != null) {
641: //
642: //}
643: ////
644: }
645: //
646: if (errorFound) {
647: throw new UnexpectedSystemException(
648: "Cannot create html-info within non-html-info");
649: }
650: this .displayType = DISPLAY_TYPE__HTML;
651: this .setHtmlContent("", true);
652: }
653:
654: private boolean isParentMarkedAsNonHtml() {
655:
656: boolean outValue = false;
657:
658: if (this .parentWptivci != null) {
659: outValue |= this .parentWptivci.isMarkedAsNonHtml();
660: outValue |= this .parentWptivci.isParentMarkedAsNonHtml();
661: }
662:
663: return outValue;
664: }
665:
666: protected void markAsNonHtml() {
667: this .displayType = DISPLAY_TYPE__NON_HTML;
668: this .setNonHtmlContent("");
669: }
670:
671: protected void markAsIterativeNonHtml() {
672: //this.useIndentWithSubBlock = true;
673: this .displayType = DISPLAY_TYPE__ITERATIVE_NON_HTML;
674: }
675:
676: //protected void markAsNonHtmlButIndentAndCreateSubBlock() {
677: // this.useIndentWithSubBlock = true;
678: // this.displayType = DISPLAY_TYPE__NON_HTML;
679: //}
680: //
681: public void createSubNonHtmlInfo(
682: WebPageTagInstanceViewContext inWptivc,
683: ConceptTagCharacteristic inCtchar, String inPrefix) {
684: //
685: //if (inCtchar.getValueLength() > 0) {
686: WebPageTagInstanceViewContextInfo metaSubInfo = createNonHtmlInfo();
687: //
688: metaSubInfo.setNonHtmlContent(inPrefix);
689: //
690: WebPageTagInstanceViewContext.displayView(inCtchar,
691: metaSubInfo, inWptivc, "???");
692: //}
693: }
694:
695: //
696: //
697: //
698: //public final static String getMousePointerActions() {
699: // return (" onmouseout=\"this.style.cursor = 'auto'\""
700: // + " onmouseover=\"this.style.cursor = 'pointer'\" ");
701: //}
702: public final static void getMousePointerActions(HashMap inHm) {
703: inHm.put("onmouseout", "this.style.cursor = 'auto'");
704: inHm.put("onmouseover", "this.style.cursor = 'pointer'");
705: }
706:
707: //
708: //
709: //
710: private void validateIdHandle() {
711:
712: WebPageTagInstanceViewContextInfo ancestorWptivci = getAncestorWithId();
713:
714: if (ancestorWptivci != null) {
715: //
716: ConceptTagCharacteristic ancCtchar = ((ConceptTagCharacteristic) ancestorWptivci.idHandle[0]);
717: Integer ancIndex = ((Integer) ancestorWptivci.idHandle[1]);
718: ConceptTagCharacteristicHolder ancCtcharh = ancCtchar
719: .getValueAsHolder(ancIndex.intValue(), null);
720: //
721: ConceptTagPreferences localCtp = ancCtchar.getPreferences();
722: //
723: ConceptTagCharacteristic localCtchar = ((ConceptTagCharacteristic) this .idHandle[0]);
724: String localCtcharName = localCtchar.getConstraintName();
725: //
726: if (localCtcharName.equals(localCtp
727: .getUnconstrainedSymbol())) {
728: //
729: if (localCtchar == ancCtcharh
730: .getUndefinedCharacteristic()) {
731:
732: } else {
733: throw new UnexpectedSystemException(
734: "Missing or incorrect ID heirarchy");
735: }
736: } else if (ancCtcharh
737: .isCharacteristicPresent(localCtcharName)) {
738: if (localCtchar == ancCtcharh
739: .getCharacteristic(localCtcharName)) {
740:
741: } else {
742: throw new UnexpectedSystemException(
743: "Missing or incorrect ID heirarchy");
744: }
745: } else {
746: throw new UnexpectedSystemException("'"
747: + ancCtcharh.getHandle()
748: + "' does not contain constraint '"
749: + localCtcharName + "'");
750: }
751: }
752: }
753:
754: private WebPageTagInstanceViewContextInfo getAncestorWithId() {
755:
756: WebPageTagInstanceViewContextInfo outValue = this .parentWptivci;
757:
758: while (outValue != null && outValue.getIdHandle().length == 0) {
759: outValue = outValue.parentWptivci;
760: }
761:
762: return outValue;
763: }
764:
765: //
766: //
767: //
768: //
769: //
770: //
771: //
772: //
773: //
774: public void markPush() {
775: this .occurredPush = true;
776: ensureAllParentsHaveCalledPush();
777: }
778:
779: private void ensureAllParentsHaveCalledPush() {
780: if (!this .occurredPush) {
781: throw new UnexpectedSystemException("Push never called");
782: }
783: if (this .parentWptivci != null) {
784: this .parentWptivci.ensureAllParentsHaveCalledPush();
785: }
786: }
787:
788: public void markPop() {
789: this .occurredPop = true;
790: }
791:
792: //
793: //
794: //
795: //
796: //
797: //
798: //
799: //
800: //
801: //
802: //
803: public String getMouseOverBorder() {
804:
805: return getBorder(this .mouseOverBorderWidth,
806: this .mouseOverBorderStyle, this .mouseOverBorderColor);
807: }
808:
809: public String getMouseOutBorder() {
810:
811: return getBorder(this .mouseOutBorderWidth,
812: this .mouseOutBorderStyle, this .mouseOutBorderColor);
813: }
814:
815: public final static String getErrorBorder() {
816: return getBorder("2px", "dotted", "red");
817: }
818:
819: private final static String getBorder(String inWidth,
820: String inStyle, String inColor) {
821:
822: StringBuffer outValue = new StringBuffer();
823:
824: outValue.append(inWidth);
825: if (outValue.length() > 0) {
826: outValue.append(" ");
827: }
828: outValue.append(inStyle);
829: if (outValue.length() > 0) {
830: outValue.append(" ");
831: }
832: outValue.append(inColor);
833:
834: return outValue.toString();
835: }
836:
837: //
838: public void declareMouseOutBorderAsGreen() {
839: this .mouseOutBorderColor = "green";
840: }
841:
842: public void declareMouseOutBorderAsPurple() {
843: this .mouseOutBorderColor = "purple";
844: }
845:
846: public void declareMouseOutBorderAsBlack() {
847: this .mouseOutBorderColor = "black";
848: }
849:
850: public void declareMouseOutBorderAsBrown() {
851: this .mouseOutBorderColor = "brown";
852: }
853:
854: public void declareMouseOutBorderAsOlive() {
855: this .mouseOutBorderColor = "olive";
856: }
857:
858: public void declareMouseOutBorderAsThistle() {
859: this .mouseOutBorderColor = "thistle";
860: }
861:
862: public void declareMouseOutBorderAsGray() {
863: this .mouseOutBorderColor = "gray";
864: }
865:
866: //
867: public void declareMouseOutBorderAsOnePixel() {
868: this .mouseOutBorderWidth = "1px";
869: }
870:
871: public void declareMouseOutBorderAsTwoPixel() {
872: this .mouseOutBorderWidth = "2px";
873: }
874:
875: //
876: public void declareMouseOutBorderAsDashed() {
877: this .mouseOutBorderStyle = "dashed";
878: }
879:
880: public void declareMouseOutBorderAsSolid() {
881: this .mouseOutBorderStyle = "solid";
882: }
883:
884: public void declareMouseOutBorderAsDotted() {
885: this .mouseOutBorderStyle = "dotted";
886: }
887:
888: //public String getDefaultBorder() {
889: //
890: // StringBuffer outValue = new StringBuffer();
891: //
892: // return outValue.toString();
893: //}
894: //
895: //
896: //
897: public boolean isNotEmpty() {
898:
899: boolean outValue = false;
900:
901: if (this .notEmpty != null) {
902: //
903: outValue = this .notEmpty.booleanValue();
904: } else {
905: //
906: outValue |= (this .nonHtmlStartContent != null && this .nonHtmlStartContent
907: .length() > 0);
908: outValue |= (this .nonHtmlEndContent != null && this .nonHtmlEndContent
909: .length() > 0);
910: //
911: outValue |= (this .htmlWptivcshi != null && this .htmlWptivcshi
912: .isNotEmpty());
913: //
914: if (!outValue) {
915: outValue |= (this .subEarmark != null && this .subEarmark
916: .isNotEmpty());
917: }
918: //
919: for (int i = 0; !outValue && i < this .content.size(); i++) {
920: //
921: WebPageTagInstanceViewContextInfo nextWptivci = this
922: .getContentAsInfo(i);
923: //
924: outValue |= nextWptivci.isNotEmpty();
925: }
926: //
927: this .notEmpty = new Boolean(outValue);
928: }
929:
930: return outValue;
931: }
932: }
|