1 16 17 package org.apache.jetspeed.modules.parameters; 18 19 import org.apache.turbine.modules.Assembler; 21 import org.apache.turbine.util.RunData; 22 23 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 25 import org.apache.jetspeed.services.logging.JetspeedLogger; 26 27 import java.util.Map ; 29 import java.util.Hashtable ; 30 import java.util.Iterator ; 31 32 38 public abstract class ParameterPresentationStyle extends Assembler 39 { 40 41 44 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(ParameterPresentationStyle.class.getName()); 45 46 private Map styleparms = null; 47 48 57 public abstract String getContent(RunData data, String name, String value, Map parms); 58 59 64 public void setParms(Map parms) 65 { 66 67 this.styleparms = parms; 68 } 69 70 77 public Object getParm(String key, Object def) 78 { 79 80 Object result = null; 81 82 if ( this.styleparms != null ) 83 { 84 result = this.styleparms.get(key); 85 } 86 87 if ( result == null ) 88 { 89 result = def; 90 } 91 92 return result; 93 } 94 95 101 public Map getJavascriptEvents() 102 { 103 104 Hashtable result = null; 105 106 if (this.styleparms != null) 107 { 108 Iterator it = this.styleparms.keySet().iterator(); 109 while (it.hasNext()) 110 { 111 String parmkey = (String ) it.next(); 112 if (parmkey.startsWith("javascript:")) 113 { 114 try 115 { 116 if (result == null) 117 { 118 result = new Hashtable (); 119 } 120 String event = parmkey.substring(parmkey.lastIndexOf(":") + 1); 121 result.put(event, this.styleparms.get(parmkey)); 122 } 123 catch (Exception e) 124 { 125 logger.error("Exception", e); 126 } 127 } 128 } 129 } 130 131 return result; 132 } 133 134 } | Popular Tags |