svn commit: r1044245 [4/6] - in /ofbiz/branches/jquery: ./ applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/ applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/ applications/accounting/webapp/accounting/fin...

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

svn commit: r1044245 [4/6] - in /ofbiz/branches/jquery: ./ applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/ applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/ applications/accounting/webapp/accounting/fin...

jleroux@apache.org
Modified: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java (original)
+++ ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Fri Dec 10 09:14:36 2010
@@ -1,177 +1,177 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.widget;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.security.authz.Authorization;
-
-/**
- * PortalPageWorker Class
- */
-public class PortalPageWorker {
-
-    public static final String module = PortalPageWorker.class.getName();
-
-    public PortalPageWorker() { }
-
-    public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext,
-            boolean cache) throws GeneralException, IOException {
-        return "success";
-    }
-
-    /**
-    * Returns a list of PortalPages that have the specified parentPortalPageId as parent.
-    * If a specific PortalPage exists for the current userLogin it is returned instead of the original one.
-    */
-    public static List<GenericValue> getPortalPages(String parentPortalPageId, Map<String, Object> context) {
-        List<GenericValue> portalPages = null;
-        if (UtilValidate.isNotEmpty(parentPortalPageId)) {
-            Delegator delegator = WidgetWorker.getDelegator(context);
-            try {
-                // first get public pages
-                EntityCondition cond =
-                    EntityCondition.makeCondition(UtilMisc.toList(
-                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
-                        EntityCondition.makeCondition(UtilMisc.toList(
-                                EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parentPortalPageId),
-                                EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
-                                EntityOperator.OR)),
-                        EntityOperator.AND);
-                portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
-                if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
-                    String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
-                    // replace with private pages
-                    for (GenericValue portalPage : portalPages) {
-                        cond = EntityCondition.makeCondition(UtilMisc.toList(
-                                EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
-                                EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
-                                EntityOperator.AND);
-                        List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
-                        if (UtilValidate.isNotEmpty(privatePortalPages)) {
-                            portalPages.remove(portalPage);
-                            portalPages.add(privatePortalPages.get(0));
-                        }
-                    }
-                    // add any other created private pages
-                    cond = EntityCondition.makeCondition(UtilMisc.toList(
-                            EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
-                            EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
-                            EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
-                            EntityOperator.AND);
-                    portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
-                }
-                portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
-            } catch (GenericEntityException e) {
-                Debug.logError("Could not retrieve portalpages:" + e.getMessage(), module);
-            }
-        }
-        return portalPages;
-    }
-
-    /**
-    * Returns the PortalPage with the specified portalPageId.
-    * If a specific PortalPage exists for the current userLogin it is returned instead of the original one.
-    */
-    public static GenericValue getPortalPage(String portalPageId, Map<String, Object> context) {
-        GenericValue portalPage = null;
-        if (UtilValidate.isNotEmpty(portalPageId)) {
-            Delegator delegator = WidgetWorker.getDelegator(context);
-            try {
-                // Get the current userLoginId
-                String userLoginId = "_NA_";
-                if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
-                    userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
-                }
-                
-                // Get the PortalPage ensuring that it is either owned by the user or a system page
-                EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
-                    EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, portalPageId),
-                    EntityCondition.makeCondition(UtilMisc.toList(
-                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
-                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)),
-                        EntityOperator.OR)),
-                    EntityOperator.AND);
-                List <GenericValue> portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
-                if (UtilValidate.isNotEmpty(portalPages)) {
-                    portalPage = EntityUtil.getFirst(portalPages);
-                }
-                
-                // If a derived PortalPage private to the user exists, returns this instead of the system one
-                cond = EntityCondition.makeCondition(UtilMisc.toList(
-                        EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPageId),
-                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)),
-                        EntityOperator.AND);
-                List <GenericValue> privateDerivedPortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
-                if (UtilValidate.isNotEmpty(privateDerivedPortalPages)) {
-                    portalPage = EntityUtil.getFirst(privateDerivedPortalPages);
-                }
-            } catch (GenericEntityException e) {
-                Debug.logError("Could not retrieve portalpage:" + e.getMessage(), module);
-            }
-        }
-        return portalPage;
-    }
-
-    /**
-    * Checks if the user is allowed to configure the PortalPage.
-    * PortalPage configuration is allowed if he is the PortalPage owner or he has got the PORTALPAGE_ADMIN permission
-    */  
-    public static Boolean userIsAllowedToConfigure(String portalPageId, Map<String, Object> context) {
-        Boolean userIsAllowed = false;
-
-        if (UtilValidate.isNotEmpty(portalPageId)) {
-            GenericValue userLogin = (GenericValue) context.get("userLogin");
-            if (UtilValidate.isNotEmpty(userLogin)) {
-                String userLoginId = (String) userLogin.get("userLoginId");
-                Authorization authz = (Authorization) context.get("authz");
-
-                Boolean hasPortalAdminPermission = authz.hasPermission(userLoginId, "PORTALPAGE_ADMIN", context);
-                try {
-                    Delegator delegator = WidgetWorker.getDelegator(context);
-                    GenericValue portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", portalPageId),false);
-
-                    if (UtilValidate.isNotEmpty(portalPage)) {
-                        String ownerUserLoginId = (String) portalPage.get("ownerUserLoginId");
-                        // Users with PORTALPAGE_ADMIN permission can configure every Portal Page
-                        userIsAllowed = (ownerUserLoginId.equals(userLoginId) || hasPortalAdminPermission);
-                    }
-                } catch (GenericEntityException e) {
-                    return false;
-                }
-            }
-        }
-
-        return userIsAllowed;      
-    }
-    
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.widget;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.security.authz.Authorization;
+
+/**
+ * PortalPageWorker Class
+ */
+public class PortalPageWorker {
+
+    public static final String module = PortalPageWorker.class.getName();
+
+    public PortalPageWorker() { }
+
+    public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext,
+            boolean cache) throws GeneralException, IOException {
+        return "success";
+    }
+
+    /**
+    * Returns a list of PortalPages that have the specified parentPortalPageId as parent.
+    * If a specific PortalPage exists for the current userLogin it is returned instead of the original one.
+    */
+    public static List<GenericValue> getPortalPages(String parentPortalPageId, Map<String, Object> context) {
+        List<GenericValue> portalPages = null;
+        if (UtilValidate.isNotEmpty(parentPortalPageId)) {
+            Delegator delegator = WidgetWorker.getDelegator(context);
+            try {
+                // first get public pages
+                EntityCondition cond =
+                    EntityCondition.makeCondition(UtilMisc.toList(
+                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
+                        EntityCondition.makeCondition(UtilMisc.toList(
+                                EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parentPortalPageId),
+                                EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
+                                EntityOperator.OR)),
+                        EntityOperator.AND);
+                portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
+                    String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
+                    // replace with private pages
+                    for (GenericValue portalPage : portalPages) {
+                        cond = EntityCondition.makeCondition(UtilMisc.toList(
+                                EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+                                EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
+                                EntityOperator.AND);
+                        List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                        if (UtilValidate.isNotEmpty(privatePortalPages)) {
+                            portalPages.remove(portalPage);
+                            portalPages.add(privatePortalPages.get(0));
+                        }
+                    }
+                    // add any other created private pages
+                    cond = EntityCondition.makeCondition(UtilMisc.toList(
+                            EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+                            EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
+                            EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
+                            EntityOperator.AND);
+                    portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
+                }
+                portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
+            } catch (GenericEntityException e) {
+                Debug.logError("Could not retrieve portalpages:" + e.getMessage(), module);
+            }
+        }
+        return portalPages;
+    }
+
+    /**
+    * Returns the PortalPage with the specified portalPageId.
+    * If a specific PortalPage exists for the current userLogin it is returned instead of the original one.
+    */
+    public static GenericValue getPortalPage(String portalPageId, Map<String, Object> context) {
+        GenericValue portalPage = null;
+        if (UtilValidate.isNotEmpty(portalPageId)) {
+            Delegator delegator = WidgetWorker.getDelegator(context);
+            try {
+                // Get the current userLoginId
+                String userLoginId = "_NA_";
+                if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
+                    userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
+                }
+                
+                // Get the PortalPage ensuring that it is either owned by the user or a system page
+                EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
+                    EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, portalPageId),
+                    EntityCondition.makeCondition(UtilMisc.toList(
+                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
+                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)),
+                        EntityOperator.OR)),
+                    EntityOperator.AND);
+                List <GenericValue> portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                if (UtilValidate.isNotEmpty(portalPages)) {
+                    portalPage = EntityUtil.getFirst(portalPages);
+                }
+                
+                // If a derived PortalPage private to the user exists, returns this instead of the system one
+                cond = EntityCondition.makeCondition(UtilMisc.toList(
+                        EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPageId),
+                        EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)),
+                        EntityOperator.AND);
+                List <GenericValue> privateDerivedPortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                if (UtilValidate.isNotEmpty(privateDerivedPortalPages)) {
+                    portalPage = EntityUtil.getFirst(privateDerivedPortalPages);
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError("Could not retrieve portalpage:" + e.getMessage(), module);
+            }
+        }
+        return portalPage;
+    }
+
+    /**
+    * Checks if the user is allowed to configure the PortalPage.
+    * PortalPage configuration is allowed if he is the PortalPage owner or he has got the PORTALPAGE_ADMIN permission
+    */  
+    public static Boolean userIsAllowedToConfigure(String portalPageId, Map<String, Object> context) {
+        Boolean userIsAllowed = false;
+
+        if (UtilValidate.isNotEmpty(portalPageId)) {
+            GenericValue userLogin = (GenericValue) context.get("userLogin");
+            if (UtilValidate.isNotEmpty(userLogin)) {
+                String userLoginId = (String) userLogin.get("userLoginId");
+                Authorization authz = (Authorization) context.get("authz");
+
+                Boolean hasPortalAdminPermission = authz.hasPermission(userLoginId, "PORTALPAGE_ADMIN", context);
+                try {
+                    Delegator delegator = WidgetWorker.getDelegator(context);
+                    GenericValue portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", portalPageId),false);
+
+                    if (UtilValidate.isNotEmpty(portalPage)) {
+                        String ownerUserLoginId = (String) portalPage.get("ownerUserLoginId");
+                        // Users with PORTALPAGE_ADMIN permission can configure every Portal Page
+                        userIsAllowed = (ownerUserLoginId.equals(userLoginId) || hasPortalAdminPermission);
+                    }
+                } catch (GenericEntityException e) {
+                    return false;
+                }
+            }
+        }
+
+        return userIsAllowed;      
+    }
+    
+}

