You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:38 UTC
[myfaces-trinidad] 04/04: Update SVN to the point that I stopped
working on this branch
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch exhibition_branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git
commit e4a0095b21ee65c23817f90efe0114e26a85e3a7
Author: Andrew Robinson <ar...@apache.org>
AuthorDate: Thu Dec 17 05:27:37 2009 +0000
Update SVN to the point that I stopped working on this branch
---
.../trinidad/model/ViewIdPropertyMenuModel.java | 3 +-
trinidad-examples/trinidad-exhibition/api/pom.xml | 1 -
.../trinidadexhibition/util/UtilFunctions.java | 55 +++++++++++++++++-
.../trinidad-exhibition/build/pom.xml | 1 -
trinidad-examples/trinidad-exhibition/impl/pom.xml | 1 -
trinidad-examples/trinidad-exhibition/web/pom.xml | 4 +-
.../trinidadexhibition/faces/ManagedBean.java | 41 ++++++++++++++
.../trinidadexhibition/faces/NavigationItem.java | 65 ++++++++++++++++++++++
.../faces/NavigationItemConverter.java | 50 +++++++++++++++++
.../trinidadexhibition/metadata/MetaDataUtils.java | 1 +
.../metadata/tld/TagLibrary.java | 17 ++++++
.../myfaces/trinidadexhibition/util/Functions.java | 8 +++
.../webapp/ComponentIndexBean.java | 26 ++++++++-
.../trinidadexhibition/webapp/MenusBean.java | 40 -------------
.../webapp/MenusDefinitionBean.java | 55 ++++++++++++++++++
.../webapp/WEB-INF/facelets/templates/main.xhtml | 21 ++++---
.../web/src/main/webapp/WEB-INF/faces-config.xml | 28 ++++++++--
.../web/src/main/webapp/WEB-INF/trfn.taglib.xml | 8 +++
.../web/src/main/webapp/components/index.xhtml | 22 +++-----
.../web/src/main/webapp/index.xhtml | 32 ++++-------
.../main/webapp/{index.xhtml => resources.xhtml} | 40 ++++++-------
21 files changed, 402 insertions(+), 117 deletions(-)
diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
index 16b4c13..ae9b499 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ViewIdPropertyMenuModel.java
@@ -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 @@ import org.apache.myfaces.trinidad.logging.TrinidadLogger;
* <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());
diff --git a/trinidad-examples/trinidad-exhibition/api/pom.xml b/trinidad-examples/trinidad-exhibition/api/pom.xml
index dfdc9bb..b407ff5 100644
--- a/trinidad-examples/trinidad-exhibition/api/pom.xml
+++ b/trinidad-examples/trinidad-exhibition/api/pom.xml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java b/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
index 6efcb55..7f7767c 100644
--- a/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
+++ b/trinidad-examples/trinidad-exhibition/api/src/main/java/org/apache/myfaces/trinidadexhibition/util/UtilFunctions.java
@@ -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 @@ public final class UtilFunctions
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();
+ }
}
}
diff --git a/trinidad-examples/trinidad-exhibition/build/pom.xml b/trinidad-examples/trinidad-exhibition/build/pom.xml
index 2c7c3e1..7da0e3f 100644
--- a/trinidad-examples/trinidad-exhibition/build/pom.xml
+++ b/trinidad-examples/trinidad-exhibition/build/pom.xml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/impl/pom.xml b/trinidad-examples/trinidad-exhibition/impl/pom.xml
index c26bd0b..119f5df 100644
--- a/trinidad-examples/trinidad-exhibition/impl/pom.xml
+++ b/trinidad-examples/trinidad-exhibition/impl/pom.xml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/web/pom.xml b/trinidad-examples/trinidad-exhibition/web/pom.xml
index 020c1dd..0e2c2cb 100644
--- a/trinidad-examples/trinidad-exhibition/web/pom.xml
+++ b/trinidad-examples/trinidad-exhibition/web/pom.xml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
new file mode 100644
index 0000000..87b589a
--- /dev/null
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/ManagedBean.java
@@ -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);
+ }
+}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
new file mode 100644
index 0000000..b4b70b5
--- /dev/null
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItem.java
@@ -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);
+ }
+}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
new file mode 100644
index 0000000..df3cfeb
--- /dev/null
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/faces/NavigationItemConverter.java
@@ -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();
+ }
+
+}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
index 962f226..f46fb53 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/MetaDataUtils.java
@@ -76,6 +76,7 @@ public final class MetaDataUtils
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");
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
index 95cc400..16ff999 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/metadata/tld/TagLibrary.java
@@ -28,9 +28,26 @@ import java.util.Map;
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()
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
index c5c6663..af5bed4 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/util/Functions.java
@@ -5,6 +5,9 @@ package org.apache.myfaces.trinidadexhibition.util;
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 @@ public final class Functions
return facesContext.getApplication().getViewHandler().getActionURL(
facesContext, viewId);
}
+
+ public static MenuModel asMenuModel(Object value, String childProperty, Object focusRowKey)
+ {
+ return new ChildPropertyMenuModel(value, childProperty, focusRowKey);
+ }
}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
index b63c5a4..fbf1635 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/ComponentIndexBean.java
@@ -6,6 +6,9 @@ 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;
/**
@@ -15,6 +18,22 @@ import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
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
@@ -28,7 +47,7 @@ public class ComponentIndexBean
if (_numRowsMap == null)
{
_numRowsMap = new HashMap<String, Integer>(3);
- MetaDataBean metaData = UtilFunctions.evaluateEl("#{metaData}", MetaDataBean.class);
+ MetaDataBean metaData = getMetaDataBean();
for (String str : new String[] { "tr", "trh", "trs" })
{
int count = metaData.getTagLibraries().get(str).getTags().size();
@@ -39,4 +58,9 @@ public class ComponentIndexBean
}
return _numRowsMap;
}
+
+ private MetaDataBean getMetaDataBean()
+ {
+ return UtilFunctions.evaluateEl("#{metaData}", MetaDataBean.class);
+ }
}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java
deleted file mode 100644
index ef69aa2..0000000
--- a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusBean.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- */
-package org.apache.myfaces.trinidadexhibition.webapp;
-
-import javax.faces.model.SelectItem;
-
-import org.apache.myfaces.trinidadexhibition.util.UtilFunctions;
-
-/**
- *
- * @author Andrew Robinson
- */
-public class MenusBean
-{
- private final SelectItem[] _mainMenuItems;
-
- public MenusBean()
- {
- _mainMenuItems = new SelectItem[] {
- buildItem("menus_component_demo"),
- buildItem("menus_feature_demo"),
- buildItem("menus_example_apps"),
- buildItem("menus_resources"),
- };
- }
-
- /**
- * @return the mainMenuItems
- */
- public SelectItem[] getMainMenuItems()
- {
- return _mainMenuItems;
- }
-
- private SelectItem buildItem(String key)
- {
- return new SelectItem(key, UtilFunctions.getBundleString(key));
- }
-}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java
new file mode 100644
index 0000000..e7f9ebc
--- /dev/null
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/java/org/apache/myfaces/trinidadexhibition/webapp/MenusDefinitionBean.java
@@ -0,0 +1,55 @@
+/**
+ *
+ */
+package org.apache.myfaces.trinidadexhibition.webapp;
+
+import java.util.List;
+
+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 MenusDefinitionBean
+ extends ManagedBean
+{
+ private NavigationItem[] _mainMenu;
+
+ /**
+ * @return the mainMenu
+ */
+ public NavigationItem[] getMainMenu()
+ {
+ return _mainMenu;
+ }
+
+ /**
+ * @param mainMenu the mainMenu to set
+ */
+ public void setMainMenu(NavigationItem[] mainMenu)
+ {
+ _mainMenu = mainMenu;
+ }
+
+ public void setMainMenuFromString(List<String> items)
+ {
+ setMainMenu(convert(items));
+ }
+
+ private NavigationItem[] convert(List<String> items)
+ {
+ 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;
+ }
+}
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
index 4c4221d..637905d 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/facelets/templates/main.xhtml
@@ -98,16 +98,19 @@ DIV.templateBody {
<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"
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
index f3bb6c0..61831e6 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/faces-config.xml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
index 1d51aff..77ceaa5 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/WEB-INF/trfn.taglib.xml
@@ -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
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
index 029a586..47f3ce4 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/components/index.xhtml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
index fb6cc71..22be4ca 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
@@ -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>
diff --git a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
similarity index 65%
copy from trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
copy to trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
index fb6cc71..138be45 100644
--- a/trinidad-examples/trinidad-exhibition/web/src/main/webapp/index.xhtml
+++ b/trinidad-examples/trinidad-exhibition/web/src/main/webapp/resources.xhtml
@@ -31,26 +31,26 @@
<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>
+ <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>
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.