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 CmsPrefsScroller extends A_CmsWpElement { 55 56 57 58 private static final String C_WPTAG_ATTR_METHOD = "method"; 59 60 61 62 private static final String C_WPTAG_ATTR_TITLE = "title"; 63 64 65 66 private static final String C_TAG_PREFSSCROLLER_TITLE = "scrollertitle"; 67 68 69 70 private static final String C_TAG_PREFSSCROLLER_CONTENT = "scrollercontent"; 71 72 73 74 private static final String C_TAG_PREFSSCROLLER_COMPLETE = "scrollerwin"; 75 76 102 103 public Object handleSpecialWorkplaceTag(CmsObject cms, Element n, A_CmsXmlContent doc, 104 Object callingObject, Hashtable parameters, CmsXmlLanguageFile lang) throws CmsException { 105 String methodName = n.getAttribute(C_WPTAG_ATTR_METHOD); 106 String title = n.getAttribute(C_WPTAG_ATTR_TITLE); 107 108 CmsXmlWpTemplateFile prefsscrollerdef = getPrefsScrollerDefinitions(cms); 110 111 Method fillMethod = null; 113 String fillResult = null; 114 try { 115 fillMethod = callingObject.getClass().getMethod(methodName, new Class [] { 116 CmsObject.class, A_CmsXmlContent.class, CmsXmlLanguageFile.class, 117 Hashtable .class, Object .class 118 }); 119 fillResult = (String )fillMethod.invoke(callingObject, new Object [] { 120 cms, doc, lang, parameters, callingObject 121 }); 122 } 123 catch(NoSuchMethodException exc) { 124 125 throwException("Could not find prefs scroller fill method " + methodName 127 + " in calling class " + callingObject.getClass().getName() + " for generating select box content.", 128 CmsLegacyException.C_NOT_FOUND); 129 } 130 catch(InvocationTargetException targetEx) { 131 132 Throwable e = targetEx.getTargetException(); 135 if(!(e instanceof CmsException)) { 136 137 throwException("Prefs scroller fill method " + methodName + " in calling class " 138 + callingObject.getClass().getName() + " throwed an exception. " + e); 139 } 140 else { 141 142 throw (CmsException)e; 145 } 146 } 147 catch(Exception exc2) { 148 throwException("Prefs scroller fill method " + methodName + " in calling class " 149 + callingObject.getClass().getName() + " was found but could not be invoked. " 150 + exc2, CmsLegacyException.C_XML_NO_USER_METHOD); 151 } 152 prefsscrollerdef.setData(C_TAG_PREFSSCROLLER_TITLE, lang.getLanguageValue(CmsWorkplaceDefault.C_LANG_TITLE + "." + title)); 153 prefsscrollerdef.setData(C_TAG_PREFSSCROLLER_CONTENT, fillResult); 154 return prefsscrollerdef.getProcessedDataValue(C_TAG_PREFSSCROLLER_COMPLETE, callingObject, parameters); 155 } 156 } 157 | Popular Tags |