Propchange: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java (original)
+++ ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java Fri Dec 10 09:14:36 2010
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.widget;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.entity.Delegator;
-
-/**
- * PortalPageWorkerInterface
- */
-public interface PortalPageWorkerInterface {
-    public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext,
-            boolean cache) throws GeneralException, IOException;
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.widget;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.entity.Delegator;
+
+/**
+ * PortalPageWorkerInterface
+ */
+public interface PortalPageWorkerInterface {
+    public String renderPortalPageAsTextExt(Delegator delegator, String portalPageId, Map<String, Object> templateContext,
+            boolean cache) throws GeneralException, IOException;
+}

Propchange: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/PortalPageWorkerInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java (original)
+++ ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java Fri Dec 10 09:14:36 2010
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.widget;
-import org.ofbiz.base.util.Debug;
-
-/**
- * PortalPageWorker Class
- */
-public class WidgetPortalPageWorker {
-    public static final String module = WidgetPortalPageWorker.class.getName();
-    public static PortalPageWorkerInterface portalPageWorker = null;
-    static {
-        try {
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            // note: loadClass is necessary for these since this class doesn't know anything about them at compile time
-            portalPageWorker = (PortalPageWorkerInterface) loader.loadClass("org.ofbiz.widget.PortalPageWorker").newInstance();
-        } catch (ClassNotFoundException e) {
-            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
-        } catch (IllegalAccessException e) {
-            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
-        } catch (InstantiationException e) {
-            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
-        }
-    }
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.widget;
+import org.ofbiz.base.util.Debug;
+
+/**
+ * PortalPageWorker Class
+ */
+public class WidgetPortalPageWorker {
+    public static final String module = WidgetPortalPageWorker.class.getName();
+    public static PortalPageWorkerInterface portalPageWorker = null;
+    static {
+        try {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            // note: loadClass is necessary for these since this class doesn't know anything about them at compile time
+            portalPageWorker = (PortalPageWorkerInterface) loader.loadClass("org.ofbiz.widget.PortalPageWorker").newInstance();
+        } catch (ClassNotFoundException e) {
+            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
+        } catch (IllegalAccessException e) {
+            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
+        } catch (InstantiationException e) {
+            Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module);
+        }
+    }
+}

