1 28 29 30 package com.opencms.workplace; 31 32 import org.opencms.file.CmsObject; 33 import org.opencms.main.CmsException; 34 35 import com.opencms.legacy.CmsLegacyException; 36 import com.opencms.template.A_CmsXmlContent; 37 38 import java.lang.reflect.InvocationTargetException ; 39 import java.lang.reflect.Method ; 40 import java.util.Hashtable ; 41 42 import org.w3c.dom.Element ; 43 44 53 54 public class CmsInput extends A_CmsWpElement { 55 56 74 75 public Object handleSpecialWorkplaceTag(CmsObject cms, Element n, A_CmsXmlContent doc, 76 Object callingObject, Hashtable parameters, CmsXmlLanguageFile lang) throws CmsException { 77 String styleClass = n.getAttribute(CmsWorkplaceDefault.C_INPUT_CLASS); 78 String name = n.getAttribute(CmsWorkplaceDefault.C_INPUT_NAME); 79 String size = n.getAttribute(CmsWorkplaceDefault.C_INPUT_SIZE); 80 String length = n.getAttribute(CmsWorkplaceDefault.C_INPUT_LENGTH); 81 String value = n.getAttribute(CmsWorkplaceDefault.C_INPUT_VALUE); 82 String method = n.getAttribute(CmsWorkplaceDefault.C_INPUT_METHOD); 83 String action = n.getAttribute(CmsWorkplaceDefault.C_INPUT_ACTION); 84 if((method != null) && (method.length() != 0)) { 85 86 Method valueMethod = null; 88 try { 89 valueMethod = callingObject.getClass().getMethod(method, new Class [] { 90 CmsObject.class, CmsXmlLanguageFile.class, Hashtable .class 91 }); 92 value = (String )valueMethod.invoke(callingObject, new Object [] { 93 cms, lang, parameters 94 }); 95 } 96 catch(NoSuchMethodException exc) { 97 98 throwException("Could not find method " + method + " in calling class " 100 + callingObject.getClass().getName() 101 + " for generating input value content.", CmsLegacyException.C_NOT_FOUND); 102 } 103 catch(InvocationTargetException targetEx) { 104 105 Throwable e = targetEx.getTargetException(); 108 if(!(e instanceof CmsException)) { 109 110 throwException("User method " + method + " in calling class " 111 + callingObject.getClass().getName() + " throwed an exception. " 112 + e); 113 } 114 else { 115 116 throw (CmsException)e; 119 } 120 } 121 catch(Exception exc2) { 122 throwException("User method " + method + " in calling class " 123 + callingObject.getClass().getName() 124 + " was found but could not be invoked. " 125 + exc2, CmsLegacyException.C_XML_NO_USER_METHOD); 126 } 127 } 128 if(value == null) { 129 value = ""; 130 } 131 CmsXmlWpInputDefFile inputdef = getInputDefinitions(cms); 132 String result = inputdef.getInput(styleClass, name, size, length, value, action); 133 return result; 134 } 135 } 136
| Popular Tags
|