myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r399048 [2/2] - in /myfaces/tomahawk/trunk: core/src/main/java/org/apache/myfaces/custom/navmenu/ core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/ core/src/main/tld/tomahawk-entities/ examples/simple/src/main/java/org/apach...
Date Tue, 02 May 2006 20:56:15 GMT
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRendererUtils.java
Tue May  2 13:56:12 2006
@@ -29,82 +29,102 @@
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIViewRoot;
 import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
 import javax.faces.webapp.UIComponentTag;
 import javax.faces.event.ActionEvent;
 import java.util.List;
 import java.util.Iterator;
+import java.util.Map;
 import java.io.IOException;
 
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+
 /**
  * @author Thomas Spiegl
  * @author Manfred Geiler
  */
-class HtmlNavigationMenuRendererUtils
-{
+class HtmlNavigationMenuRendererUtils {
     private static final Log log = LogFactory.getLog(HtmlNavigationMenuRendererUtils.class);
 
     private static final Class[] ACTION_LISTENER_ARGS = {ActionEvent.class};
 
-    private HtmlNavigationMenuRendererUtils() {}
+    private HtmlNavigationMenuRendererUtils() {
+    }
 
     public static void renderChildrenListLayout(FacesContext facesContext,
                                                 ResponseWriter writer,
                                                 HtmlPanelNavigationMenu panelNav,
                                                 List children,
-                                                int level) throws IOException
-    {
-        for (Iterator it = children.iterator(); it.hasNext(); )
-        {
-            UIComponent child = (UIComponent)it.next();            
+                                                int level) throws IOException {
+        for (Iterator it = children.iterator(); it.hasNext();) {
+            UIComponent child = (UIComponent) it.next();
             if (!child.isRendered()) continue;
-            if (child instanceof UINavigationMenuItem)
-            {
+
+            if (child instanceof UINavigationMenuItem) {
                 UINavigationMenuItem navItem = (UINavigationMenuItem) child;
                 renderChildrenListLayout(facesContext, writer, panelNav, child.getChildren(),
level);
             }
-            if (child instanceof HtmlCommandNavigationItem)
-            {
+            if (child instanceof HtmlCommandNavigationItem) {
                 //navigation item
                 HtmlRendererUtils.writePrettyLineSeparator(facesContext);
-                
+
                 HtmlCommandNavigationItem navItem = (HtmlCommandNavigationItem) child;
 
+                String externalLink = navItem.getExternalLink();
+
                 String style = HtmlNavigationMenuRendererUtils.getNavigationItemStyle(panelNav,
navItem);
                 String styleClass = HtmlNavigationMenuRendererUtils.getNavigationItemClass(panelNav,
navItem);
-                                
+
                 writer.startElement(HTML.LI_ELEM, panelNav);
                 HtmlNavigationMenuRendererUtils.writeStyleAttributes(writer, style, styleClass);
 
                 Object value = navItem.getValue();
-                navItem.setValue(null); // unset value, value must not be rendered
-                navItem.encodeBegin(facesContext);
-                HtmlNavigationMenuRendererUtils.renderChildren(facesContext, navItem);
-                navItem.encodeEnd(facesContext);
-                navItem.setValue(value); // restore value
-
-                if (hasCommandNavigationItemChildren(navItem))
-                {
-                    writer.startElement(HTML.UL_ELEM, panelNav);   
-                    
+                boolean renderAsOutputLink = externalLink != null && value != null;
+
+                if (!renderAsOutputLink) {
+                    //if there is an external link specified don't render the command nav
item, its content
+                    //will be wrapped by a output link in the renderChildren() method
+                    if (externalLink == null) {
+                        navItem.setValue(null); // unset value, value must not be rendered
+                        navItem.encodeBegin(facesContext);
+                    }
+                    HtmlNavigationMenuRendererUtils.renderChildren(facesContext, navItem,
panelNav);
+                    if (externalLink == null) {
+                        navItem.encodeEnd(facesContext);
+                        navItem.setValue(value); // restore value
+                    }
+                }
+                else {
+                    //there is an external link value and display value exists, so, render
it as an output link and ignore
+                    //the children
+                    writer.startElement(HTML.ANCHOR_ELEM, null);
+                    writer.writeAttribute(HTML.HREF_ATTR, externalLink, null);
+                    if (navItem.getTarget() != null)
+                        writer.writeAttribute(HTML.TARGET_ATTR, navItem.getTarget(), null);
+                    writer.writeText(value, JSFAttr.VALUE_ATTR);
+                    writer.endElement(HTML.ANCHOR_ELEM);
+                }
+
+                if (hasCommandNavigationItemChildren(navItem)) {
+                    writer.startElement(HTML.UL_ELEM, panelNav);
+
                     if (panelNav.isRenderAll())
                         HtmlNavigationMenuRendererUtils.writeStyleAttributes(writer, navItem.getStyle(),
navItem.getStyleClass());
-                    
+
                     HtmlRendererUtils.renderHTMLAttributes(writer, panelNav, HTML.UL_PASSTHROUGH_ATTRIBUTES);
                     renderChildrenListLayout(facesContext, writer, panelNav, child.getChildren(),
level + 1);
                     writer.endElement(HTML.UL_ELEM);
                 }
+
                 writer.endElement(HTML.LI_ELEM);
             }
         }
     }
 
-    private static boolean hasCommandNavigationItemChildren(HtmlCommandNavigationItem item)
-    {
+    private static boolean hasCommandNavigationItemChildren(HtmlCommandNavigationItem item)
{
         List children = item.getChildren();
-        for (int i = 0, sizei = children.size(); i < sizei; i++)
-        {
-            if (children.get(i) instanceof HtmlCommandNavigationItem)
-            {
+        for (int i = 0, sizei = children.size(); i < sizei; i++) {
+            if (children.get(i) instanceof HtmlCommandNavigationItem) {
                 return true;
             }
         }
@@ -115,26 +135,22 @@
                                                  ResponseWriter writer,
                                                  HtmlPanelNavigationMenu panelNav,
                                                  List children,
-                                                 int level) throws IOException
-    {
-        for (Iterator it = children.iterator(); it.hasNext(); )
-        {
-            UIComponent child = (UIComponent)it.next();
+                                                 int level) throws IOException {
+        for (Iterator it = children.iterator(); it.hasNext();) {
+            UIComponent child = (UIComponent) it.next();
             if (!child.isRendered()) continue;
-            if (child instanceof HtmlCommandNavigationItem)
-            {
+            if (child instanceof HtmlCommandNavigationItem) {
                 //navigation item
                 HtmlRendererUtils.writePrettyLineSeparator(facesContext);
 
-                String style = getNavigationItemStyle(panelNav, (HtmlCommandNavigationItem)child);
-                String styleClass = getNavigationItemClass(panelNav, (HtmlCommandNavigationItem)child);
+                String style = getNavigationItemStyle(panelNav, (HtmlCommandNavigationItem)
child);
+                String styleClass = getNavigationItemClass(panelNav, (HtmlCommandNavigationItem)
child);
 
                 writer.startElement(HTML.TR_ELEM, panelNav);
                 writer.startElement(HTML.TD_ELEM, panelNav);
                 writeStyleAttributes(writer, style, styleClass);
 
-                if (style != null || styleClass != null)
-                {
+                if (style != null || styleClass != null) {
                     writer.startElement(HTML.SPAN_ELEM, panelNav);
                     writeStyleAttributes(writer, style, styleClass);
                 }
@@ -142,21 +158,18 @@
                 child.encodeBegin(facesContext);
 
                 child.encodeEnd(facesContext);
-                if (style != null || styleClass != null)
-                {
+                if (style != null || styleClass != null) {
                     writer.endElement(HTML.SPAN_ELEM);
                 }
 
                 writer.endElement(HTML.TD_ELEM);
                 writer.endElement(HTML.TR_ELEM);
 
-                if (child.getChildCount() > 0)
-                {
+                if (child.getChildCount() > 0) {
                     renderChildrenTableLayout(facesContext, writer, panelNav, child.getChildren(),
level + 1);
                 }
             }
-            else
-            {
+            else {
                 //separator
                 HtmlRendererUtils.writePrettyLineSeparator(facesContext);
 
@@ -167,17 +180,15 @@
                 writer.startElement(HTML.TD_ELEM, panelNav);
                 writeStyleAttributes(writer, style, styleClass);
 
-                if (style != null || styleClass != null)
-                {
+                if (style != null || styleClass != null) {
                     writer.startElement(HTML.SPAN_ELEM, panelNav);
                     writeStyleAttributes(writer, style, styleClass);
                 }
                 indent(writer, level);
                 RendererUtils.renderChild(facesContext, child);
-                if (style != null || styleClass != null)
-                {
+                if (style != null || styleClass != null) {
                     writer.endElement(HTML.SPAN_ELEM);
-                }                                                             
+                }
 
                 writer.endElement(HTML.TD_ELEM);
                 writer.endElement(HTML.TR_ELEM);
@@ -185,123 +196,119 @@
         }
     }
 
-    public static void indent(ResponseWriter writer, int level) throws IOException
-    {
+    public static void indent(ResponseWriter writer, int level) throws IOException {
         StringBuffer buf = new StringBuffer();
-        for (int i = 0; i < level; i++)
-        {
+        for (int i = 0; i < level; i++) {
             buf.append("&#160;&#160;&#160;&#160;");
         }
         writer.write(buf.toString());
     }
-    
-    public static String getNavigationItemStyle(HtmlPanelNavigationMenu navPanel, HtmlCommandNavigationItem
navItem)
-    {
-        if (navItem.isActive())
-        {
+
+    public static String getNavigationItemStyle(HtmlPanelNavigationMenu navPanel, HtmlCommandNavigationItem
navItem) {
+        if (navItem.isActive()) {
             return navPanel.getActiveItemStyle();
         }
-        else if (navItem.isOpen())
-        {
+        else if (navItem.isOpen()) {
             return navPanel.getOpenItemStyle();
         }
-        else
-        {
+        else {
             return navPanel.getItemStyle();
         }
     }
 
     public static String getNavigationItemClass(HtmlPanelNavigationMenu navPanel,
-                                                HtmlCommandNavigationItem navItem)
-    {
+                                                HtmlCommandNavigationItem navItem) {
         // MYFACES-117, if a styleClass is supplied for a HtmlCommandNavigationItem,
         // panelNavigation active/open/normal styles for items will be overriden        
              
-        if (navItem.getStyleClass() != null)
-        {
+        if (navItem.getStyleClass() != null) {
             return navItem.getStyleClass();
         }
-        if (navItem.isActive())
-        {            
+        if (navItem.isActive()) {
             return navPanel.getActiveItemClass();
         }
-        else if (navItem.isOpen())
-        {
+        else if (navItem.isOpen()) {
             return navPanel.getOpenItemClass();
         }
-        else
-        {
+        else {
             return navPanel.getItemClass();
         }
     }
 
     public static void writeStyleAttributes(ResponseWriter writer,
                                             String style,
-                                            String styleClass) throws IOException
-    {
+                                            String styleClass) throws IOException {
         HtmlRendererUtils.renderHTMLAttribute(writer, HTML.STYLE_ATTR, HTML.STYLE_ATTR, style);
         HtmlRendererUtils.renderHTMLAttribute(writer, HTML.STYLE_CLASS_ATTR, HTML.STYLE_CLASS_ATTR,
styleClass);
     }
 
-    public static UIComponent getPanel(UIComponent link)
-    {
+    public static UIComponent getPanel(UIComponent link) {
         UIComponent navPanel = link.getParent();
-        while (navPanel != null && !(navPanel instanceof HtmlPanelNavigationMenu))
-        {
+        while (navPanel != null && !(navPanel instanceof HtmlPanelNavigationMenu))
{
             navPanel = navPanel.getParent();
         }
-        if (navPanel == null)
-        {
+        if (navPanel == null) {
             throw new IllegalStateException("HtmlCommandNavigationItem not nested in HtmlPanelNavigation!?");
         }
         return navPanel;
     }
 
-    public static boolean isListLayout(HtmlPanelNavigationMenu panelNav)
-    {
+    public static boolean isListLayout(HtmlPanelNavigationMenu panelNav) {
         return !"Table".equalsIgnoreCase(panelNav.getLayout());
     }
 
-    public static void renderChildren(FacesContext facesContext, HtmlCommandNavigationItem
component) throws IOException
-    {
-        if (component.getChildCount() > 0)
-        {
-            for (Iterator it = component.getChildren().iterator(); it.hasNext(); )
-            {
-                UIComponent child = (UIComponent)it.next();
-                if (!(child instanceof HtmlCommandNavigationItem))
-                {
+    public static void renderChildren(FacesContext facesContext, HtmlCommandNavigationItem
component, HtmlPanelNavigationMenu parentPanelNav) throws IOException {
+        if (component.getChildCount() > 0) {
+            //if there is an external link value, wrapp the content with an output link
+            if (component.getExternalLink() != null) {
+                ResponseWriter writer = facesContext.getResponseWriter();
+
+                writer.startElement(HTML.ANCHOR_ELEM, null);
+                writer.writeAttribute(HTML.HREF_ATTR, component.getExternalLink(), null);
+                if (component.getTarget() != null)
+                    writer.writeAttribute(HTML.TARGET_ATTR, component.getTarget(), null);
+
+                //the style attributes need to be taken from the parent panel nav, because
the command panel navigation item
+                //is not rendered in this case which would have render them
+                String style = HtmlNavigationMenuRendererUtils.getNavigationItemStyle(parentPanelNav,
component);
+                String styleClass = HtmlNavigationMenuRendererUtils.getNavigationItemClass(parentPanelNav,
component);
+                HtmlNavigationMenuRendererUtils.writeStyleAttributes(writer, style, styleClass);
+            }
+
+            for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
+                UIComponent child = (UIComponent) it.next();
+                if (!(child instanceof HtmlCommandNavigationItem)) {
                     RendererUtils.renderChild(facesContext, child);
                 }
             }
+
+            //end wrapper output link
+            if (component.getExternalLink() != null) {
+                ResponseWriter writer = facesContext.getResponseWriter();
+                writer.endElement(HTML.ANCHOR_ELEM);
+            }
         }
     }
 
-    public static void debugTree(Log log, FacesContext facesContext, List children, int level)
-    {
-        for (Iterator it = children.iterator(); it.hasNext(); )
-        {
+    public static void debugTree(Log log, FacesContext facesContext, List children, int level)
{
+        for (Iterator it = children.iterator(); it.hasNext();) {
             UIComponent child = (UIComponent) it.next();
-            if (child instanceof UINavigationMenuItem)
-            {
+            if (child instanceof UINavigationMenuItem) {
                 UINavigationMenuItem item = (UINavigationMenuItem) child;
                 StringBuffer buf = new StringBuffer();
                 for (int i = 0; i < level * 4; i++) buf.append(' ');
                 log.debug(buf.toString() + "--> " + item.getItemLabel() + " id:" + item.getClientId(facesContext));
                 debugTree(log, facesContext, child.getChildren(), level + 1);
             }
-            else if (child instanceof HtmlCommandNavigationItem)
-            {
+            else if (child instanceof HtmlCommandNavigationItem) {
                 HtmlCommandNavigationItem item = (HtmlCommandNavigationItem) child;
                 StringBuffer buf = new StringBuffer();
                 for (int i = 0; i < level * 4; i++) buf.append(' ');
                 String value;
-                if (item.getChildren().size() > 0 && item.getChildren().get(0)
instanceof UIOutput)
-                {
+                if (item.getChildren().size() > 0 && item.getChildren().get(0)
instanceof UIOutput) {
                     UIOutput uiOutput = (UIOutput) item.getChildren().get(0);
                     value = uiOutput.getValue() != null ? uiOutput.getValue().toString()
: "?";
                 }
-                else
-                {
+                else {
                     value = item.getValue() != null ? item.getValue().toString() : "";
                 }
                 log.debug(buf.toString() + value + " id:" + item.getClientId(facesContext));
@@ -310,44 +317,47 @@
         }
     }
 
-    public static HtmlCommandNavigationItem findPreviousItem(UIViewRoot previousViewRoot,
String clientId)
-    {
+    public static HtmlCommandNavigationItem findPreviousItem(UIViewRoot previousViewRoot,
String clientId) {
         HtmlCommandNavigationItem previousItem = null;
-        if (previousViewRoot != null)
-        {
+        if (previousViewRoot != null) {
             UIComponent previousComp = previousViewRoot.findComponent(clientId);
-            if (previousComp instanceof HtmlCommandNavigationItem)
-            {
+            if (previousComp instanceof HtmlCommandNavigationItem) {
                 previousItem = (HtmlCommandNavigationItem) previousComp;
             }
         }
         return previousItem;
     }
 
-    public static MethodBinding getMethodBinding(FacesContext facesContext, String value,
boolean actionListener)
-    {
+    public static MethodBinding getMethodBinding(FacesContext facesContext, String value,
boolean actionListener) {
         MethodBinding mb;
-        if (HtmlNavigationMenuRendererUtils.isValueReference(value))
-        {
+        if (HtmlNavigationMenuRendererUtils.isValueReference(value)) {
             mb = facesContext.getApplication().createMethodBinding(value, actionListener
? ACTION_LISTENER_ARGS : null);
         }
-        else
-        {
-            if (actionListener)
-            {
+        else {
+            if (actionListener) {
                 log.error("Invalid actionListener value " + value + " (has to be ValueReference!)");
                 mb = null;
             }
-            else
-            {
+            else {
                 mb = new SimpleActionMethodBinding(value);
             }
         }
         return mb;
     }
-    
-    public static boolean isValueReference(String value)
-    {
+
+    public static void setAttributeValue(FacesContext facesContext, UIComponent comp, String
attribute, String value) {
+        if (value == null)
+            return;
+        if (HtmlNavigationMenuRendererUtils.isValueReference(value)) {
+            ValueBinding vb = facesContext.getApplication().createValueBinding(value);
+            comp.setValueBinding(attribute, vb);
+        }
+        else {
+            comp.getAttributes().put(attribute, value);
+        }
+    }
+
+    public static boolean isValueReference(String value) {
         if (value == null)
             return false;
         return UIComponentTag.isValueReference(value);

Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_command_navigation_2_attributes.xml
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_command_navigation_2_attributes.xml?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_command_navigation_2_attributes.xml
(original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_command_navigation_2_attributes.xml
Tue May  2 13:56:12 2006
@@ -1,25 +1,33 @@
-        <attribute>
-            <name>open</name>
-            <required>false</required>
-            <rtexprvalue>false</rtexprvalue>
-            <description>
-               Menu node is open.
-            </description>
-        </attribute>
-        <attribute>
-            <name>active</name>
-            <required>false</required>
-            <rtexprvalue>false</rtexprvalue>
-            <description>
-               Menu node is active.
-            </description>
-        </attribute>
-        <attribute>
-            <name>activeOnViewIds</name>
-            <required>false</required>
-            <rtexprvalue>false</rtexprvalue>
-            <description>
-                A semicolon separated list of viewIds for which this item should be active.
-            </description>
-        </attribute>
-        &ext_disabled_attribute;
+<attribute>
+    <name>open</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <description>
+        Menu node is open.
+    </description>
+</attribute>
+<attribute>
+    <name>active</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <description>
+        Menu node is active.
+    </description>
+</attribute>
+<attribute>
+    <name>activeOnViewIds</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <description>
+        A semicolon separated list of viewIds for which this item should be active.
+    </description>
+</attribute>
+<attribute>
+    <name>externalLink</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <description>
+        The external link where to redirect when this is clicked.
+    </description>
+</attribute>
+    &ext_disabled_attribute;

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java
(original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java
Tue May  2 13:56:12 2006
@@ -30,14 +30,12 @@
  * @author Thomas Spiegl (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class NavigationMenu
-{
+public class NavigationMenu {
     private static final Log log = LogFactory.getLog(NavigationMenu.class);
 
-    public NavigationMenuItem[] getInfoItems()
-    {
+    public NavigationMenuItem[] getInfoItems() {
         String label = GuiUtil.getMessageResource("nav_Info", null);
-        NavigationMenuItem[] menu= new NavigationMenuItem[1];
+        NavigationMenuItem[] menu = new NavigationMenuItem[1];
 
         menu[0] = new NavigationMenuItem(label, null, null, true);
 
@@ -53,15 +51,13 @@
         return menu;
     }
 
-    public List getJSCookMenuNavigationItems()
-    {
+    public List getJSCookMenuNavigationItems() {
         List menu = new ArrayList();
         menu.add(getMenuNaviagtionItem("Home", "go_home"));
         return menu;
     }
 
-    public List getPanelNavigationItems()
-    {
+    public List getPanelNavigationItems() {
         List menu = new ArrayList();
         // Products
         NavigationMenuItem products = getMenuNaviagtionItem("#{example_messages['panelnav_products']}",
null);
@@ -79,60 +75,56 @@
         NavigationMenuItem corporateInfo = getMenuNaviagtionItem("#{example_messages['panelnav_corporate']}",
null);
         menu.add(corporateInfo);
         corporateInfo.add(getMenuNaviagtionItem("#{example_messages['panelnav_news']}", "#{navigationMenu.getAction2}"));
-        item =  getMenuNaviagtionItem("#{example_messages['panelnav_investor']}", "#{navigationMenu.getAction3}");
+        item = getMenuNaviagtionItem("#{example_messages['panelnav_investor']}", "#{navigationMenu.getAction3}");
         //item.setIcon("images/arrow-first.gif");
         item.setDisabled(true);
         corporateInfo.add(item);
         // Contact
         menu.add(getMenuNaviagtionItem("#{example_messages['panelnav_contact']}", "#{navigationMenu.getAction2}"));
+        // External Link
+        item = getMenuNaviagtionItem("External Link", null);
+        item.setExternalLink("#{example_messages['external_link']}");
+        item.setTarget("_blank");
+        menu.add(item);
         return menu;
     }
 
-    private static NavigationMenuItem getMenuNaviagtionItem(String label, String action)
-    {
+    private static NavigationMenuItem getMenuNaviagtionItem(String label, String action)
{
         NavigationMenuItem item = new NavigationMenuItem(label, action);
         item.setActionListener("#{navigationMenu.actionListener}");
         item.setValue(label);
         return item;
     }
 
-    public String getAction1()
-    {
+    public String getAction1() {
         return "go_panelnavigation_1";
     }
 
-    public String actionListener(ActionEvent event)
-    {
-        if (event.getComponent() instanceof HtmlCommandNavigationItem)
-        {
-            log.info("ActionListener: " + ((HtmlCommandNavigationItem)event.getComponent()).getValue());
+    public String actionListener(ActionEvent event) {
+        if (event.getComponent() instanceof HtmlCommandNavigationItem) {
+            log.info("ActionListener: " + ((HtmlCommandNavigationItem) event.getComponent()).getValue());
             return getAction1();
         }
-        else
-        {
-            String outcome = (String)((HtmlCommandJSCookMenu) event.getComponent()).getValue();
+        else {
+            String outcome = (String) ((HtmlCommandJSCookMenu) event.getComponent()).getValue();
             log.info("ActionListener: " + outcome);
             return outcome;
         }
     }
 
-    public String getAction2()
-    {
+    public String getAction2() {
         return "go_panelnavigation_2";
     }
 
-    public String getAction3()
-    {
+    public String getAction3() {
         return "go_panelnavigation_3";
     }
 
-    public String goHome()
-    {
-    	return "go_home";
+    public String goHome() {
+        return "go_home";
     }
 
-    public boolean getDisabled()
-    {
+    public boolean getDisabled() {
         return true;
     }
 }

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/examples/simple/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
(original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/resources/org/apache/myfaces/examples/resource/example_messages.properties
Tue May  2 13:56:12 2006
@@ -192,3 +192,4 @@
 panelnav_investor1 = Inverstors Relations
 panelnav_contact = Contact
 
+external_link = http://www.irian.at
\ No newline at end of file

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_4.jsp
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_4.jsp?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_4.jsp (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_4.jsp Tue May 
2 13:56:12 2006
@@ -1,11 +1,10 @@
-
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
 
 <html>
 
-<%@include file="inc/head.inc"%>
+<%@ include file="inc/head.inc" %>
 
 <!--
 /*
@@ -27,43 +26,46 @@
 
 <body>
 <f:view>
-            
+
     <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages"
-		  var="example_messages" />
-    
-    <t:div id="hNav_outer">  
-        <t:panelNavigation2 id="nav1" layout="list" itemClass="off" activeItemClass="on"
openItemClass="on" renderAll="true">
+                  var="example_messages"/>
+
+    <t:div id="hNav_outer">
+        <t:panelNavigation2 id="nav1" layout="list" itemClass="off" activeItemClass="on"
openItemClass="on"
+                            renderAll="true">
             <t:commandNavigation2 value="#{example_messages['panelnav_products']}" style="padding-left:
0px;">
                 <t:commandNavigation2>
                     <f:verbatim>&#8250; </f:verbatim>
-                    <t:outputText value="#{example_messages['panelnav_serach1']}" />
+                    <t:outputText value="#{example_messages['panelnav_serach1']}"/>
                 </t:commandNavigation2>
-                <t:commandNavigation2>
+                <t:commandNavigation2 externalLink="http://www.irian.at" target="_blank">
                     <f:verbatim>&#8250; </f:verbatim>
-                    <t:outputText value="#{example_messages['panelnav_serach_acc1']}"
/>
+                    <t:outputText value="#{example_messages['panelnav_serach_acc1']}"/>
                 </t:commandNavigation2>
-                <t:commandNavigation2 >
+                <t:commandNavigation2>
                     <f:verbatim>&#8250; </f:verbatim>
-                    <t:outputText value="#{example_messages['panelnav_search_adv1']}"
/>
+                    <t:outputText value="#{example_messages['panelnav_search_adv1']}"/>
                 </t:commandNavigation2>
             </t:commandNavigation2>
-            <t:commandNavigation2 value="#{example_messages['panelnav_shop']}"/>
+            <t:commandNavigation2 value="#{example_messages['panelnav_shop']}" externalLink="http://www.yahoo.com"
+                                  target="_blank"/>
             <t:commandNavigation2 value="#{example_messages['panelnav_corporate']}" style="padding-left:
150px;">
                 <t:commandNavigation2>
                     <f:verbatim>&#8250; </f:verbatim>
-                    <t:outputText value="#{example_messages['panelnav_news1']}" />
+                    <t:outputText value="#{example_messages['panelnav_news1']}"/>
                 </t:commandNavigation2>
                 <t:commandNavigation2>
                     <f:verbatim>&#8250; </f:verbatim>
-                    <t:outputText value="#{example_messages['panelnav_investor1']}" />
+                    <t:outputText value="#{example_messages['panelnav_investor1']}"/>
                 </t:commandNavigation2>
             </t:commandNavigation2>
-            <t:commandNavigation2 value="#{example_messages['panelnav_contact']}"/>
+            <t:commandNavigation2 value="#{example_messages['panelnav_contact']}" externalLink="http://mail.yahoo.com"
+                                  target="_blank"/>
         </t:panelNavigation2>
-    </t:div>    
+    </t:div>
 
 </f:view>
-<%@include file="inc/page_footer.jsp"%>
+<%@ include file="inc/page_footer.jsp" %>
 
 </body>
 

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_5.jsp
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_5.jsp?rev=399048&r1=399047&r2=399048&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_5.jsp (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/panelnavigation_5.jsp Tue May 
2 13:56:12 2006
@@ -1,11 +1,10 @@
-
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
 
 <html>
 
-<%@include file="inc/head.inc"%>
+<%@ include file="inc/head.inc" %>
 
 <!--
 /*
@@ -27,60 +26,69 @@
 
 <body>
 <f:view>
-	<f:loadBundle
-		basename="org.apache.myfaces.examples.resource.example_messages"
-		var="example_messages" />
+    <f:loadBundle
+        basename="org.apache.myfaces.examples.resource.example_messages"
+        var="example_messages"/>
     <t:div id="subnavigation_outer">
-    <t:div id="subnavigation">
-        <h:form>
-    <t:panelNavigation2 id="nav1" layout="list" itemClass="mypage" activeItemClass="selected"
openItemClass="selected" >
-		<t:commandNavigation2  value="#{example_messages['panelnav_products']}" action="go_panelnavigation_1"
>
-            <t:commandNavigation2 action="#{navigationMenu.getAction1}" actionListener="#{navigationMenu.actionListener}">
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="#{example_messages['panelnav_serach1']}" />
-            </t:commandNavigation2>
-            <t:commandNavigation2 actionListener="#{navigationMenu.actionListener}" >
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="#{example_messages['panelnav_serach_acc1']}" />
-            </t:commandNavigation2>
-            <t:commandNavigation2 action="go_panelnavigation_1" actionListener="#{navigationMenu.actionListener}"
>
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="#{example_messages['panelnav_search_adv1']}" />
-            </t:commandNavigation2>
-        </t:commandNavigation2>
-        <t:commandNavigation2 value="#{example_messages['panelnav_shop']}" action="go_panelnavigation_1"
actionListener="#{navigationMenu.actionListener}" />
-        <t:commandNavigation2 value="#{example_messages['panelnav_corporate']}"
-                              action="go_panelnavigation_1" actionListener="#{navigationMenu.actionListener}"
-                              activeOnViewIds="/panelnavigation_5.jsp"><!-- comma separated
list of viewIds -->
-            <t:commandNavigation2 action="go_panelnavigation_1" >
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="#{example_messages['panelnav_news1']}" />
-            </t:commandNavigation2>
-            <t:commandNavigation2 action="go_panelnavigation_1" actionListener="#{navigationMenu.actionListener}"
>
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="#{example_messages['panelnav_investor1']}" />
-            </t:commandNavigation2>
-        </t:commandNavigation2>
-        <t:commandNavigation2 value="#{example_messages['panelnav_contact']}" action="go_panelnavigation_1"
actionListener="#{navigationMenu.actionListener}" />
-    </t:panelNavigation2>
-        <f:verbatim><br/></f:verbatim>
-    <t:panelNavigation2 id="nav2" layout="list" styleClass="mypage" >
-        <t:commandNavigation2 value="MyAccount" action="go_panelnavigation_1" >
-            <t:commandNavigation2 action="go_panelnavigation_1" >
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="Login" />
-            </t:commandNavigation2>
-            <t:commandNavigation2 action="go_panelnavigation_1" >
-                <f:verbatim>&#8250; </f:verbatim>
-                <t:outputText value="Register" />
-            </t:commandNavigation2>
-        </t:commandNavigation2>
-    </t:panelNavigation2>
-        </h:form>
-    </t:div>
+        <t:div id="subnavigation">
+            <h:form>
+                <t:panelNavigation2 id="nav1" layout="list" itemClass="mypage" activeItemClass="selected"
+                                    openItemClass="selected">
+                    <t:commandNavigation2 value="#{example_messages['panelnav_products']}"
+                                          action="go_panelnavigation_1">
+                        <t:commandNavigation2 action="#{navigationMenu.getAction1}"
+                                              actionListener="#{navigationMenu.actionListener}">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="#{example_messages['panelnav_serach1']}"/>
+                        </t:commandNavigation2>
+                        <t:commandNavigation2 actionListener="#{navigationMenu.actionListener}">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="#{example_messages['panelnav_serach_acc1']}"/>
+                        </t:commandNavigation2>
+                        <t:commandNavigation2 action="go_panelnavigation_1"
+                                              actionListener="#{navigationMenu.actionListener}">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="#{example_messages['panelnav_search_adv1']}"/>
+                        </t:commandNavigation2>
+                    </t:commandNavigation2>
+                    <t:commandNavigation2 value="#{example_messages['panelnav_shop']}"
action="go_panelnavigation_1"
+                                          actionListener="#{navigationMenu.actionListener}"/>
+                    <t:commandNavigation2 value="#{example_messages['panelnav_corporate']}"
target="new"
+                                          action="go_panelnavigation_1"
+                                          actionListener="#{navigationMenu.actionListener}"
+                                          activeOnViewIds="/panelnavigation_5.jsp"><!--
comma separated list of viewIds
+                        -->
+                        <t:commandNavigation2 action="go_panelnavigation_1">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="#{example_messages['panelnav_news1']}"/>
+                        </t:commandNavigation2>
+                        <t:commandNavigation2 action="go_panelnavigation_1"
+                                              actionListener="#{navigationMenu.actionListener}">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="#{example_messages['panelnav_investor1']}"/>
+                        </t:commandNavigation2>
+                    </t:commandNavigation2>
+                    <t:commandNavigation2 value="#{example_messages['panelnav_contact']}"
action="go_panelnavigation_1"
+                                          actionListener="#{navigationMenu.actionListener}"/>
+                </t:panelNavigation2>
+                <f:verbatim><br/></f:verbatim>
+                <t:panelNavigation2 id="nav2" layout="list" styleClass="mypage">
+                    <t:commandNavigation2 value="MyAccount" action="go_panelnavigation_1">
+                        <t:commandNavigation2 action="go_panelnavigation_1">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="Login"/>
+                        </t:commandNavigation2>
+                        <t:commandNavigation2 action="go_panelnavigation_1">
+                            <f:verbatim>&#8250; </f:verbatim>
+                            <t:outputText value="Register"/>
+                        </t:commandNavigation2>
+                    </t:commandNavigation2>
+                </t:panelNavigation2>
+            </h:form>
+        </t:div>
     </t:div>
 </f:view>
-<%@include file="inc/page_footer.jsp"%>
+<%@ include file="inc/page_footer.jsp" %>
 
 </body>
 



Mime
View raw message