svn commit: r1818472 [3/3] - /ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1818472 [3/3] - /ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/

mbrohl
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java?rev=1818472&r1=1818471&r2=1818472&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java Sun Dec 17 11:07:31 2017
@@ -162,7 +162,7 @@ public class ScreenFactory {
     }
 
     public static Map<String, ModelScreen> readScreenDocument(Document screenFileDoc, String sourceLocation) {
-        Map<String, ModelScreen> modelScreenMap = new HashMap<String, ModelScreen>();
+        Map<String, ModelScreen> modelScreenMap = new HashMap<>();
         if (screenFileDoc != null) {
             // read document and construct ModelScreen for each screen element
             Element rootElement = screenFileDoc.getDocumentElement();
@@ -172,14 +172,13 @@ public class ScreenFactory {
             List<? extends Element> screenElements = UtilXml.childElementList(rootElement, "screen");
             for (Element screenElement: screenElements) {
                 ModelScreen modelScreen = new ModelScreen(screenElement, modelScreenMap, sourceLocation);
-                //Debug.logInfo("Read Screen with name: " + modelScreen.getName(), module);
                 modelScreenMap.put(modelScreen.getName(), modelScreen);
             }
         }
         return modelScreenMap;
     }
 
-    public static void renderReferencedScreen(String name, String location, ModelScreenWidget parentWidget, Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException {
+    public static void renderReferencedScreen(String name, String location, ModelScreenWidget parentWidget, Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException {
         // check to see if the name is a composite name separated by a #, if so split it up and get it by the full loc#name
         if (ScreenFactory.isCombinedName(name)) {
             String combinedName = name;
@@ -191,15 +190,7 @@ public class ScreenFactory {
         if (UtilValidate.isNotEmpty(location)) {
             try {
                 modelScreen = ScreenFactory.getScreenFromLocation(location, name);
-            } catch (IOException e) {
-                String errMsg = "Error rendering included screen named [" + name + "] at location [" + location + "]: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new RuntimeException(errMsg);
-            } catch (SAXException e) {
-                String errMsg = "Error rendering included screen named [" + name + "] at location [" + location + "]: " + e.toString();
-                Debug.logError(e, errMsg, module);
-                throw new RuntimeException(errMsg);
-            } catch (ParserConfigurationException e) {
+            } catch (IOException | SAXException | ParserConfigurationException e) {
                 String errMsg = "Error rendering included screen named [" + name + "] at location [" + location + "]: " + e.toString();
                 Debug.logError(e, errMsg, module);
                 throw new RuntimeException(errMsg);
@@ -210,7 +201,6 @@ public class ScreenFactory {
                 throw new IllegalArgumentException("Could not find screen with name [" + name + "] in the same file as the screen with name [" + parentWidget.getModelScreen().getName() + "]");
             }
         }
-        //Debug.logInfo("parent(" + parentWidget + ") rendering(" + modelScreen + ")", module);
         modelScreen.renderScreenString(writer, context, screenStringRenderer);
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java?rev=1818472&r1=1818471&r2=1818472&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ThemeFactory.java Sun Dec 17 11:07:31 2017
@@ -81,7 +81,9 @@ public class ThemeFactory {
         try {
             List<File> xmlThemes = FileUtil.findXmlFiles(ofbizHome, "themes", "theme", "widget-theme.xsd");
             List<File> xmlPluginThemes = FileUtil.findXmlFiles(ofbizHome, "plugins", "theme", "widget-theme.xsd");
-            if (UtilValidate.isNotEmpty(xmlPluginThemes)) xmlThemes.addAll(xmlPluginThemes);
+            if (UtilValidate.isNotEmpty(xmlPluginThemes)) {
+                xmlThemes.addAll(xmlPluginThemes);
+            }
             for (File xmlTheme : xmlThemes) {
                 ModelTheme modelTheme = getModelThemeFromLocation(xmlTheme.toURI().toURL().toString());
                 if (modelTheme != null) {
@@ -102,7 +104,9 @@ public class ThemeFactory {
      * @return
      */
     public static VisualTheme getVisualThemeFromId(String visualThemeId) {
-        if (visualThemeId == null) return null;
+        if (visualThemeId == null) {
+            return null;
+        }
         VisualTheme visualTheme = themeVisualThemeIdCache.get(visualThemeId);
         if (visualTheme == null) {
             synchronized (ThemeFactory.class) {
@@ -174,7 +178,7 @@ public class ThemeFactory {
         for (String visualThemeId : visualThemeIds) {
             visualThemesMap.put(visualThemeId, themeVisualThemeIdCache.get(visualThemeId));
         }
-        return new ArrayList(visualThemesMap.values());
+        return new ArrayList<>(visualThemesMap.values());
     }
 
     /**
@@ -197,7 +201,9 @@ public class ThemeFactory {
             //search on request only if a userLogin is present on session (otherwise this implied that the user isn't identify so wait
             if (userLogin != null) {
                 VisualTheme visualTheme = (VisualTheme) session.getAttribute("visualTheme");
-                if (visualTheme != null) return visualTheme;
+                if (visualTheme != null) {
+                    return visualTheme;
+                }
 
                 //resolve on user pref
                 LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");

Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/TreeFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/TreeFactory.java?rev=1818472&r1=1818471&r2=1818472&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/TreeFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/TreeFactory.java Sun Dec 17 11:07:31 2017
@@ -62,7 +62,7 @@ public class TreeFactory {
     }
 
     public static Map<String, ModelTree> readTreeDocument(Document treeFileDoc, Delegator delegator, LocalDispatcher dispatcher, String treeLocation) {
-        Map<String, ModelTree> modelTreeMap = new HashMap<String, ModelTree>();
+        Map<String, ModelTree> modelTreeMap = new HashMap<>();
         if (treeFileDoc != null) {
             // read document and construct ModelTree for each tree element
             Element rootElement = treeFileDoc.getDocumentElement();