1 package com.teamkonzept.webman.attr; 2 3 import com.teamkonzept.lib.*; 4 import com.teamkonzept.publishing.markups.*; 5 6 public class TKWMAttrMarkupParamsIterator extends TKIteratorPlugin { 7 8 int param_index; 9 String fieldPath; 10 11 TKStringIteratorPlugin options; 12 13 public TKWMAttrMarkupParamsIterator (String listName, TKHashtable params, String fieldPath) { 14 15 super (params,listName,true); 16 this.fieldPath = fieldPath; 17 } 18 19 public void init () { 20 21 param_index = -1; 22 options = null; 23 } 24 25 public boolean applyThis (Object item, TKTemplate template, String path) { 26 27 if (!(item instanceof TKDefinedMarkupParam)) return false; 28 29 TKDefinedMarkupParam param = (TKDefinedMarkupParam) item; 30 31 param_index++; 32 33 if ((param.definition != null) && param.definition.param.isFlag()) options = null; 34 else if ((param.optionList != null) && (param.optionList.size() != 0)) 35 options = new TKStringIteratorPlugin ("VALUE_OPTIONS","VALUE_OPTION",param.optionList,true,""); 36 else options = null; 37 38 if (param.name != null) template.set( "PARAM_NAME", param.name); 39 40 if (param.value() != null) template.set( "PARAM_VALUE", param.value() ); 41 else template.set( "PARAM_VALUE", "" ); 42 43 if (param.defaulted) template.set( "PARAM_DEFAULTED", new Boolean (param.defaulted)); 44 45 if ((param.definition != null) && (param.definition.isOptional)) 46 template.set( "PARAM_OPTIONAL", new Boolean (param.definition.isOptional)); 47 48 if ((param.definition != null) && param.definition.param.isFlag()) 49 template.set( "INPUT_TYPE", "CHECK" ); 50 else if ((param.optionList != null) && (param.optionList.size() != 0)) 51 template.set( "INPUT_TYPE", "OPTION" ); 52 else template.set( "INPUT_TYPE", "TEXT" ); 53 54 template.set( "PARAM_TYPE", param.typeClass.name); 55 template.set( "NEW_PARAM_VALUE",fieldPath+".PARAMS."+param.name+".NEW_VALUE"); 56 template.set( "OLD_PARAM_VALUE",fieldPath+".PARAMS."+param.name+".OLD_VALUE"); 57 template.set( "PARAM_INDEX", new Integer (param_index)); 58 59 return true; 60 } 61 62 public boolean applyChilds (TKTemplate template, int i, String currListName, String path) { 63 64 return ((options != null) && options.apply (template,i,currListName,null)); 65 } 66 } 69 | Popular Tags |