myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r891541 - in /myfaces/trinidad/branches/exhibition_branch: trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ trinidad-examples/trinidad-exhibition/api/ trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/t...
Date Thu, 17 Dec 2009 05:27:41 GMT
Author: arobinson74
Date: Thu Dec 17 05:27:37 2009
New Revision: 891541

URL: http://svn.apache.org/viewvc?rev=891541&view=rev
Log:
Update SVN to the point that I stopped working on this branch

Added:
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
  (with props)
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
  (with props)
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
  (with props)
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java
      - copied, changed from r680616, myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
  (with props)
Removed:
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java
Modified:
    myfaces/trinidad/branches/exhibition_branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/pom.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/build/pom.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/impl/pom.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/pom.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
    myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
Thu Dec 17 05:27:37 2009
@@ -19,7 +19,6 @@
 package org.apache.myfaces.trinidad.model;
 
 import java.beans.IntrospectionException;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -50,7 +49,7 @@
  * <li>returns the path to the node with the current viewId or null if the current
viewId can't be found
  * </ul>
  * <p>
- * Assuming that NavigationTree is a tree of beans with a vieId getter, an
+ * Assuming that NavigationTree is a tree of beans with a viewId getter, an
  * example of creating a MenuModel with this class might look like:
  * <pre><code>
  *     CollectionModel collectionModel = ModelUtils.toCollectionModel(new NavigationTree());

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/pom.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/pom.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/pom.xml
Thu Dec 17 05:27:37 2009
@@ -26,7 +26,6 @@
   
   <modelVersion>4.0.0</modelVersion>
   
-  <groupId>org.apache.myfaces.trinidad</groupId>
   <artifactId>trinidad-exhibition-api</artifactId>
 
   <name>Trinidad Exhibition API</name>

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
Thu Dec 17 05:27:37 2009
@@ -3,11 +3,19 @@
  */
 package org.apache.myfaces.trinidadexhibition.util;
 