Propchange: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/WidgetPortalPageWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java (original)
+++ ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java Fri Dec 10 09:14:36 2010
@@ -73,13 +73,13 @@ public class MenuWrapTransform implement
     @SuppressWarnings("unchecked")
     public Writer getWriter(final Writer out, Map args) {
         final Environment env = Environment.getCurrentEnvironment();
-        final Delegator delegator = (Delegator) FreeMarkerWorker.getWrappedObject("delegator", env);
-        final HttpServletRequest request = (HttpServletRequest) FreeMarkerWorker.getWrappedObject("request", env);
-        final HttpServletResponse response = (HttpServletResponse) FreeMarkerWorker.getWrappedObject("response", env);
-        final HttpSession session = (HttpSession) FreeMarkerWorker.getWrappedObject("session", env);
+        final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
+        final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
+        final HttpServletResponse response = FreeMarkerWorker.getWrappedObject("response", env);
+        final HttpSession session = FreeMarkerWorker.getWrappedObject("session", env);
 
-        final GenericValue userLogin = (GenericValue) FreeMarkerWorker.getWrappedObject("userLogin", env);
-        final Map<String, Object> templateCtx = UtilGenerics.checkMap(FreeMarkerWorker.getWrappedObject("context", env));
+        final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
+        final Map<String, Object> templateCtx = FreeMarkerWorker.getWrappedObject("context", env);
 
         FreeMarkerWorker.getSiteParameters(request, templateCtx);
 

Modified: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original)
+++ ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Fri Dec 10 09:14:36 2010
@@ -1,382 +1,382 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.widget.tree;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.StringUtil;
-import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.template.FreeMarkerWorker;
-import org.ofbiz.webapp.control.RequestHandler;
-import org.ofbiz.webapp.taglib.ContentUrlTag;
-import org.ofbiz.widget.ModelWidget;
-import org.ofbiz.widget.WidgetWorker;
-import org.ofbiz.widget.screen.ScreenRenderer;
-import org.ofbiz.widget.screen.ScreenStringRenderer;
-import org.ofbiz.widget.tree.ModelTree;
-import org.ofbiz.widget.tree.TreeStringRenderer;
-
-import freemarker.core.Environment;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-/**
- * Widget Library - Tree Renderer implementation based on Freemarker macros
- *
- */
-public class MacroTreeRenderer implements TreeStringRenderer {
-
-    public static final String module = MacroTreeRenderer.class.getName();
-    ScreenStringRenderer screenStringRenderer = null;
-    private Template macroLibrary;
-    private Environment environment;
-    protected boolean widgetCommentsEnabled = false;
-
-
-    public MacroTreeRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException {
-        this.macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath);
-        Map<String, Object> input = UtilMisc.toMap("key", null);
-        this.environment = FreeMarkerWorker.renderTemplate(this.macroLibrary, input, writer);
-    }
-
-    private void executeMacro(Appendable writer, String macro) throws IOException {
-        try {
-            Reader templateReader = new StringReader(macro);
-            // FIXME: I am using a Date as an hack to provide a unique name for the template...
-            Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
-            templateReader.close();
-            if (writer != null) {
-                Map<String, Object> input = UtilMisc.toMap("key", null);
-                Environment tmpEnvironment = FreeMarkerWorker.renderTemplate(this.macroLibrary, input, writer);
-                tmpEnvironment.include(template);
-            } else {
-                this.environment.include(template);
-            }
-        } catch (TemplateException e) {
-            Debug.logError(e, "Error rendering screen thru ftl", module);
-        } catch (IOException e) {
-            Debug.logError(e, "Error rendering screen thru ftl", module);
-        }
-    }
-    
-    private void executeMacro(String macro) throws IOException {
-        executeMacro(null, macro);
-    }
-
-    /**
-     * Renders the beginning boundary comment string.
-     * @param writer The writer to write to
-     * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc.
-     * @param modelWidget The widget
-     */
-    public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException {
-        if (this.widgetCommentsEnabled) {
-            StringWriter sr = new StringWriter();
-            sr.append("<@formatBoundaryComment ");
-            sr.append(" boundaryType=\"");
-            sr.append("Begin");
-            sr.append("\" widgetType=\"");
-            sr.append(widgetType);
-            sr.append("\" widgetName=\"");
-            sr.append(modelWidget.getBoundaryCommentName());
-            sr.append("\" />");
-            executeMacro(sr.toString());
-        }
-    }
-    
-    /**
-     * Renders the ending boundary comment string.
-     * @param writer The writer to write to
-     * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc.
-     * @param modelWidget The widget
-     */
-    public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException {
-        if (this.widgetCommentsEnabled) {
-            StringWriter sr = new StringWriter();
-            sr.append("<@formatBoundaryComment ");
-            sr.append(" boundaryType=\"");
-            sr.append("End");
-            sr.append("\" widgetType=\"");
-            sr.append(widgetType);
-            sr.append("\" widgetName=\"");
-            sr.append(modelWidget.getBoundaryCommentName());
-            sr.append("\" />");
-            executeMacro(sr.toString());
-        }
-    }    
-    
-    public void renderNodeBegin(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node, int depth) throws IOException {
-        String currentNodeTrailPiped = null;
-        List<String> currentNodeTrail = UtilGenerics.toList(context.get("currentNodeTrail"));
-        
-        String style = "";
-        if (node.isRootNode()) {          
-            this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context);
-            renderBeginningBoundaryComment(writer, "Tree Widget", node.getModelTree());
-            style = "basic-tree";
-        }
-
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderNodeBegin ");
-        sr.append(" style=\"");
-        sr.append(style);
-        sr.append("\" />");
-        executeMacro(sr.toString());
-
-        String pkName = node.getPkName();
-        String entityId = null;
-        String entryName = node.getEntryName();
-        if (UtilValidate.isNotEmpty(entryName)) {
-            Map map = (Map)context.get(entryName);
-            entityId = (String)map.get(pkName);
-        } else {
-            entityId = (String) context.get(pkName);
-        }
-        boolean hasChildren = node.hasChildren(context);
-
-        ModelTree.ModelNode.Link expandCollapseLink = new ModelTree.ModelNode.Link();
-        // check to see if this node needs to be expanded.
-        if (hasChildren && node.isExpandCollapse()) {
-            String targetEntityId = null;
-            List<String> targetNodeTrail = UtilGenerics.toList(context.get("targetNodeTrail"));
-            if (depth < targetNodeTrail.size()) {
-                targetEntityId = targetNodeTrail.get(depth);
-            }
-
-            int openDepth = node.getModelTree().getOpenDepth();
-            if (depth >= openDepth && (targetEntityId == null || !targetEntityId.equals(entityId))) {
-                // Not on the trail
-                if (node.showPeers(depth, context)) {
-                    context.put("processChildren", Boolean.FALSE);
-                    //expandCollapseLink.setText("&nbsp;+&nbsp;");
-                    currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|");
-                    expandCollapseLink.setStyle("collapsed");
-                    StringBuilder target = new StringBuilder(node.getModelTree().getExpandCollapseRequest(context));
-                    String trailName = node.getModelTree().getTrailName(context);
-                    if (target.indexOf("?") < 0) {
-                        target.append("?");
-                    } else {
-                        target.append("&");
-                    }
-                    target.append(trailName).append("=").append(currentNodeTrailPiped);
-                    expandCollapseLink.setTarget(target.toString());
-                }
-            } else {
-                context.put("processChildren", Boolean.TRUE);
-                //expandCollapseLink.setText("&nbsp;-&nbsp;");
-                String lastContentId = currentNodeTrail.remove(currentNodeTrail.size() - 1);
-                currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|");
-                if (currentNodeTrailPiped == null) {
-                    currentNodeTrailPiped = "";
-                }
-                expandCollapseLink.setStyle("expanded");
-                StringBuilder target = new StringBuilder(node.getModelTree().getExpandCollapseRequest(context));
-                String trailName = node.getModelTree().getTrailName(context);
-                if (target.indexOf("?") < 0) {
-                    target.append("?");
-                } else {
-                    target.append("&");
-                }
-                target.append(trailName).append("=").append(currentNodeTrailPiped);
-                expandCollapseLink.setTarget(target.toString());
-                // add it so it can be remove in renderNodeEnd
-                currentNodeTrail.add(lastContentId);
-            }
-            renderLink(writer, context, expandCollapseLink);
-        } else if (!hasChildren) {
-            context.put("processChildren", Boolean.FALSE);
-            expandCollapseLink.setStyle("leafnode");
-            renderLink(writer, context, expandCollapseLink);
-        }
-    }
-
-    public void renderNodeEnd(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
-        Boolean processChildren = (Boolean) context.get("processChildren");
-        if (node.isRootNode()) {            
-            renderEndingBoundaryComment(writer, "Tree Widget", node.getModelTree());
-        }
-        
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderNodeEnd ");        
-        sr.append(" processChildren=");
-        sr.append(Boolean.toString(processChildren.booleanValue()));
-        sr.append(" isRootNode=");
-        sr.append(Boolean.toString(node.isRootNode()));
-        sr.append(" />");
-        executeMacro(sr.toString());        
-    }
-
-    public void renderLastElement(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
-        Boolean processChildren = (Boolean) context.get("processChildren");
-        if (processChildren.booleanValue()) {            
-            StringWriter sr = new StringWriter();
-            sr.append("<@renderLastElement ");
-            sr.append("style=\"");
-            sr.append("basic-tree");
-            sr.append("\" />");
-            executeMacro(sr.toString());
-        }
-    }
-
-    public void renderLabel(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException {
-        String id = label.getId(context);
-        String style = label.getStyle(context);
-        String labelText = label.getText(context);
-
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderLabel ");
-        sr.append("id=\"");
-        sr.append(id);
-        sr.append("\" style=\"");
-        sr.append(style);
-        sr.append("\" labelText=\"");
-        sr.append(labelText);        
-        sr.append("\" />");
-        executeMacro(sr.toString());        
-    }
-
-    public void renderLink(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException {
-        String target = link.getTarget(context);
-        StringBuilder linkUrl = new StringBuilder();
-        HttpServletResponse response = (HttpServletResponse) context.get("response");
-        HttpServletRequest request = (HttpServletRequest) context.get("request");
-        
-        if (UtilValidate.isNotEmpty(target)) {
-            WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context),
-                    link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);            
-        }        
-        
-        String id = link.getId(context);
-        String style = link.getStyle(context);
-        String name = link.getName(context);
-        String title = link.getTitle(context);
-        String targetWindow = link.getTargetWindow(context);
-        String linkText = link.getText(context);
-        
-        String imgStr = "";
-        ModelTree.ModelNode.Image img = link.getImage();
-        if (img != null) {
-            StringWriter sw = new StringWriter();
-            renderImage(sw, context, img);
-            imgStr = sw.toString();
-        }
-        
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderLink ");
-        sr.append("id=\"");
-        sr.append(id);
-        sr.append("\" style=\"");
-        sr.append(style);
-        sr.append("\" name=\"");
-        sr.append(name);
-        sr.append("\" title=\"");
-        sr.append(title);
-        sr.append("\" targetWindow=\"");
-        sr.append(targetWindow);  
-        sr.append("\" linkUrl=\"");
-        sr.append(linkUrl);    
-        sr.append("\" linkText=\"");
-        sr.append(linkText);          
-        sr.append("\" imgStr=\"");
-        sr.append(imgStr.replaceAll("\"", "\\\\\""));
-        sr.append("\" />");
-        executeMacro(sr.toString());
-    }
-  
-    public void renderImage(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException {
-        if (image == null) {
-            return ;            
-        }
-        HttpServletResponse response = (HttpServletResponse) context.get("response");
-        HttpServletRequest request = (HttpServletRequest) context.get("request");
-        
-        String urlMode = image.getUrlMode();
-        String src = image.getSrc(context);
-        String id = image.getId(context);
-        String style = image.getStyle(context);
-        String wid = image.getWidth(context);
-        String hgt = image.getHeight(context);
-        String border = image.getBorder(context);
-        String alt = ""; //TODO add alt to tree images image.getAlt(context);
-
-        boolean fullPath = false;
-        boolean secure = false;
-        boolean encode = false;
-        String urlString = "";
-        
-        if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) {
-            if (request != null && response != null) {
-                ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
-                RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
-                urlString = rh.makeLink(request, response, src, fullPath, secure, encode);
-            } else {
-                urlString = src;
-            }
-        } else  if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
-            if (request != null && response != null) {
-                StringBuilder newURL = new StringBuilder();
-                ContentUrlTag.appendContentPrefix(request, newURL);
-                newURL.append(src);
-                urlString = newURL.toString();
-            }
-        } else {
-            urlString = src;
-        }
-        StringWriter sr = new StringWriter();
-        sr.append("<@renderImage ");
-        sr.append("src=\"");
-        sr.append(src);
-        sr.append("\" id=\"");
-        sr.append(id);
-        sr.append("\" style=\"");
-        sr.append(style);
-        sr.append("\" wid=\"");
-        sr.append(wid);
-        sr.append("\" hgt=\"");
-        sr.append(hgt);
-        sr.append("\" border=\"");
-        sr.append(border);
-        sr.append("\" alt=\"");
-        sr.append(alt);
-        sr.append("\" urlString=\"");
-        sr.append(urlString);
-        sr.append("\" />");
-        executeMacro(writer, sr.toString());        
-    }
-
-    public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {
-        ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
-        if (screenRenderer != null) {
-            this.screenStringRenderer = screenRenderer.getScreenStringRenderer();
-        }
-        return this.screenStringRenderer;
-    }
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.widget.tree;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.template.FreeMarkerWorker;
+import org.ofbiz.webapp.control.RequestHandler;
+import org.ofbiz.webapp.taglib.ContentUrlTag;
+import org.ofbiz.widget.ModelWidget;
+import org.ofbiz.widget.WidgetWorker;
+import org.ofbiz.widget.screen.ScreenRenderer;
+import org.ofbiz.widget.screen.ScreenStringRenderer;
+import org.ofbiz.widget.tree.ModelTree;
+import org.ofbiz.widget.tree.TreeStringRenderer;
+
+import freemarker.core.Environment;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * Widget Library - Tree Renderer implementation based on Freemarker macros
+ *
+ */
+public class MacroTreeRenderer implements TreeStringRenderer {
+
+    public static final String module = MacroTreeRenderer.class.getName();
+    ScreenStringRenderer screenStringRenderer = null;
+    private Template macroLibrary;
+    private Environment environment;
+    protected boolean widgetCommentsEnabled = false;
+
+
+    public MacroTreeRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException {
+        this.macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath);
+        Map<String, Object> input = UtilMisc.toMap("key", null);
+        this.environment = FreeMarkerWorker.renderTemplate(this.macroLibrary, input, writer);
+    }
+
+    private void executeMacro(Appendable writer, String macro) throws IOException {
+        try {
+            Reader templateReader = new StringReader(macro);
+            // FIXME: I am using a Date as an hack to provide a unique name for the template...
+            Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
+            templateReader.close();
+            if (writer != null) {
+                Map<String, Object> input = UtilMisc.toMap("key", null);
+                Environment tmpEnvironment = FreeMarkerWorker.renderTemplate(this.macroLibrary, input, writer);
+                tmpEnvironment.include(template);
+            } else {
+                this.environment.include(template);
+            }
+        } catch (TemplateException e) {
+            Debug.logError(e, "Error rendering screen thru ftl", module);
+        } catch (IOException e) {
+            Debug.logError(e, "Error rendering screen thru ftl", module);
+        }
+    }
+    
+    private void executeMacro(String macro) throws IOException {
+        executeMacro(null, macro);
+    }
+
+    /**
+     * Renders the beginning boundary comment string.
+     * @param writer The writer to write to
+     * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc.
+     * @param modelWidget The widget
+     */
+    public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException {
+        if (this.widgetCommentsEnabled) {
+            StringWriter sr = new StringWriter();
+            sr.append("<@formatBoundaryComment ");
+            sr.append(" boundaryType=\"");
+            sr.append("Begin");
+            sr.append("\" widgetType=\"");
+            sr.append(widgetType);
+            sr.append("\" widgetName=\"");
+            sr.append(modelWidget.getBoundaryCommentName());
+            sr.append("\" />");
+            executeMacro(sr.toString());
+        }
+    }
+    
+    /**
+     * Renders the ending boundary comment string.
+     * @param writer The writer to write to
+     * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc.
+     * @param modelWidget The widget
+     */
+    public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException {
+        if (this.widgetCommentsEnabled) {
+            StringWriter sr = new StringWriter();
+            sr.append("<@formatBoundaryComment ");
+            sr.append(" boundaryType=\"");
+            sr.append("End");
+            sr.append("\" widgetType=\"");
+            sr.append(widgetType);
+            sr.append("\" widgetName=\"");
+            sr.append(modelWidget.getBoundaryCommentName());
+            sr.append("\" />");
+            executeMacro(sr.toString());
+        }
+    }    
+    
+    public void renderNodeBegin(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node, int depth) throws IOException {
+        String currentNodeTrailPiped = null;
+        List<String> currentNodeTrail = UtilGenerics.toList(context.get("currentNodeTrail"));
+        
+        String style = "";
+        if (node.isRootNode()) {          
+            this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context);
+            renderBeginningBoundaryComment(writer, "Tree Widget", node.getModelTree());
+            style = "basic-tree";
+        }
+
+        StringWriter sr = new StringWriter();
+        sr.append("<@renderNodeBegin ");
+        sr.append(" style=\"");
+        sr.append(style);
+        sr.append("\" />");
+        executeMacro(sr.toString());
+
+        String pkName = node.getPkName();
+        String entityId = null;
+        String entryName = node.getEntryName();
+        if (UtilValidate.isNotEmpty(entryName)) {
+            Map map = (Map)context.get(entryName);
+            entityId = (String)map.get(pkName);
+        } else {
+            entityId = (String) context.get(pkName);
+        }
+        boolean hasChildren = node.hasChildren(context);
+
+        ModelTree.ModelNode.Link expandCollapseLink = new ModelTree.ModelNode.Link();
+        // check to see if this node needs to be expanded.
+        if (hasChildren && node.isExpandCollapse()) {
+            String targetEntityId = null;
+            List<String> targetNodeTrail = UtilGenerics.toList(context.get("targetNodeTrail"));
+            if (depth < targetNodeTrail.size()) {
+                targetEntityId = targetNodeTrail.get(depth);
+            }
+
+            int openDepth = node.getModelTree().getOpenDepth();
+            if (depth >= openDepth && (targetEntityId == null || !targetEntityId.equals(entityId))) {
+                // Not on the trail
+                if (node.showPeers(depth, context)) {
+                    context.put("processChildren", Boolean.FALSE);
+                    //expandCollapseLink.setText("&nbsp;+&nbsp;");
+                    currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|");
+                    expandCollapseLink.setStyle("collapsed");
+                    StringBuilder target = new StringBuilder(node.getModelTree().getExpandCollapseRequest(context));
+                    String trailName = node.getModelTree().getTrailName(context);
+                    if (target.indexOf("?") < 0) {
+                        target.append("?");
+                    } else {
+                        target.append("&");
+                    }
+                    target.append(trailName).append("=").append(currentNodeTrailPiped);
+                    expandCollapseLink.setTarget(target.toString());
+                }
+            } else {
+                context.put("processChildren", Boolean.TRUE);
+                //expandCollapseLink.setText("&nbsp;-&nbsp;");
+                String lastContentId = currentNodeTrail.remove(currentNodeTrail.size() - 1);
+                currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|");
+                if (currentNodeTrailPiped == null) {
+                    currentNodeTrailPiped = "";
+                }
+                expandCollapseLink.setStyle("expanded");
+                StringBuilder target = new StringBuilder(node.getModelTree().getExpandCollapseRequest(context));
+                String trailName = node.getModelTree().getTrailName(context);
+                if (target.indexOf("?") < 0) {
+                    target.append("?");
+                } else {
+                    target.append("&");
+                }
+                target.append(trailName).append("=").append(currentNodeTrailPiped);
+                expandCollapseLink.setTarget(target.toString());
+                // add it so it can be remove in renderNodeEnd
+                currentNodeTrail.add(lastContentId);
+            }
+            renderLink(writer, context, expandCollapseLink);
+        } else if (!hasChildren) {
+            context.put("processChildren", Boolean.FALSE);
+            expandCollapseLink.setStyle("leafnode");
+            renderLink(writer, context, expandCollapseLink);
+        }
+    }
+
+    public void renderNodeEnd(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
+        Boolean processChildren = (Boolean) context.get("processChildren");
+        if (node.isRootNode()) {            
+            renderEndingBoundaryComment(writer, "Tree Widget", node.getModelTree());
+        }
+        
+        StringWriter sr = new StringWriter();
+        sr.append("<@renderNodeEnd ");        
+        sr.append(" processChildren=");
+        sr.append(Boolean.toString(processChildren.booleanValue()));
+        sr.append(" isRootNode=");
+        sr.append(Boolean.toString(node.isRootNode()));
+        sr.append(" />");
+        executeMacro(sr.toString());        
+    }
+
+    public void renderLastElement(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node) throws IOException {
+        Boolean processChildren = (Boolean) context.get("processChildren");
+        if (processChildren.booleanValue()) {            
+            StringWriter sr = new StringWriter();
+            sr.append("<@renderLastElement ");
+            sr.append("style=\"");
+            sr.append("basic-tree");
+            sr.append("\" />");
+            executeMacro(sr.toString());
+        }
+    }
+
+    public void renderLabel(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException {
+        String id = label.getId(context);
+        String style = label.getStyle(context);
+        String labelText = label.getText(context);
+
+        StringWriter sr = new StringWriter();
+        sr.append("<@renderLabel ");
+        sr.append("id=\"");
+        sr.append(id);
+        sr.append("\" style=\"");
+        sr.append(style);
+        sr.append("\" labelText=\"");
+        sr.append(labelText);        
+        sr.append("\" />");
+        executeMacro(sr.toString());        
+    }
+
+    public void renderLink(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Link link) throws IOException {
+        String target = link.getTarget(context);
+        StringBuilder linkUrl = new StringBuilder();
+        HttpServletResponse response = (HttpServletResponse) context.get("response");
+        HttpServletRequest request = (HttpServletRequest) context.get("request");
+        
+        if (UtilValidate.isNotEmpty(target)) {
+            WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context),
+                    link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context);            
+        }        
+        
+        String id = link.getId(context);
+        String style = link.getStyle(context);
+        String name = link.getName(context);
+        String title = link.getTitle(context);
+        String targetWindow = link.getTargetWindow(context);
+        String linkText = link.getText(context);
+        
+        String imgStr = "";
+        ModelTree.ModelNode.Image img = link.getImage();
+        if (img != null) {
+            StringWriter sw = new StringWriter();
+            renderImage(sw, context, img);
+            imgStr = sw.toString();
+        }
+        
+        StringWriter sr = new StringWriter();
+        sr.append("<@renderLink ");
+        sr.append("id=\"");
+        sr.append(id);
+        sr.append("\" style=\"");
+        sr.append(style);
+        sr.append("\" name=\"");
+        sr.append(name);
+        sr.append("\" title=\"");
+        sr.append(title);
+        sr.append("\" targetWindow=\"");
+        sr.append(targetWindow);  
+        sr.append("\" linkUrl=\"");
+        sr.append(linkUrl);    
+        sr.append("\" linkText=\"");
+        sr.append(linkText);          
+        sr.append("\" imgStr=\"");
+        sr.append(imgStr.replaceAll("\"", "\\\\\""));
+        sr.append("\" />");
+        executeMacro(sr.toString());
+    }
+  
+    public void renderImage(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException {
+        if (image == null) {
+            return ;            
+        }
+        HttpServletResponse response = (HttpServletResponse) context.get("response");
+        HttpServletRequest request = (HttpServletRequest) context.get("request");
+        
+        String urlMode = image.getUrlMode();
+        String src = image.getSrc(context);
+        String id = image.getId(context);
+        String style = image.getStyle(context);
+        String wid = image.getWidth(context);
+        String hgt = image.getHeight(context);
+        String border = image.getBorder(context);
+        String alt = ""; //TODO add alt to tree images image.getAlt(context);
+
+        boolean fullPath = false;
+        boolean secure = false;
+        boolean encode = false;
+        String urlString = "";
+        
+        if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) {
+            if (request != null && response != null) {
+                ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
+                RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
+                urlString = rh.makeLink(request, response, src, fullPath, secure, encode);
+            } else {
+                urlString = src;
+            }
+        } else  if (urlMode != null && urlMode.equalsIgnoreCase("content")) {
+            if (request != null && response != null) {
+                StringBuilder newURL = new StringBuilder();
+                ContentUrlTag.appendContentPrefix(request, newURL);
+                newURL.append(src);
+                urlString = newURL.toString();
+            }
+        } else {
+            urlString = src;
+        }
+        StringWriter sr = new StringWriter();
+        sr.append("<@renderImage ");
+        sr.append("src=\"");
+        sr.append(src);
+        sr.append("\" id=\"");
+        sr.append(id);
+        sr.append("\" style=\"");
+        sr.append(style);
+        sr.append("\" wid=\"");
+        sr.append(wid);
+        sr.append("\" hgt=\"");
+        sr.append(hgt);
+        sr.append("\" border=\"");
+        sr.append(border);
+        sr.append("\" alt=\"");
+        sr.append(alt);
+        sr.append("\" urlString=\"");
+        sr.append(urlString);
+        sr.append("\" />");
+        executeMacro(writer, sr.toString());        
+    }
+
+    public ScreenStringRenderer getScreenStringRenderer(Map<String, Object> context) {
+        ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens");
+        if (screenRenderer != null) {
+            this.screenStringRenderer = screenRenderer.getScreenStringRenderer();
+        }
+        return this.screenStringRenderer;
+    }
+}

