KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > webman > attr > TKWMTextAttrData


1 package com.teamkonzept.webman.attr;
2
3 import com.teamkonzept.lib.*;
4 import com.teamkonzept.lib.templates.*;
5 import com.teamkonzept.publishing.markups.*;
6 import com.teamkonzept.web.*;
7 import com.teamkonzept.webman.*;
8 import com.teamkonzept.web.templates.*;
9 import com.teamkonzept.field.*;
10
11 import java.util.*;
12 import org.apache.log4j.Category;
13 /**
14  * @author $Author: alex $
15  * @version $Revision: 1.8 $
16 */

17 public class TKWMTextAttrData
18 {
19     private static final Category CAT = Category.getInstance(TKWMTextAttrData.class);
20
21     public String JavaDoc fieldName;
22
23     public TKWMAttrText attrText;
24     public TKHashtable fieldLookup;
25     
26     public TKVector diags;
27     public TKVector dump;
28     
29     public TKWMTextAttrData (String JavaDoc fieldValue) {
30
31         this.fieldName = null;
32         this.fieldLookup = new TKHashtable();
33
34         this.attrText = new TKWMAttrText (fieldName,fieldValue);
35         
36         this.dump = null;
37         this.diags = null;
38     }
39
40     public TKWMTextAttrData (String JavaDoc fieldName, String JavaDoc fieldValue, TKHashtable data) {
41
42         this (fieldValue);
43         this.fieldName = fieldName;
44
45         de.webman.content.eventhandler.ContentContext.scanFields (fieldLookup,data);
46         this.attrText = new TKWMAttrText (fieldName,fieldValue,fieldLookup,data);
47
48         this.dump = this.attrText.dump();
49         this.diags = this.attrText.diagnostics();
50     }
51     
52     public void scanData () {
53
54         attrText.completeMarkups ();
55
56         this.dump = this.attrText.dump();
57         this.diags = this.attrText.diagnostics();
58     }
59
60     public String JavaDoc getDigest () {
61
62         return attrText.getDigest(false);
63     }
64
65
66     public String JavaDoc getExpansion () {
67
68         return attrText.getExpansion();
69     }
70
71     public String JavaDoc getXML()
72     {
73         return attrText.convert2Xml();
74     }
75     
76     public TKTemplateSyntax getSyntax (TKHTMLTemplate t) {
77
78         try {
79             String JavaDoc tmplString = attrText.convert2Tmpl();
80             return new TKHTMLTemplateSyntax (tmplString,t.syntax.getSource(),true);
81
82         } catch (Exception JavaDoc ex)
83         {
84             CAT.error
85                 ("Execption caught in TKTextAttrField/TKTextAttrData.getSyntax(): ",ex);
86         }
87         
88         return null;
89     }
90
91     public boolean hasDump () {
92
93         return (dump == null ? false : dump.size() > 0);
94     }
95
96     public boolean hasDiagnostics () {
97
98         return (diags == null ? false : diags.size() > 0);
99     }
100
101     public boolean hasMarkups () {
102     
103         Enumeration e = attrText.allMarkups();
104         while ((e != null) && (e.hasMoreElements())) {
105
106             TKMarkup undefMarkup = (TKMarkup) e.nextElement();
107             if ((undefMarkup == null) || !(undefMarkup instanceof TKWMAttrMarkup)) continue;
108
109             TKWMAttrMarkup markup = (TKWMAttrMarkup) undefMarkup;
110
111             if (markup.idPar != null) return true;
112         }
113     
114         return false;
115     }
116 }
117
Popular Tags