+import java.io.IOException;
 import java.text.MessageFormat;
 import java.util.ResourceBundle;
 
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.context.RequestContext;
+
 /**
  *
  * @author Andrew Robinson
@@ -34,11 +42,54 @@
     return evaluateEl(el, Object.class);
   }
   
-  @SuppressWarnings("unchecked")
   public static <T> T evaluateEl(String el, Class<T> returnType)
   {
     FacesContext facesContext = FacesContext.getCurrentInstance();
-    return (T)facesContext.getApplication().getExpressionFactory().createValueExpression(el,
returnType)
+    
+    @SuppressWarnings("unchecked")
+    T t = (T)facesContext.getApplication().getExpressionFactory().createValueExpression(el,
returnType)
       .getValue(facesContext.getELContext());
+    
+    return t;
+  }
+  
+  public static void setExpression(String expression, Object value)
+  {
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    ValueExpression el = facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext,
+      value == null ? Object.class : value.getClass());
+    
+    el.setValue(facesContext.getELContext(), value);
+  }
+  
+  public static void navigateToViewId(String viewId, boolean forceRedirect)
+  {
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
+    ExternalContext externalContext = facesContext.getExternalContext();
+    
+    RequestContext requestContext = RequestContext.getCurrentInstance();
+    
+    if (forceRedirect || requestContext.isPartialRequest(facesContext))
+    {
+      // if PPR, then we need to redirect
+      String path = viewHandler.getActionURL(facesContext, viewId);
+      try
+      {
+        externalContext.redirect(externalContext.encodeActionURL(path));
+      }
+      catch (IOException ex)
+      {
+        throw new FacesException(ex);
+      }
+    }
+    else
+    {
+      // navigate using "normal" JSF view ID navigation
+      //create new view
+      UIViewRoot viewRoot = viewHandler.createView(facesContext, viewId);
+      facesContext.setViewRoot(viewRoot);
+      facesContext.renderResponse();
+    }
   }
 }

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/build/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/build/pom.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/build/pom.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/build/pom.xml
Thu Dec 17 05:27:37 2009
@@ -26,7 +26,6 @@
 
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.myfaces.trinidad</groupId>
   <artifactId>trinidad-exhibition-build</artifactId>
 
   <name>Trinidad Exhibition Build</name>

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/impl/pom.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/impl/pom.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/impl/pom.xml
Thu Dec 17 05:27:37 2009
@@ -26,7 +26,6 @@
   
   <modelVersion>4.0.0</modelVersion>
   
-  <groupId>org.apache.myfaces.trinidad</groupId>
   <artifactId>trinidad-exhibition-impl</artifactId>
 
   <name>Trinidad Exhibition IMPL</name>

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/pom.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/pom.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/pom.xml
Thu Dec 17 05:27:37 2009
@@ -26,7 +26,6 @@
   
   <modelVersion>4.0.0</modelVersion>
   
-  <groupId>org.apache.myfaces.trinidad</groupId>
   <artifactId>trinidad-exhibition</artifactId>
   <packaging>war</packaging>
   
@@ -73,8 +72,9 @@
     
     <dependency>
       <groupId>org.apache.myfaces.trinidad</groupId>
-      <artifactId>trinidad-sandbox-impl</artifactId>
+      <artifactId>sandbox-impl</artifactId>
       <version>${pom.version}</version>
+      <optional>true</optional>
     </dependency>
     
     <dependency>

Added: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java?rev=891541&view=auto
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
(added)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
Thu Dec 17 05:27:37 2009
@@ -0,0 +1,41 @@
+/**
+ * 
+ */
+package org.apache.myfaces.trinidadexhibition.faces;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
+
+/**
+ *
+ * @author Andrew Robinson
+ */
+public class ManagedBean
+{
+  protected FacesContext getFacesContext()
+  {
+    return FacesContext.getCurrentInstance();
+  }
+  
+  protected <T> T evaluateExpression(String expression, Class<T> expectedClass)
+  {
+    return UtilFunctions.evaluateEl(expression, expectedClass);
+  }
+  
+  protected void setExpression(String expression, Object value)
+  {
+    UtilFunctions.setExpression(expression, value);
+  }
+  
+  protected void navigate(String outcome)
+  {
+    navigate(outcome, outcome);
+  }
+  
+  protected void navigate(String action, String outcome)
+  {
+    FacesContext fctx = getFacesContext();
+    fctx.getApplication().getNavigationHandler().handleNavigation(fctx, action, action);
+  }
+}

Propchange: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java?rev=891541&view=auto
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
(added)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
Thu Dec 17 05:27:37 2009
@@ -0,0 +1,65 @@
+/**
+ * 
+ */
+package org.apache.myfaces.trinidadexhibition.faces;
+
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
+
+/**
+ *
+ * @author Andrew Robinson
+ */
+public class NavigationItem
+{
+  private String _messageKey;
+  private String _viewId;
+  
+  public NavigationItem()
+  {
+  }
+  
+  public NavigationItem(String messageKey, String viewId)
+  {
+    _messageKey = messageKey;
+    _viewId = viewId;
+  }
+
+  /**
+   * @return the key
+   */
+  public String getMessageKey()
+  {
+    return _messageKey;
+  }
+
+  /**
+   * @param messageKey the key to set
+   */
+  public void setMessageKey(String messageKey)
+  {
+    _messageKey = messageKey;
+  }
+
+  /**
+   * @return the viewId
+   */
+  public String getViewId()
+  {
+    return _viewId;
+  }
+  
+  /**
+   * @param viewId the viewId to set
+   */
+  public void setViewId(String viewId)
+  {
+    _viewId = viewId;
+  }
+  
+  public void actionPerfomed(ActionEvent event)
+  {
+    UtilFunctions.navigateToViewId(getViewId(), true);
+  }
+}

