1 18 package org.apache.beehive.netui.tags; 19 20 import org.apache.beehive.netui.tags.tree.InheritableState; 21 import org.apache.beehive.netui.util.config.ConfigUtil; 22 import org.apache.beehive.netui.util.config.bean.JspTagConfig; 23 24 25 31 final public class TagConfig 32 { 33 private static int javascriptMode = -1; 36 37 private static String defaultTreeImageLocation = null; 38 39 40 44 public static boolean isLegacyJavaScript() 45 { 46 if (javascriptMode == -1) { 47 setLegacyJavaScriptMode(); 48 } 49 assert(javascriptMode != -1); 50 return (javascriptMode == JspTagConfig.IdJavascript.INT_LEGACY 51 || javascriptMode == JspTagConfig.IdJavascript.INT_LEGACY_ONLY); 52 } 53 54 58 public static boolean isDefaultJavaScript() 59 { 60 if (javascriptMode == -1) { 61 setLegacyJavaScriptMode(); 62 } 63 assert(javascriptMode != -1); 64 return (javascriptMode == JspTagConfig.IdJavascript.INT_DEFAULT 65 || javascriptMode == JspTagConfig.IdJavascript.INT_LEGACY); 66 } 67 68 77 public static String getTreeImageLocation() 78 { 79 if (defaultTreeImageLocation == null) { 80 JspTagConfig tagConfig = ConfigUtil.getConfig().getJspTagConfig(); 81 if (tagConfig != null) { 82 String s = tagConfig.getTreeImageLocation(); 83 defaultTreeImageLocation = (s != null) ? s : InheritableState.DEFAULT_IMAGES; 84 } 85 else 86 defaultTreeImageLocation = InheritableState.DEFAULT_IMAGES; 87 } 88 assert(defaultTreeImageLocation != null); 89 return defaultTreeImageLocation; 90 } 91 92 95 private static void setLegacyJavaScriptMode() 96 { 97 JspTagConfig tagConfig = ConfigUtil.getConfig().getJspTagConfig(); 98 if (tagConfig != null) { 99 javascriptMode = tagConfig.getIdJavascript().intValue(); 100 } 101 else { 102 javascriptMode = JspTagConfig.IdJavascript.INT_DEFAULT; 103 } 104 } 105 } 106 | Popular Tags |