001: package com.teamkonzept.webman.attr;
002:
003: import com.teamkonzept.lib.*;
004: import com.teamkonzept.lib.templates.*;
005: import com.teamkonzept.publishing.markups.*;
006: import com.teamkonzept.web.*;
007: import com.teamkonzept.webman.*;
008: import com.teamkonzept.web.templates.*;
009: import com.teamkonzept.field.*;
010:
011: import java.util.*;
012: import org.apache.log4j.Category;
013:
014: /**
015: * @author $Author: alex $
016: * @version $Revision: 1.8 $
017: */
018: public class TKWMTextAttrData {
019: private static final Category CAT = Category
020: .getInstance(TKWMTextAttrData.class);
021:
022: public String fieldName;
023:
024: public TKWMAttrText attrText;
025: public TKHashtable fieldLookup;
026:
027: public TKVector diags;
028: public TKVector dump;
029:
030: public TKWMTextAttrData(String fieldValue) {
031:
032: this .fieldName = null;
033: this .fieldLookup = new TKHashtable();
034:
035: this .attrText = new TKWMAttrText(fieldName, fieldValue);
036:
037: this .dump = null;
038: this .diags = null;
039: }
040:
041: public TKWMTextAttrData(String fieldName, String fieldValue,
042: TKHashtable data) {
043:
044: this (fieldValue);
045: this .fieldName = fieldName;
046:
047: de.webman.content.eventhandler.ContentContext.scanFields(
048: fieldLookup, data);
049: this .attrText = new TKWMAttrText(fieldName, fieldValue,
050: fieldLookup, data);
051:
052: this .dump = this .attrText.dump();
053: this .diags = this .attrText.diagnostics();
054: }
055:
056: public void scanData() {
057:
058: attrText.completeMarkups();
059:
060: this .dump = this .attrText.dump();
061: this .diags = this .attrText.diagnostics();
062: }
063:
064: public String getDigest() {
065:
066: return attrText.getDigest(false);
067: }
068:
069: public String getExpansion() {
070:
071: return attrText.getExpansion();
072: }
073:
074: public String getXML() {
075: return attrText.convert2Xml();
076: }
077:
078: public TKTemplateSyntax getSyntax(TKHTMLTemplate t) {
079:
080: try {
081: String tmplString = attrText.convert2Tmpl();
082: return new TKHTMLTemplateSyntax(tmplString, t.syntax
083: .getSource(), true);
084:
085: } catch (Exception ex) {
086: CAT
087: .error(
088: "Execption caught in TKTextAttrField/TKTextAttrData.getSyntax(): ",
089: ex);
090: }
091:
092: return null;
093: }
094:
095: public boolean hasDump() {
096:
097: return (dump == null ? false : dump.size() > 0);
098: }
099:
100: public boolean hasDiagnostics() {
101:
102: return (diags == null ? false : diags.size() > 0);
103: }
104:
105: public boolean hasMarkups() {
106:
107: Enumeration e = attrText.allMarkups();
108: while ((e != null) && (e.hasMoreElements())) {
109:
110: TKMarkup undefMarkup = (TKMarkup) e.nextElement();
111: if ((undefMarkup == null)
112: || !(undefMarkup instanceof TKWMAttrMarkup))
113: continue;
114:
115: TKWMAttrMarkup markup = (TKWMAttrMarkup) undefMarkup;
116:
117: if (markup.idPar != null)
118: return true;
119: }
120:
121: return false;
122: }
123: }
|