empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1372892 - in /empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components: LinkTag.java MenuItemTag.java
Date Tue, 14 Aug 2012 14:11:18 GMT
Author: doebele
Date: Tue Aug 14 14:11:18 2012
New Revision: 1372892

URL: http://svn.apache.org/viewvc?rev=1372892&view=rev
Log:
EMPIREDB-157
JSF2 MenuItemTag child item checks

Modified:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/MenuItemTag.java

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java?rev=1372892&r1=1372891&r2=1372892&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
Tue Aug 14 14:11:18 2012
@@ -26,6 +26,7 @@ import javax.faces.component.NamingConta
 import javax.faces.component.UIComponent;
 import javax.faces.component.UINamingContainer;
 import javax.faces.component.UIOutput;
+import javax.faces.component.UIPanel;
 import javax.faces.component.UIParameter;
 import javax.faces.component.html.HtmlOutcomeTargetLink;
 import javax.faces.context.FacesContext;
@@ -95,12 +96,23 @@ public class LinkTag extends UIOutput im
                 if (c instanceof HtmlOutcomeTargetLink)
                     linkComponent = (HtmlOutcomeTargetLink)c;
                 else
-                    log.info("TODO: handle Child nodes!");
+                {   // Something's wrong here?
+                    log.info("INFO: Unexpected child node for {}!", getClass().getName());
+                    // Check facetComponent
+                    UIPanel facetComponent = (UIPanel)getFacets().get(UIComponent.COMPOSITE_FACET_NAME);
+                    if (facetComponent==null)
+                    {
+                        log.warn("WARN: component's facetComponent has not been set! Using
Default (javax.faces.Panel).");
+                        facetComponent = (UIPanel)context.getApplication().createComponent("javax.faces.Panel");
+                        facetComponent.setRendererType("javax.faces.Group");
+                        getFacets().put(UIComponent.COMPOSITE_FACET_NAME, facetComponent);
+                    }
+                }    
             }
             if (linkComponent == null)
             {
                 linkComponent = new HtmlOutcomeTargetLink();
-                this.getChildren().add(linkComponent);
+                this.getChildren().add(0, linkComponent);
             }
             // set params
             setLinkProperties(linkComponent);

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/MenuItemTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/MenuItemTag.java?rev=1372892&r1=1372891&r2=1372892&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/MenuItemTag.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/MenuItemTag.java
Tue Aug 14 14:11:18 2012
@@ -36,14 +36,19 @@ public class MenuItemTag extends LinkTag
     // Logger
     private static final Logger log = LoggerFactory.getLogger(MenuItemTag.class);
     
-    private static int renderCount = 1;
-    
     private MenuListTag parentMenu = null;
     private String menuId;
+
+    private static int itemIdSeq = 0;
+    private final int itemId;
     
     public MenuItemTag()
     {
         super();
+        // Debug stuff
+        itemId = ++itemIdSeq;
+        if (log.isDebugEnabled())
+            log.debug("MenuId {} created", itemId);
     }
 
     @Override
@@ -67,7 +72,7 @@ public class MenuItemTag extends LinkTag
         writer.startElement("li", this);
         writer.writeAttribute("id", getClientId(context), null);
         writer.writeAttribute("class", getStyleClass(), null);
-        writer.writeAttribute("count", String.valueOf(renderCount++), null);
+        // writer.writeAttribute("item", String.valueOf(itemId), null);
 
         // begin
         super.encodeBegin(context);
@@ -88,12 +93,12 @@ public class MenuItemTag extends LinkTag
             UIComponent c = getChildren().get(0);
             if (c instanceof HtmlOutcomeTargetLink)
             {   if (c.isRendered())
-                {   log.warn("Unexpected rendering of output link. Rendering is ignored.");
+                {   log.warn("WARN: Unexpected rendering of output link. Rendering is ignored.");
                     c.setRendered(false);
                 }
             }
             else
-                log.warn("Unexpected child element as first child of MenuItemTag!");
+                log.warn("WARN: Unexpected child element as first child of MenuItemTag!");
             // encode children
             super.encodeChildren(context);
         }



Mime
View raw message