1 5 package com.teamkonzept.publishing.markups; 6 7 import com.teamkonzept.lib.*; 8 9 public class TKDefinedMarkupParam extends TKMarkupParam { 10 11 public boolean defaulted; 12 public TKMarkupParamClass typeClass; 13 public TKVector optionList; 14 15 public TKMarkupParamCall definition; 16 17 public TKDefinedMarkupParam (String name, String value, TKMarkupParamCall definition) { 18 19 super (name,value); 20 21 this.definition = definition; 22 this.defaulted = false; 23 this.typeClass = definition.param.typeClass; 24 this.optionList = null; 25 } 26 27 public TKDefinedMarkupParam (TKMarkupParamCall definition) { 28 29 super (definition.name,null); 30 31 this.definition = definition; 32 this.defaulted = false; 33 this.typeClass = definition.param.typeClass; 34 this.optionList = null; 35 } 36 37 public TKDefinedMarkupParam (TKMarkupParam param, TKMarkupParamCall definition) { 38 39 super (param); 40 41 this.definition = definition; 42 this.defaulted = false; 43 this.typeClass = definition.param.typeClass; 44 this.optionList = null; 45 } 46 47 public void complete () throws Exception { 48 49 if (!definition.useDefault || (value() != null)); 50 else if (definition.defaultValue() != null) 51 setValue (definition.defaultValue()); 52 else if (definition.param.defaultValue() != null) 53 setValue (definition.param.defaultValue()); 54 55 if (!definition.param.isCaseSensitive && (value() != null)) 56 setValue (value().toUpperCase()); 57 58 if (!definition.useDefault || (value() == null)) defaulted = false; 59 else if (definition.defaultValue() != null) 60 defaulted = value().equals(definition.defaultValue()); 61 else if (definition.param.defaultValue() != null) 62 defaulted = value().equals(definition.param.defaultValue()); 63 else defaulted = false; 64 65 typeClass = definition.param.typeClass; 66 optionList = definition.param.optionList; 67 68 setValue(definition.param.checkValue(value(),definition.editable)); 69 70 if ((value() == null) && !definition.isOptional) 71 throw new Exception ("Parameter "+name+": Wert ("+typeClass.name+") fehlt"); 72 } 73 74 public String wrapValue () { 75 76 if (value() == null) return null; 77 else if (definition != null) return definition.param.typeClass.wrapValue(value()); 78 else return super.wrapValue(); 79 } 80 } 83 84 | Popular Tags |