Propchange: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java?rev=891541&view=auto
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
(added)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
Thu Dec 17 05:27:37 2009
@@ -0,0 +1,50 @@
+/**
+ * 
+ */
+package org.apache.myfaces.trinidadexhibition.faces;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ *
+ * @author Andrew Robinson
+ */
+public class NavigationItemConverter
+  implements Converter
+{
+
+  /**
+   * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
+   * javax.faces.component.UIComponent, java.lang.String)
+   */
+  public NavigationItem getAsObject(FacesContext context, UIComponent component,
+    String value) throws ConverterException
+  {
+    String[] str = value.split("\\s*,\\s*", 2);
+    if (str.length < 2)
+    {
+      throw new ConverterException("NavigationItem string must have a comma to separate the
view ID and the " +
+      		"bundle key");
+    }
+    return new NavigationItem(str[0], str[1]);
+  }
+
+  /**
+   * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
+   * javax.faces.component.UIComponent, java.lang.Object)
+   */
+  public String getAsString(FacesContext context, UIComponent component,
+    Object value) throws ConverterException
+  {
+    if (value instanceof NavigationItem)
+    {
+      NavigationItem item = (NavigationItem)value;
+      return String.format("%s,%s", item.getMessageKey(), item.getViewId());
+    }
+    return value == null ? "" : value.toString();
+  }
+
+}

Propchange: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
Thu Dec 17 05:27:37 2009
@@ -76,6 +76,7 @@
     
     digester.addObjectCreate("taglib", TagLibrary.class);
     digester.addBeanPropertySetter("taglib/short-name", "shortName");
