1 package com.teamkonzept.webman.attr; 2 3 import com.teamkonzept.lib.*; 4 import com.teamkonzept.publishing.markups.*; 5 6 import java.util.*; 7 8 public class TKWMAttrFieldIterator extends TKIteratorPlugin { 9 10 private TKWMAttrMarkupIterator markups; 11 private TKWMAttrDumpIterator dump; 12 private TKStringIteratorPlugin diagnostics; 13 14 public TKWMAttrFieldIterator (String listName, TKVector fields) { 15 16 super (fields,listName,false); 17 } 18 19 public void init () { 20 21 markups = null; 22 dump = null; 23 diagnostics = null; 24 } 25 26 public boolean applyThis (Object item, TKTemplate template, String path) { 27 28 TKWMAttrText attrText = (TKWMAttrText) item; 29 30 markups = new TKWMAttrMarkupIterator ("CE_CA_MARKUPS",attrText.allMarkups(),attrText.fieldName); 31 dump = new TKWMAttrDumpIterator ("CE_CA_DUMP",attrText.dump()); 32 33 TKVector diags = attrText.diagnostics(); 34 diagnostics = new TKStringIteratorPlugin ("CE_CA_DIAGNOSTICS","DIAGNOSTIC",diags,false); 35 36 boolean hasDiagnostics = (diags == null ? false : diags.size() > 0); 37 if (hasDiagnostics) template.set( "HAS_DIAGNOSTICS", Boolean.TRUE ); 38 39 Enumeration e = attrText.allMarkups(); 40 while ((e != null) && (e.hasMoreElements())) { 41 42 TKMarkup undefMarkup = (TKMarkup) e.nextElement(); 43 if ((undefMarkup == null) || !(undefMarkup instanceof TKWMAttrMarkup)) continue; 44 45 TKWMAttrMarkup markup = (TKWMAttrMarkup) undefMarkup; 46 47 if (markup.idPar == null) continue; 48 49 template.set( "HAS_MARKUPS", Boolean.TRUE ); 50 break; 51 } 52 53 if (attrText.fieldName != null) 54 template.set( "FIELD_NAME", attrText.fieldName); 55 56 template.set( "FIELD_TEXT",attrText.getDigest(false)); 57 58 if (dump.hasDump()) 59 template.set( "HAS_DUMP", Boolean.TRUE ); 60 61 return true; 62 } 63 64 public boolean applyChilds (TKTemplate template, int i, String currListName, String path) { 65 66 return ((markups != null) && markups.apply (template,i,currListName,null)) || 67 ((dump != null) && dump.apply (template,i,currListName,null)) || 68 ((diagnostics != null) && diagnostics.apply (template,i,currListName,null)); 69 } 70 } 73 | Popular Tags |