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 TKWMAttrMarkupParamDefinitionsIterator extends TKIteratorPlugin { 9 10 TKWMMarkupParamDefinitionOptionsIterator options; 11 TKStringIteratorPlugin defaultOptions; 12 13 boolean sub; 14 15 public TKWMAttrMarkupParamDefinitionsIterator (Enumeration options, String listName, boolean sub) { 16 17 super (options,listName,true,TKMarkupParamDefinition.makeDummy("")); 18 19 this.options = null; 20 this.defaultOptions = null; 21 this.sub = sub; 22 } 23 24 public boolean applyThis (Object item, TKTemplate template, String path) { 25 26 TKMarkupParamDefinition param = (TKMarkupParamDefinition) item; 27 if (param == null) return true; 28 29 template.set( "DEFINITION_OPTION", param.name); 30 31 template.set( "PARAM_TYPE", param.typeClass.name); 32 template.set( "PARAM_IS_CASE_SENSITIVE", new Boolean (param.isCaseSensitive)); 33 34 if (param.defaultValue() != null) template.set( "DEFAULT_VALUE", param.defaultValue()); 35 else template.set( "DEFAULT_VALUE", ""); 36 37 if (!sub) return true; 38 39 if (param.isFlag()) this.options = null; 40 else this.options = new TKWMMarkupParamDefinitionOptionsIterator 41 ("VALUE_OPTION_LIST",param.optionList); 42 43 if (param.isFlag()) template.set( "DEFAULT_TYPE", "CHECK" ); 44 else if ((param.optionList != null) && (param.optionList.size() != 0)) 45 template.set ("DEFAULT_TYPE", "OPTION" ); 46 else template.set( "DEFAULT_TYPE", "TEXT" ); 47 48 if (param.isFlag()) this.defaultOptions = null; 49 else if ((param.optionList != null) && (param.optionList.size() != 0)) 50 defaultOptions = new TKStringIteratorPlugin ("VALUE_OPTIONS","VALUE_OPTION",param.optionList,true,""); 51 else defaultOptions = null; 52 53 return true; 54 } 55 56 public boolean applyChilds (TKTemplate template, int i, String currListName, String path) { 57 58 if ((options != null) && options.apply (template,i,currListName,null)) return true; 59 else if ((defaultOptions != null) && defaultOptions.apply (template,i,currListName,null)) return true; 60 else return false; 61 } 62 63 } 66 | Popular Tags |