+    digester.addBeanPropertySetter("taglib/display-name", "displayName");
     
     digester.addObjectCreate("taglib/tag", Tag.class);
     digester.addBeanPropertySetter("taglib/tag/name");

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
Thu Dec 17 05:27:37 2009
@@ -28,9 +28,26 @@
 public class TagLibrary
 {
   private String _shortName;
+  private String _displayName;
   private Map<String, Tag> _tags = new HashMap<String, Tag>();
 
   /**
+   * @return the displayName
+   */
+  public String getDisplayName()
+  {
+    return _displayName;
+  }
+
+  /**
+   * @param displayName the displayName to set
+   */
+  public void setDisplayName(String displayName)
+  {
+    _displayName = displayName;
+  }
+
+  /**
    * @return the shortName
    */
   public String getShortName()

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
Thu Dec 17 05:27:37 2009
@@ -5,6 +5,9 @@
 
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.model.ChildPropertyMenuModel;
+import org.apache.myfaces.trinidad.model.MenuModel;
+
 /**
  *
  * @author Andrew Robinson
@@ -19,4 +22,9 @@
     return facesContext.getApplication().getViewHandler().getActionURL(
       facesContext, viewId);
   }
+
+  public static MenuModel asMenuModel(Object value, String childProperty, Object focusRowKey)
+  {
+    return new ChildPropertyMenuModel(value, childProperty, focusRowKey);
+  }
 }

Added: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java?rev=891541&view=auto
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
(added)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
Thu Dec 17 05:27:37 2009
@@ -0,0 +1,66 @@
+/**
+ * 
+ */
+package org.apache.myfaces.trinidadexhibition.webapp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.myfaces.trinidad.model.ChildPropertyMenuModel;
+import org.apache.myfaces.trinidad.model.MenuModel;
+import org.apache.myfaces.trinidadexhibition.metadata.tld.TagLibrary;
+import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
+
+/**
+ *
+ * @author Andrew Robinson
+ */
+public class ComponentIndexBean
+{
+  private Map<String, Integer> _numRowsMap = null;
+  private final MenuModel _tagLibrariesMenuModel;
+  
+  public ComponentIndexBean()
+  {
+    MetaDataBean metaData = getMetaDataBean();
+    _tagLibrariesMenuModel = new ChildPropertyMenuModel(metaData.getTagLibraries().values().toArray(
+      new TagLibrary[metaData.getTagLibraries().size()]), null, null);
+  }
+  
+  /**
+   * @return the tagLibrariesMenuModel
+   */
+  public MenuModel getTagLibrariesMenuModel()
+  {
+    return _tagLibrariesMenuModel;
+  }
+  
+  /**
+   * @return the numRowsMap
+   */
+  public Map<String, Integer> getNumRowsMap()
+  {
+    if (_numRowsMap == null)
+    {
+      synchronized (this)
+      {
+        if (_numRowsMap == null)
+        {
+          _numRowsMap = new HashMap<String, Integer>(3);
+          MetaDataBean metaData = getMetaDataBean();
+          for (String str : new String[] { "tr", "trh", "trs" })
+          {
+            int count = metaData.getTagLibraries().get(str).getTags().size();
+            _numRowsMap.put(str, (int)Math.ceil(count / 3f));
+          }
+        }
+      }
+    }
+    return _numRowsMap;
+  }
+  
+  private MetaDataBean getMetaDataBean()
+  {
+    return UtilFunctions.evaluateEl("#{metaData}", MetaDataBean.class);
+  }
+}

Copied: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java
(from r680616, myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java?p2=myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java&p1=myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java&r1=680616&r2=891541&rev=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java
Thu Dec 17 05:27:37 2009
@@ -3,38 +3,53 @@
  */
 package org.apache.myfaces.trinidadexhibition.webapp;
 
-import javax.faces.model.SelectItem;
+import java.util.List;
 
-import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidadexhibition.faces.ManagedBean;
+import org.apache.myfaces.trinidadexhibition.faces.NavigationItem;
+import org.apache.myfaces.trinidadexhibition.faces.NavigationItemConverter;
 
 /**
  *
  * @author Andrew Robinson
  */
-public class MenusBean
+public class MenusDefinitionBean
+  extends ManagedBean
 {
-  private final SelectItem[] _mainMenuItems;
-  
-  public MenusBean()
+  private NavigationItem[] _mainMenu;
+
+  /**
+   * @return the mainMenu
+   */
+  public NavigationItem[] getMainMenu()
   {
-    _mainMenuItems = new SelectItem[] {
-      buildItem("menus_component_demo"),
-      buildItem("menus_feature_demo"),
-      buildItem("menus_example_apps"),
-      buildItem("menus_resources"),
-    };
+    return _mainMenu;
   }
-  
+
   /**
-   * @return the mainMenuItems
+   * @param mainMenu the mainMenu to set
    */
-  public SelectItem[] getMainMenuItems()
+  public void setMainMenu(NavigationItem[] mainMenu)
+  {
+    _mainMenu = mainMenu;
+  }
+  
+  public void setMainMenuFromString(List<String> items)
   {
-    return _mainMenuItems;
+    setMainMenu(convert(items));
   }
   
-  private SelectItem buildItem(String key)
+  private NavigationItem[] convert(List<String> items)
   {
-    return new SelectItem(key, UtilFunctions.getBundleString(key));
+    NavigationItemConverter converter = new NavigationItemConverter();
+    FacesContext facesContext = getFacesContext();
+    NavigationItem[] navItems = new NavigationItem[items.size()];
+    for (int i = 0; i < navItems.length; ++i)
+    {
+      navItems[i] = converter.getAsObject(facesContext, null, items.get(i));
+    }
+    return navItems;
   }
 }

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
Thu Dec 17 05:27:37 2009
@@ -98,16 +98,19 @@
               <tr:panelPopup
                 triggerType="hover"
                 text="#{msgs.template_main_main_menu_text}">
-                <tr:iterator
+                <tr:navigationPane
+                  hint="list"
                   var="_item"
-                  value="#{menus.mainMenuItems}">
-                  <tr:commandLink
-                    partialSubmit="true"
-                    immediate="true"
-                    text="#{_item.label}"
-                    action="#{_item.value}"
-                    styleClass="popupMenuLink" />
-                </tr:iterator>
+                  value="#{menuDefs.mainMenu}">
+                  <f:facet name="nodeStamp">
+                    <tr:commandNavigationItem
+                      text="#{msgs[_item.messageKey]}"
+                      actionListener="#{_item.actionPerformed}"
+                      disabled="#{_item.viewId eq facesContext.viewRoot.viewId}"
+                      styleClass="popupMenuLink"
+                      immediate="true" />
+                  </f:facet>
+                </tr:navigationPane>
               </tr:panelPopup>
               <tr:panelPopup
                 id="aboutDialog"

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
Thu Dec 17 05:27:37 2009
@@ -43,6 +43,13 @@
     </resource-bundle>
   </application>
   
+  <!-- Converters: -->
+  <converter>
+    <converter-for-class>org.apache.myfaces.trinidadexhibition.faces.NavigationItem</converter-for-class>
+    <converter-class>org.apache.myfaces.trinidadexhibition.faces.NavigationItemConverter</converter-class>
+  </converter>
+  
+  <!-- Managed beans: -->
   <managed-bean>
     <description>
       Bean for collecting faces meta data for use in the demo pages.
@@ -56,12 +63,21 @@
   
   <managed-bean>
     <description>
-      Bean for managing the exhibition menus
+      Bean for managing the exhibition menu definitions
     </description>
-    <managed-bean-name>menus</managed-bean-name>
+    <managed-bean-name>menuDefs</managed-bean-name>
     <managed-bean-class>
-      org.apache.myfaces.trinidadexhibition.webapp.MenusBean
+      org.apache.myfaces.trinidadexhibition.webapp.MenusDefinitionBean
     </managed-bean-class>
+    <managed-property>
+      <property-name>mainMenuFromString</property-name>
+      <list-entries>
+        <value>menus_component_demo, /components/index.xhtml</value>
+        <value>menus_feature_demo, /features/index.xhtml</value>
+        <value>menus_example_apps, /examples/index.xhtml</value>
+        <value>menus_resources, /resources.xhtml</value>
+      </list-entries>
+    </managed-property>
   </managed-bean>
 
   <managed-bean>
@@ -77,7 +93,7 @@
 
   <managed-bean>
     <description>
-      Bean for the component index page
+      Bean for the component index page meta data
     </description>
     <managed-bean-name>componentIndex</managed-bean-name>
     <managed-bean-class>
@@ -88,6 +104,10 @@
   
   <navigation-rule>
     <!-- Global rules -->
+    <navigation-case>
+      <from-outcome>components_index</from-outcome>
+      <to-view-id>/components/index.xhtml</to-view-id>
+    </navigation-case>
 
     <!-- Main menu -->
     <navigation-case>

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
Thu Dec 17 05:27:37 2009
@@ -8,4 +8,12 @@
     <function-class>org.apache.myfaces.trinidadexhibition.util.Functions</function-class>
     <function-signature>java.lang.String getActionURL(java.lang.String)</function-signature>
   </function>
+  <function>
+    <function-name>asMenuModel</function-name>
+    <function-class>org.apache.myfaces.trinidadexhibition.util.Functions</function-class>
+    <function-signature>
+      org.apache.myfaces.trinidad.model.MenuModel asMenuModel(java.lang.Object,
+        java.lang.String, java.lang.Object)
+    </function-signature>
+  </function>
 </facelet-taglib>
\ No newline at end of file

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
Thu Dec 17 05:27:37 2009
@@ -33,20 +33,14 @@
     <ui:composition template="/WEB-INF/facelets/templates/main.xhtml">
       <ui:define name="body">
         <tr:panelTabbed>
-          <tr:showDetailItem
-            text="#{msgs.component_index_tab_tr}">
-            <tr:panelList
-              rows="#{componentIndex.numRowsMap['tr']}">
-              <tr:goLink 
-                
-            </tr:panelList>
-          </tr:showDetailItem>
-          <tr:showDetailItem
-            text="#{msgs.component_index_tab_trh}">
-          </tr:showDetailItem>
-          <tr:showDetailItem
-            text="#{msgs.component_index_tab_trs}">
-          </tr:showDetailItem>          
+          <!-- Use a for each loop since panelTabbed does not support flattened component
-->
+          <c:forEach
+            var="_tagLibrary"
+            items="#{tagLibrariesMenuModel}">
+            <tr:showDetailItem
+              text="#{_tagLibrary.displayName} - (#{_tagLibrary.shortName})">
+            </tr:showDetailItem>
+          </c:forEach>
         </tr:panelTabbed>
       </ui:define>
     </ui:composition>

Modified: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml?rev=891541&r1=891540&r2=891541&view=diff
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
(original)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
Thu Dec 17 05:27:37 2009
@@ -31,26 +31,18 @@
   <body>
     <ui:composition template="/WEB-INF/facelets/templates/main.xhtml">
       <ui:define name="body">
-        Tree: <tr:outputText value="#{metaData.tagLibraries['tr'].tags['tree'].description}"
escape="false" /><br/>
-        Tree component:
-          <tr:outputText
-            value="#{metaData.facesConfigData.components['org.apache.myfaces.trinidad.CoreTree'].description}"
-            escape="false" /><br/>
-        forEach: <tr:outputText value="#{metaData.tagLibraries['tr'].tags['forEach'].description}"
escape="false" /><br/>
-        
-        <tr:panelBox background="dark">
-          Test1
-        </tr:panelBox>
-        <tr:panelBox background="medium">
-          Test2
-        </tr:panelBox>
-        <tr:panelBox background="light">
-          Test3
-        </tr:panelBox>
-        <tr:panelBox background="transparent">
-          Test4
-        </tr:panelBox>
-        #{prefs.skinFamily}
+        <tr:navigationPane
+          hint="bar"
+          var="_item"
+          value="#{menuDefs.mainMenu}">
+          <f:facet name="nodeStamp">
+            <tr:commandNavigationItem
+              text="#{msgs[_item.messageKey]}"
+              actionListener="#{_item.actionPerfomed}"
+              immediate="true" />
+          </f:facet>
+        </tr:navigationPane>
+        TODO
       </ui:define>
     </ui:composition>
   </body>

Added: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml?rev=891541&view=auto
==============================================================================
--- myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
(added)
+++ myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
Thu Dec 17 05:27:37 2009
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+  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.
+-->
+<html
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:c="http://java.sun.com/jstl/core"
+  xmlns:f="http://java.sun.com/jsf/core"
+  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+  xmlns:h="http://java.sun.com/jsf/html"
+  xmlns:ui="http://java.sun.com/jsf/facelets"
+  xmlns:tr="http://myfaces.apache.org/trinidad"
+  xmlns:trh="http://myfaces.apache.org/trinidad/html"
+  xmlns:tre="http://myfaces.apache.org/trinidad/exhibition">
+  <body>
+    <ui:composition template="/WEB-INF/facelets/templates/main.xhtml">
+      <ui:define name="body">
+        <tr:navigationPane
+          hint="bar"
+          var="_item"
+          value="#{menuDefs.mainMenu}">
+          <f:facet name="nodeStamp">
+            <tr:commandNavigationItem
+              text="#{msgs[_item.messageKey]}"
+              actionListener="#{_item.actionPerfomed}"
+              immediate="true" />
+          </f:facet>
+        </tr:navigationPane>
+        <tr:navigationPane
+          hint="list">
+          <tr:commandNavigationItem
+            text="Apache MyFaces"
+            destination="http://myfaces.apache.org/" />
+          <tr:commandNavigationItem
+            text="Apache MyFaces Trinidad"
+            destination="http://myfaces.apache.org/trinidad/index.html" />
+        </tr:navigationPane>
+      </ui:define>
+    </ui:composition>
+  </body>
+</html>

Propchange: myfaces/trinidad/branches/exhibition_branch/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message