KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.teamkonzept.webman.attr;
2
3 import com.teamkonzept.lib.*;
4 import com.teamkonzept.publishing.markups.*;
5
6 public class TKWMMarkupDefinitionIterator implements TKListIterator {
7
8     TKListIterator oldIterator;
9     TKTemplate template;
10     TKStringIteratorPlugin diagnostics;
11     TKStringIteratorPlugin hints;
12     TKWMMarkupDefinitionParamsIterator params;
13     TKWMAttrMarkupParamDefinitionsIterator paramDefinitions;
14
15     public TKWMMarkupDefinitionIterator (
16         TKTemplate template, TKMarkupDefinition definition,
17         TKVector diags, TKVector hints, TKListIterator oldIterator) {
18
19         this.oldIterator = oldIterator;
20         this.template = template;
21
22         this.diagnostics = new TKStringIteratorPlugin ("ME_DIAGNOSTICS","DIAGNOSTIC",diags,false);
23         this.hints = new TKStringIteratorPlugin ("ME_HINTS","HINT",hints,false);
24
25         boolean hasDiagnostics = (diags == null ? false : diags.size() > 0);
26         if (hasDiagnostics) template.set( "HAS_DIAGNOSTICS", Boolean.TRUE );
27             
28         boolean hasHints = (hints == null ? false : hints.size() > 0);
29         if (hasHints) template.set( "HAS_HINTS", Boolean.TRUE );
30             
31         paramDefinitions = new TKWMAttrMarkupParamDefinitionsIterator
32             (TKMarkupParamDefinition.allParams(),"PARAM_DEFINITIONS",true);
33             
34         if (definition == null) this.params = null;
35         else {
36             this.params = new TKWMMarkupDefinitionParamsIterator ("ME_PARAMS",definition);
37             
38             template.set( "MARKUP_NAME", definition.name);
39             template.set( "MARKUP_ID", new Integer JavaDoc(definition.id));
40
41             if ((definition.idPar != null) && (definition.idPar.name != null))
42                 template.set( "MARKUP_ID_PARAM", definition.idPar.name);
43             else template.set( "MARKUP_ID_PARAM", "NONE");
44
45             if (definition.info != null) template.set( "MARKUP_INFO", definition.info);
46             template.set( "MARKUP_ISATOM", new Boolean JavaDoc (definition.isAtom));
47         }
48     }
49
50     public boolean apply( TKTemplate template, int i, String JavaDoc currListName ) {
51
52         if ((diagnostics != null) && diagnostics.apply (template,currListName,null)) return true;
53         else if ((hints != null) && hints.apply (template,currListName,null)) return true;
54         else if ((params != null) && params.apply (template,currListName,null)) return true;
55         else if ((paramDefinitions != null) && paramDefinitions.apply (template,currListName,null)) return true;
56         else if (oldIterator != null) return oldIterator.apply (template,i,currListName);
57         else return false;
58     }
59     //{{DECLARE_CONTROLS
60
//}}
61
}
62
Popular Tags