Propchange: ofbiz/branches/jquery/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/branches/jquery/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java?rev=1044245&r1=1044244&r2=1044245&view=diff
==============================================================================
--- ofbiz/branches/jquery/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java (original)
+++ ofbiz/branches/jquery/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java Fri Dec 10 09:14:36 2010
@@ -84,7 +84,6 @@ public class FixedAssetMaintServices {
                     EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
                     EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0")),
                     EntityOperator.AND);
-            // FIXME: broken findByAnd
             List<GenericValue> inventoryItems = delegator.findList("InventoryItem", ecl, null, null, null, false);   //&& inventoryItems.size() > 0
             Iterator<GenericValue> itr = inventoryItems.iterator();
             while (requestedQty > 0 && itr.hasNext()) {

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/authentication/ApplicationAuthenticationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/authentication/AuthenticatedToken.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/authentication/PasswordCredential.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/authentication/PrincipalAuthenticationContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/authentication/ValidationFactor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/ApplicationAccessDeniedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/ApplicationPermissionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InactiveAccountException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidAuthenticationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidAuthorizationTokenException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidCredentialException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidGroupException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidPrincipalException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidRoleException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/InvalidTokenException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/exception/ObjectNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPCookieInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPNestableGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SOAPRole.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/com/atlassian/crowd/integration/soap/SearchRestriction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/org/ofbiz/crowd/CrowdAuthenticator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/org/ofbiz/crowd/CrowdWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/specialpurpose/crowd/src/org/ofbiz/crowd/security/SecurityServer.java
------------------------------------------------------------------------------
    svn:eol-style = native