Author: adrianc
Date: Tue Nov 25 17:58:58 2014
New Revision: 1641659

URL: http://svn.apache.org/r1641659
Log:
Some preliminary changes in preparation for the Bootstrap theme.

Modified:
    ofbiz/branches/boostrap_theme/framework/common/widget/CommonScreens.xml
    
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java
    
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
    
ofbiz/branches/boostrap_theme/framework/widget/templates/htmlMenuMacroLibrary.ftl

Modified: 
ofbiz/branches/boostrap_theme/framework/common/widget/CommonScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/framework/common/widget/CommonScreens.xml?rev=1641659&r1=1641658&r2=1641659&view=diff
==============================================================================
--- ofbiz/branches/boostrap_theme/framework/common/widget/CommonScreens.xml 
(original)
+++ ofbiz/branches/boostrap_theme/framework/common/widget/CommonScreens.xml Tue 
Nov 25 17:58:58 2014
@@ -191,6 +191,7 @@ under the License.
                         <set field="appbarTemplateLocation" 
from-field="layoutSettings.VT_NAV_TMPLT_LOC[0]" />
                         <set field="appbarOpenTemplateLocation" 
from-field="layoutSettings.VT_NAV_OPEN_TMPLT[0]" />
                         <set field="appbarCloseTemplateLocation" 
from-field="layoutSettings.VT_NAV_CLOSE_TMPLT[0]" />
+                        <set field="appheaderTemplate" 
from-field="layoutSettings.VT_NAV_APPHDR_LOC[0]"/>
                         <set field="messagesTemplateLocation" 
from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" />
                         <set field="layoutSettings.suppressTab" 
value="ofbizsetup"/><!-- diseable ofbiz setup by default -->
                     </actions>

Modified: 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java?rev=1641659&r1=1641658&r2=1641659&view=diff
==============================================================================
--- 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java
 (original)
+++ 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java
 Tue Nov 25 17:58:58 2014
@@ -269,6 +269,7 @@ public class MacroMenuRenderer implement
             StringBuilder sb = new StringBuilder("End Menu Widget ");
             sb.append(menu.getBoundaryCommentName());
             parameters.put("boundaryComment", sb.toString());
+            parameters.put("style", menu.getMenuContainerStyle(context));
         }
         try {
             executeMacro(writer, "renderMenuEnd", parameters);

Modified: 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java?rev=1641659&r1=1641658&r2=1641659&view=diff
==============================================================================
--- 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
 (original)
+++ 
ofbiz/branches/boostrap_theme/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
 Tue Nov 25 17:58:58 2014
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletReq
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.ofbiz.base.location.FlexibleLocation;
+import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
@@ -116,4 +117,32 @@ public class MenuFactory {
         }
         return modelMenu;
     }
+    
+    public static Map<String, ModelMenu> getMenusFromLocation(String 
resourceName)
+       throws IOException, SAXException, ParserConfigurationException {
+       Map<String, ModelMenu> modelMenuMap = 
menuLocationCache.get(resourceName);
+       if (modelMenuMap == null) {
+               synchronized (MenuFactory.class) {
+                       modelMenuMap = menuLocationCache.get(resourceName);
+                       if (modelMenuMap == null) {
+                               long startTime = System.currentTimeMillis();
+                               URL menuFileUrl = null;
+                               menuFileUrl = 
FlexibleLocation.resolveLocation(resourceName);
+                               if (menuFileUrl == null) {
+                                       throw new 
IllegalArgumentException("Could not resolve location to URL: " + resourceName);
+                               }
+                               Document menuFileDoc = 
UtilXml.readXmlDocument(menuFileUrl, true, true);
+                               modelMenuMap = readMenuDocument(menuFileDoc, 
resourceName);
+                               menuLocationCache.put(resourceName, 
modelMenuMap);
+                               double totalSeconds = 
(System.currentTimeMillis() - startTime)/1000.0;
+                               Debug.logInfo("Got " + modelMenuMap.size() + " 
screens in " + totalSeconds + "s from: " + menuFileUrl.toExternalForm(), 
module);
+                       }
+               }
+       }
+
+       if (modelMenuMap.isEmpty()) {
+               throw new IllegalArgumentException("Could not find menu file 
with name [" + resourceName + "]");
+       }
+       return modelMenuMap;
+    }
 }

Modified: 
ofbiz/branches/boostrap_theme/framework/widget/templates/htmlMenuMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/boostrap_theme/framework/widget/templates/htmlMenuMacroLibrary.ftl?rev=1641659&r1=1641658&r2=1641659&view=diff
==============================================================================
--- 
ofbiz/branches/boostrap_theme/framework/widget/templates/htmlMenuMacroLibrary.ftl
 (original)
+++ 
ofbiz/branches/boostrap_theme/framework/widget/templates/htmlMenuMacroLibrary.ftl
 Tue Nov 25 17:58:58 2014
@@ -31,7 +31,7 @@ under the License.
       <ul>
 </#macro>
 
-<#macro renderMenuEnd boundaryComment="">
+<#macro renderMenuEnd boundaryComment="" style="">
       </ul>
     </li>
   </ul>


Reply via email to