You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/05/26 22:20:58 UTC
svn commit: r948569 [1/12] - in /myfaces/portlet-bridge/core/trunk: ./
api/src/main/java/javax/portlet/faces/component/ examples/
examples/carstore/ examples/carstore/src/ examples/carstore/src/main/
examples/carstore/src/main/java/ examples/carstore/s...
Author: mfreedman
Date: Wed May 26 20:20:51 2010
New Revision: 948569
URL: http://svn.apache.org/viewvc?rev=948569&view=rev
Log:
PORTLETBRIDGE-142: Facelets 1.1.4 doesn't work with Bridge 1.0 PortletNamingContainerUIViewRoot
Also removed the demo example and added a bunch of the original Mojarra examples
Added:
myfaces/portlet-bridge/core/trunk/examples/carstore/
myfaces/portlet-bridge/core/trunk/examples/carstore/pom.xml
myfaces/portlet-bridge/core/trunk/examples/carstore/src/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarBean.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarCustomizer.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarStore.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CreditCardConverter.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CustomerBean.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/FirstNameChanged.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/FormatValidator.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/FormatValidatorTag.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/MessageFactory.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Common_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Custom.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Deluxe.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Jalopy.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Jalopy_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Jalopy_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Jalopy_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Jalopy_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Luxury.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Luxury_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Luxury_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Luxury_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Luxury_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Messages.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Messages_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Messages_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Messages_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/OptionPrices.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Performance.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Resources.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Resources_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Resources_en.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Resources_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Resources_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Roadster.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Roadster_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Roadster_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Roadster_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Roadster_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/SUV.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/SUV_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/SUV_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/SUV_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/SUV_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/bundles/Standard.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/package.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/portlet/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/portlet/faces/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/portlet/faces/examples/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/portlet/faces/examples/renderkit/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/org/apache/myfaces/portlet/faces/examples/renderkit/AreaRenderer.java
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Common_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Custom.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Deluxe.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Jalopy.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Jalopy_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Jalopy_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Jalopy_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Jalopy_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Luxury.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Luxury_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Luxury_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Luxury_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Luxury_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Messages.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Messages_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Messages_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Messages_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/OptionPrices.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Performance.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Resources.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Resources_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Resources_en.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Resources_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Resources_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Roadster.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Roadster_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Roadster_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Roadster_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Roadster_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/SUV.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/SUV_de.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/SUV_es.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/SUV_fr.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/SUV_options.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/resources/carstore/bundles/Standard.properties
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/carstore.tld
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/bottomMatter.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/carDetail.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/chooseLocale.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/confirmChoices.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/customerInfo.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/finish.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/150x126_Jalopy.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/150x126_Luxury.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/150x126_Roadster.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/150x126_SUV.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/200x168_Jalopy.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/200x168_Luxury.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/200x168_Roadster.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/200x168_SUV.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/BuyBtn.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/FinishBtn.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/MoreBtn.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/cardemo.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/current.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/duke.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/world.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/world_france.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/world_germany.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/world_namer.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/images/world_samer.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/index.jsp.bak
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/allclasses-frame.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/allclasses-noframe.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/beans.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/CarBean.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/CarCustomizer.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/CarStore.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/CreditCardConverter.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/CustomerBean.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/FirstNameChanged.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/FormatValidator.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/FormatValidatorTag.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/MessageFactory.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/package-frame.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/package-summary.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/carstore/package-tree.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/constant-values.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/data.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/deprecated-list.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/flow.jpg (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/help-doc.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/index-all.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/index.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/overview-tree.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/package-list
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/resources/
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/resources/inherit.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/serialized-form.html
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/javadocs/stylesheet.css
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/optionsPanel.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/storeFront.jsp
myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/webapp/stylesheet.css
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/pom.xml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/java/guess/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/java/guess/NumberBean.java
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/java/guess/facelets/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/java/guess/facelets/PortletFaceletViewHandler.java
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/guess.xhtml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/index.html
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/response.xhtml
myfaces/portlet-bridge/core/trunk/examples/facelets-guess/src/main/webapp/template.xhtml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/pom.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/java/guessNumber/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/java/guessNumber/MessageFactory.java
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/java/guessNumber/UserNumberBean.java
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/greeting.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/index.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/response.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumber/src/main/webapp/wave.med.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/pom.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/guessNumber/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/guessNumber/MessageFactory.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/guessNumber/UserNumberBean.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/myfaces/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/myfaces/portlet/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/myfaces/portlet/faces/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/myfaces/portlet/faces/application/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/java/org/apache/myfaces/portlet/faces/application/BridgeMojarraRenderFilter.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/greeting.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/index.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/response.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMojarraFilter/src/main/webapp/wave.med.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/pom.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/guessNumber/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/guessNumber/MessageFactory.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/guessNumber/UserNumberBean.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/myfaces/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/myfaces/portlet/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/myfaces/portlet/faces/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/myfaces/portlet/faces/application/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/java/org/apache/myfaces/portlet/faces/application/BridgeMyFacesRenderFilter.java
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/greeting.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/index.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/response.jsp
myfaces/portlet-bridge/core/trunk/examples/guessNumberMyFacesFilter/src/main/webapp/wave.med.gif (with props)
myfaces/portlet-bridge/core/trunk/examples/helloDuke/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/pom.xml
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/java/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/java/helloDuke/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/java/helloDuke/UserNameBean.java
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/resources/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/resources/META-INF/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/resources/META-INF/NOTICE
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/WEB-INF/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/WEB-INF/faces-config.xml
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/WEB-INF/portlet.xml
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/WEB-INF/web.xml
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/error.jsp
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/greeting.jsp
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/index.html
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/response.jsp
myfaces/portlet-bridge/core/trunk/examples/helloDuke/src/main/webapp/helloDuke/wave.med.gif (with props)
Modified:
myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java
myfaces/portlet-bridge/core/trunk/examples/demo/pom.xml
myfaces/portlet-bridge/core/trunk/examples/pom.xml
myfaces/portlet-bridge/core/trunk/pom.xml
Modified: myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java?rev=948569&r1=948568&r2=948569&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java (original)
+++ myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/component/PortletNamingContainerUIViewRoot.java Wed May 26 20:20:51 2010
@@ -34,7 +34,7 @@ public class PortletNamingContainerUIVie
//TODO: This should be regenerated each time this is modified. Can this be added to maven?
private static final long serialVersionUID = -4524288011655837711L;
- private static final String PORTLET_ENCODED_NAMESPACE_ID = Bridge.BRIDGE_PACKAGE_PREFIX + "PortletEncodedNamespaceId";
+ private static final String PORTLET_NAMESPACE_ID_PREFIX = "_jpfcpncuivr_";
// Assumes that first use of the UIViewRoot always occurs in a render as portlet namespace
// is only available during a render. If this isn't the case we disable use of the
@@ -42,8 +42,6 @@ public class PortletNamingContainerUIVie
public PortletNamingContainerUIViewRoot()
{
super();
-
- getAttributes().put(PORTLET_ENCODED_NAMESPACE_ID, Boolean.FALSE);
}
/**
@@ -55,12 +53,12 @@ public class PortletNamingContainerUIVie
@Override
public String getContainerClientId(FacesContext context)
{
- if (BridgeUtil.isPortletRequest() && ((Boolean) this.getAttributes().get(PORTLET_ENCODED_NAMESPACE_ID)).equals(Boolean.TRUE))
+ if (BridgeUtil.isPortletRequest())
{
- // Some impls (Facelets don't set an id on the UIViewRoot) -- so do so now
- if (((Boolean) this.getAttributes().get(PORTLET_ENCODED_NAMESPACE_ID)).equals(Boolean.FALSE))
+ // Some impls (Facelets don't set an id on the UIViewRoot) -- Also handles the action case
+ if ((this.getId() == null || !this.getId().startsWith(PORTLET_NAMESPACE_ID_PREFIX)))
{
- setId(null); // setId has a default for this
+ setId(this.getId()); // setId can handle the null
}
return super.getContainerClientId(context);
}
@@ -77,16 +75,14 @@ public class PortletNamingContainerUIVie
{
// Turns out that in Facelets the UIViewRoot doesn't seem to have its id set -- i.e. its null
- // So recognize null and change to ""
+ // So recognize null or the temp one we set and change to ""
if (id == null)
{
- id = "";
+ id = createUniqueId();
}
-
- Boolean encoded = Boolean.FALSE;
/* Can only calculate the namespace during a render (in portlet 1.0) */
- if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE)
+ if (!id.startsWith(PORTLET_NAMESPACE_ID_PREFIX) && BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE)
{
// Turns out some Faces impls (the RI) , on restoreView, manually sets the id from
// the extracted state prior to telling the component to restore itself from this state.
@@ -95,16 +91,9 @@ public class PortletNamingContainerUIVie
// encoded id until the restore overwrites. To avoid this -- first test if
// its already encoded and don't re-encode.
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
- String namespace = ec.encodeNamespace("");
- if (!id.startsWith(namespace))
- {
- id = namespace + "_" + id;
- }
- // now indicate that this id is encoded
- encoded = Boolean.TRUE;
+ id = PORTLET_NAMESPACE_ID_PREFIX + ec.encodeNamespace("") + "_" + id;
}
-
- getAttributes().put(PORTLET_ENCODED_NAMESPACE_ID, encoded);
+
}
super.setId(id);
}
Added: myfaces/portlet-bridge/core/trunk/examples/carstore/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/carstore/pom.xml?rev=948569&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/carstore/pom.xml (added)
+++ myfaces/portlet-bridge/core/trunk/examples/carstore/pom.xml Wed May 26 20:20:51 2010
@@ -0,0 +1,279 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>MyFaces Portlet Bridge CarStore Demo</name>
+ <artifactId>portlet-bridge-carstore</artifactId>
+ <packaging>war</packaging>
+
+ <parent>
+ <groupId>org.apache.myfaces.portlet-bridge</groupId>
+ <artifactId>portlet-bridge-examples</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <!-- Blueprints -->
+ <dependency>
+ <groupId>com.sun.javaee.blueprints</groupId>
+ <artifactId>bp-ui-simple</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>portlet-api</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>portlet-bridge-impl</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jdev-plugin</artifactId>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <configuration>
+ <libraries>
+ <library>JSP Runtime</library>
+ </libraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>pluto-assemble</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warName>${pom.artifactId}-pluto-${pom.version}</warName>
+ <outputDirectory>${project.build.directory}/../../assembly/target/webapp</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- sets up the webapp for deployment to pluto "mvn clean install -Ppluto" -->
+ <profile>
+ <id>pluto</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>1.1.6</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>pluto2</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>2.0.0</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- To run jetty, issue "mvn clean -PjettyConfig jetty:run" -->
+ <profile>
+ <id>jettyConfig</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.bekk.boss</groupId>
+ <artifactId>maven-jetty-pluto-embedded</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml>
+ <systemProperties>
+ <systemProperty>
+ <name>org.apache.pluto.embedded.portletIds</name>
+ <value>portlet-bridge-carstore</value>
+ </systemProperty>
+ </systemProperties>
+
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
+ <!-- By default the war examples uses mojarra and packages for a nonjavaee environment (includes the Faces jars)! :) -->
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have Mojarra packaged in the war: -->
+ <profile>
+ <id>mojarra-nonjavaee</id>
+ <activation>
+ <property>
+ <name>!jsf</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${mojarra.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+ <!-- If you are running in a JavaEE environment (i.e. Faces is already deployed) and hence don't need to have Mojarra packaged in the war: -->
+ <!-- mvn install -Djsf=mojarra-nonjavaee -->
+ <profile>
+ <id>mojarra</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>mojarra-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsf_implementation>JSF-RI</jsf_implementation>
+ </properties>
+ </profile>
+
+
+ <!-- To use this examples using the MyFacesImplementation: mvn clean install -Djsf=myfaces -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-javaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-javaee</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+
+
+ <!-- If you are running in a nonJavaEE environment (i.e. Faces isn't already deployed) and hence need to have MyFaces packaged in the war: -->
+ <!-- mvn install -Djsf=myfaces-nonjavaee -->
+ <!-- Note: currently carstore doesn't work properly in a myfaces environment -->
+ <profile>
+ <id>myfaces-nonjavaee</id>
+ <activation>
+ <property>
+ <name>jsf</name>
+ <value>myfaces-nonjavaee</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
Added: myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarBean.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarBean.java?rev=948569&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarBean.java (added)
+++ myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarBean.java Wed May 26 20:20:51 2010
@@ -0,0 +1,575 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt.
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * [Name of File] [ver.__] [Date]
+ *
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UISelectItems;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.model.SelectItem;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.List;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * <p>This bean encapsulates a car model, including pricing and package
+ * choices. The system allows the user to customize the properties of
+ * this bean with the help of the {@link CarCustomizer}.</p>
+ * <p/>
+ * <h3>Data Access</h3>
+ * <p/>
+ * <p>This is the only bean in the system that has complicated access to
+ * the persistent store of data. In the present implementation, this
+ * persistent store is in <code>ResourceBundle</code> instances.</p>
+ * <p/>
+ * <p>There are three data source <code>ResourceBundle</code> files
+ * used:</p>
+ * <p/>
+ * <ol>
+ * <p/>
+ * <li><p><code><ModelName></code></p>
+ * <p/>
+ * <p>This contains the localized content for this model. There
+ * is a variant of this file for each supported locale, for
+ * example, <code>Jalopy_de.properties</code></p>
+ * <p/>
+ * </li>
+ * <p/>
+ * <li><p><code><Common_properties></code></p>
+ * <p/>
+ * <p>This contains the localized content common to all
+ * models.</p>
+ * <p/>
+ * </li>
+ * <p/>
+ * <li><p><code><ModelName_options></code></p>
+ * <p/>
+ * <p>This contains the non-localized content for this model,
+ * including the non-localized options. There is only one
+ * variant of this file for all locales for example,
+ * <code>Jalopy_options.properties</code></p>
+ * <p/>
+ * </li>
+ * <p/>
+ * </ol>
+ * <p/>
+ * <p>All files conform to the following convention:</p>
+ * <p/>
+ * <code><pre>
+ * key
+ * key_componentType
+ * key_valueType
+ * </pre></code>
+ * <p/>
+ * <p>Where <code>key</code> is the name of an attribute of this car.
+ * For example, <code>basePrice</code>, or <code>description</code>.
+ * <code>key_componentType</code> is the component type of the
+ * <code>UIComponent</code> subclass to be used to represent this
+ * attribute in the page, for example <code>SelectManyMenu</code>.
+ * <code>key_valueType</code> is the data type of the value of the
+ * <code>UIComponent</code>, for example <code>java.lang.Integer</code>.
+ * For all non-String valueTypes.</p>
+ * <p/>
+ * <p>When the bean is instantiated, we load both of the above
+ * properties files and iterate over the keys in each one. For each
+ * key, we look at the <code>componentType</code> and ask the
+ * <code>Application</code> to create a component of that type. We
+ * store that <code>UIComponent</code> instance in our
+ * <code>components</code> <code>Map</code> under the name
+ * <code>key</code>. We look at the <code>valueType</code> for the
+ * <code>key</code>. For non <code>java.lang.String</code> types, we
+ * ask the <code>Application</code> for a <code>Converter</code>
+ * instance for that class. If found, we use it to convert the value
+ * for the <code>key</code> to the appropriate type and store that as
+ * the <code>value</code> of the <code>UIComponent</code> instance.</p>
+ */
+
+public class CarBean {
+
+ private static final Logger LOGGER = Logger.getLogger("carstore");
+
+ /**
+ * <p>The message identifier of the Message to be created if
+ * the conversion fails. The message format string for this
+ * message may optionally include a <code>{0}</code>
+ * placeholder, which will be replaced by the object and value.</p>
+ */
+ public static final String CONVERTER_ERROR_MESSAGE_ID =
+ "carstore.Converter_Error";
+
+ //
+ // Relationship Instance Variables
+ //
+
+ /** Localized labels */
+
+ private ResourceBundle resources = null;
+
+ /** Price data */
+ private ResourceBundle priceData = null;
+
+ /**
+ * Keys: String attribute name, such as engine. Values: UIComponent
+ * for the attribute
+ */
+
+ private Map<String, UIComponent> components = null;
+
+ /**
+ * Keys: String attribute name, such as engine. Values: String value
+ * of the component named by key in our components Map.
+ */
+
+ private Map<String,Object> attributes = null;
+
+ //
+ // Constructors
+ //
+
+ public CarBean() {
+ this.init(CarStore.DEFAULT_MODEL_PROPERTIES);
+ }
+
+
+ public CarBean(String bundleName) {
+ this.init(bundleName);
+ }
+
+
+ /**
+ * <p>Initialize our components <code>Map</code> as described in the
+ * class documentation.</p>
+ * <p/>
+ * <p>Create a wrapper <code>Map</code> around the components
+ * <code>Map</code> that exposes the String converted value of each
+ * component.</p>
+ *
+ * @param bundleName the resource bundle name
+ */
+ private void init(String bundleName) {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ components = new HashMap<String, UIComponent>();
+
+ // load the labels
+ resources =
+ ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+ ".bundles.Resources",
+ context.getViewRoot().getLocale());
+
+ // load the prices
+ priceData = ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+ ".bundles.OptionPrices");
+
+ // populate the locale-specific information
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Loading bundle: " + bundleName + ".");
+ }
+ ResourceBundle data = ResourceBundle.getBundle(bundleName,
+ context.getViewRoot().getLocale());
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Bundle " + bundleName +
+ " loaded. Reading properties...");
+ }
+ initComponentsFromProperties(context, data);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("done.");
+ }
+
+ // populate the non-locale-specific information common to all cars
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Loading bundle: Common_options.");
+ }
+ data = ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+ ".bundles.Common_options");
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Bundle Common_options loaded. Reading properties...");
+ }
+ initComponentsFromProperties(context, data);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("done.");
+ }
+
+ // populate the non-locale-specific information specific to each car
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Loading bundle: " + bundleName + "_options.");
+ }
+ data = ResourceBundle.getBundle(bundleName + "_options");
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Bundle " + bundleName +
+ "_options loaded. Reading properties...");
+ }
+ initComponentsFromProperties(context, data);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("done.");
+ }
+
+ // create a read-only Map exposing the values of all of our
+ // components.
+ attributes =
+ new Map() {
+ public void clear() {
+ CarBean.this.components.clear();
+ }
+
+
+ public boolean containsKey(Object key) {
+ return CarBean.this.components.containsKey(key);
+ }
+
+
+ public boolean containsValue(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public java.util.Set<Map.Entry<String,Object>> entrySet() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public boolean equals(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Object get(Object key) {
+ UIComponent component;
+ Converter converter = null;
+ Object result = null;
+ if (null == key) {
+ return null;
+ }
+ if (null != (component =
+ CarBean.this.components.get(key))) {
+ // if this component can have a Converter
+ if (component instanceof ValueHolder) {
+ // try to get it
+ converter = ((ValueHolder) component).
+ getConverter();
+ result = ((ValueHolder) component).getValue();
+ }
+
+ // if we do have a value
+ if (null != result) {
+ // and we do have a converter
+ if (null != converter) {
+ // convert the value to String
+ result = converter.
+ getAsString(FacesContext.
+ getCurrentInstance(),
+ component, result);
+ }
+ }
+ }
+ return result;
+ }
+
+
+ public int hashCode() {
+ return CarBean.this.components.hashCode();
+ }
+
+
+ public boolean isEmpty() {
+ return CarBean.this.components.isEmpty();
+ }
+
+
+ public java.util.Set<String> keySet() {
+ return CarBean.this.components.keySet();
+ }
+
+
+ public Object put(Object k, Object v) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void putAll(Map t) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Object remove(Object k) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public int size() {
+ return CarBean.this.components.size();
+ }
+
+
+ public Collection<Object> values() {
+ ArrayList<Object> result =
+ new ArrayList<Object>(this.size());
+ for (Object o : keySet()) {
+ result.add(get(o));
+ }
+ return result;
+ }
+ };
+
+
+ }
+
+
+ /**
+ * <p>For each entry in data, create component and cause it to be
+ * populated with values.</p>
+ * @param context the <code>FacesContext</code> for the current request
+ * @param data a ResourceBundle
+ */
+ private void initComponentsFromProperties(FacesContext context,
+ ResourceBundle data) {
+
+ // populate the map
+ for (Enumeration<String> keys = data.getKeys(); keys.hasMoreElements();) {
+
+ String key = keys.nextElement();
+ if (key == null) {
+ continue;
+ }
+ // skip secondary keys.
+ if (key.contains("_")) {
+ continue;
+ }
+ String value = data.getString(key);
+ String componentType = data.getString(key + "_componentType");
+ String valueType = data.getString(key + "_valueType");
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("populating map for " + key + "\n" +
+ "\n\tvalue: " + value +
+ "\n\tcomponentType: " + componentType +
+ "\n\tvalueType: " + valueType);
+ }
+ // create the component for this componentType
+ UIComponent component =
+ context.getApplication().createComponent(componentType);
+ populateComponentWithValue(context, component, componentType,
+ value, valueType);
+ components.put(key, component);
+ }
+ }
+
+
+ /**
+ * <p>populate the argument component with values, being sensitive
+ * to the possible multi-nature of the values, and to the type of
+ * the values.</p>
+ * @param context the <code>FacesContext</code> for the current request
+ * @param component the <code>UIComponent</code> to populate
+ * @param componentType the component type
+ * @param value the value
+ * @param valueType the value type
+ */
+ private void populateComponentWithValue(FacesContext context,
+ UIComponent component,
+ String componentType,
+ String value,
+ String valueType) {
+ Application application = context.getApplication();
+ Converter converter = null;
+
+ // if we need a converter, and can have a converter
+ if (!"java.lang.String".equals(valueType) &&
+ component instanceof ValueHolder) {
+ // if so create it,
+ try {
+ converter =
+ application.createConverter(CarStore.loadClass(valueType,
+ this));
+ // add it to our component,
+ ((ValueHolder) component).setConverter(converter);
+ } catch (ClassNotFoundException cne) {
+ FacesMessage errMsg = MessageFactory.getMessage(
+ CONVERTER_ERROR_MESSAGE_ID,
+ valueType);
+ throw new IllegalStateException(errMsg.getSummary());
+ }
+
+ }
+
+ // if this component is a SelectOne or SelectMany, take special action
+ if (isMultiValue(componentType)) {
+ // create a UISelectItems instance
+ UISelectItems items = new UISelectItems();
+ items.setValue(parseStringIntoArrayList(value, converter));
+ // add it to the component
+ component.getChildren().add(items);
+ } else {
+ // we have a single value
+ if (null != converter) {
+ component.getAttributes().put("value",
+ converter.getAsObject(context,
+ component,
+ value));
+ } else {
+ component.getAttributes().put("value", value);
+ }
+ }
+ }
+
+ /**
+ * Determines if the component type is a SelectMany or SelectOne.
+ * @param componentType the component type
+ * @return true of the componentType starts with SelectMany or SelectOne
+ */
+ private boolean isMultiValue(String componentType) {
+ if (null == componentType) {
+ return false;
+ }
+ return (componentType.startsWith("javax.faces.SelectMany") ||
+ componentType.startsWith("javax.faces.SelectOne"));
+ }
+
+
+ /*
+ * Tokenizes the passed in String which is a comma separated string of
+ * option values that serve as keys into the main resources file.
+ * For example, optionStr could be "Disc,Drum", which corresponds to
+ * brake options available for the chosen car. This String is tokenized
+ * and used as key into the main resource file to get the localized option
+ * values and stored in the passed in ArrayList.
+ */
+
+ /**
+ * <p>Tokenizes the passed in String which is a comma separated string of
+ * option values that serve as keys into the main resources file.
+ * For example, optionStr could be "Disc,Drum", which corresponds to
+ * brake options available for the chosen car. This String is tokenized
+ * and used as key into the main resource file to get the localized option
+ * values and stored in the passed in ArrayList.</p>
+ *
+ * @param value a comma separated String of values
+ * @param converter currently ignored
+ * @return a <code>List</code> of <code>SelectItem</code> instances
+ * parsed from <code>value</code>
+ */
+ public List<SelectItem> parseStringIntoArrayList(String value,
+ Converter converter) {
+
+ if (value == null) {
+ return null;
+ }
+
+ String[] splitOptions = value.split(",");
+ ArrayList<SelectItem> optionsList =
+ new ArrayList<SelectItem>((splitOptions.length) + 1);
+ for (String optionKey : splitOptions) {
+ String optionLabel;
+ try {
+ optionLabel = resources.getString(optionKey);
+ } catch (MissingResourceException e) {
+ // if we can't find a hit, the key is the label
+ optionLabel = optionKey;
+ }
+
+ if (null != converter) {
+ // PENDING deal with the converter case
+ } else {
+ optionsList.add(new SelectItem(optionKey, optionLabel));
+ }
+ }
+ return optionsList;
+ }
+
+
+ public String updatePricing() {
+ getCurrentPrice();
+ return null;
+ }
+
+
+ public Integer getCurrentPrice() {
+ // go through our options and try to get the prices
+ int sum = (Integer) ((ValueHolder) getComponents().get("basePrice")).
+ getValue();
+
+ for (Object o : getComponents().keySet()) {
+
+ String key = (String) o;
+ UIComponent component = (UIComponent) getComponents().get(key);
+ Object value = component.getAttributes().get("value");
+ if (null == value || (!(component instanceof UIInput))) {
+ continue;
+ }
+
+ // if the value is a String, see if we have priceData for it
+ if (value instanceof String) {
+ try {
+ sum +=
+ Integer.valueOf(priceData.getString((String) value));
+ } catch (NumberFormatException e) {
+ // do nothing
+ }
+ }
+ // if the value is a Boolean, look up the price by name
+ else if (value instanceof Boolean &&
+ (Boolean) value) {
+ try {
+ sum +=
+ Integer.valueOf(priceData.getString(key));
+ } catch (NumberFormatException e) {
+ // do nothing
+ }
+ } else if (value instanceof Number) {
+ sum += ((Number) value).intValue();
+ }
+ }
+ Integer result = sum;
+ // store the new price into the component for currentPrice
+ ((ValueHolder) getComponents().get("currentPrice")).
+ setValue(result);
+ return result;
+ }
+
+
+ public Map getComponents() {
+ return components;
+ }
+
+
+ public Map<String,Object> getAttributes() {
+ return attributes;
+ }
+
+
+}
Added: myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarCustomizer.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarCustomizer.java?rev=948569&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarCustomizer.java (added)
+++ myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarCustomizer.java Wed May 26 20:20:51 2010
@@ -0,0 +1,151 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt.
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * [Name of File] [ver.__] [Date]
+ *
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * <p>A helper class that customizes a CarBean for a set of options
+ * in a package.</p>
+ * <p/>
+ * <p>This class reads its settings from a Properties file</p>
+ */
+
+public class CarCustomizer {
+
+ private static final Logger LOGGER = Logger.getLogger("carstore");
+
+ //
+ // Relationship Instance Variables
+ //
+
+ private ResourceBundle bundle = null;
+
+
+ public CarCustomizer() {
+ this.init(CarStore.DEFAULT_PACKAGE_PROPERTIES);
+ }
+
+
+ public CarCustomizer(String bundleName) {
+ this.init(bundleName);
+ }
+
+
+ private void init(String bundleName) {
+
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Loading bundle: " + bundleName + ".");
+ }
+ bundle = ResourceBundle.getBundle(bundleName);
+ }
+
+
+ private String buttonStyle = null;
+
+
+ public String getButtonStyle() {
+ return buttonStyle;
+ }
+
+
+ public void setButtonStyle(String newButtonStyle) {
+ buttonStyle = newButtonStyle;
+ }
+
+
+ public void customizeCar(CarBean toCustomize) {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ String disabledStr;
+ String curSetting;
+ UIComponent component;
+ Converter converter;
+ Object valueToSet;
+
+ for (Enumeration keys = bundle.getKeys(); keys.hasMoreElements();) {
+
+ String key = (String) keys.nextElement();
+ // skip null and secondary keys.
+ if (key == null || -1 != key.indexOf('_')) {
+ continue;
+ }
+ // skip null values
+ if (null == (curSetting = bundle.getString(key))) {
+ continue;
+ }
+
+ // skip null components
+ if (null ==
+ (component =
+ (UIComponent) toCustomize.getComponents().get(key))) {
+ continue;
+ }
+
+ // handle the disabled setting, if necessary
+ Boolean disabled = null;
+ try {
+ if (null !=
+ (disabledStr = bundle.getString(key + "_disabled"))) {
+ disabled = Boolean.valueOf(disabledStr);
+ }
+ } catch (Throwable e) {
+ // do nothing
+ }
+ if (null != disabled) {
+ component.getAttributes().put("disabled", disabled);
+ }
+
+ // set the value
+ // If the component can and does have a converter
+ if (component instanceof ValueHolder &&
+ (null != (converter =
+ ((ValueHolder) component).getConverter()))) {
+ valueToSet = converter.getAsObject(context, component,
+ curSetting);
+ } else {
+ valueToSet = curSetting;
+ }
+
+ if (component instanceof ValueHolder) {
+ ((ValueHolder) component).setValue(valueToSet);
+ }
+ }
+ }
+}
+
+
+
Added: myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarStore.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarStore.java?rev=948569&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarStore.java (added)
+++ myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CarStore.java Wed May 26 20:20:51 2010
@@ -0,0 +1,310 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt.
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * [Name of File] [ver.__] [Date]
+ *
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sun.javaee.blueprints.components.ui.components.AreaSelectedEvent;
+
+/**
+ * <p>This is the main bean for the application. It maintains a
+ * <code>Map</code> of {@link CarBean} instances, keyed by model name,
+ * and a <code>Map</code> of {@link CarCustomizer} instances, keyed by
+ * package name. The <code>CarBean</code> instances in the model
+ * <code>Map</code> are accessed from several pages, as described
+ * below.</p>
+ * <p/>
+ * <p>Several pages in the application use this bean as the target of
+ * method reference and value reference expressions.</p>
+ * <p/>
+ * <ul>
+ * <p/>
+ * <li><p>The "chooseLocale" page uses <code>actionListener</code>
+ * attributes to point to the {@link #chooseLocaleFromMap} and {@link
+ * #chooseLocaleFromLink} methods.</p></li>
+ * <p/>
+ * <li><p>The "storeFront" page uses value binding expressions to pull
+ * information about four of the known car models in the store.</p></li>
+ * <p/>
+ * <li><p>The "carDetail" page uses value binding expressions to pull
+ * information about the currently chosen model. It also uses the
+ * <code>action</code> attribute to convey the user's package
+ * choices.</p></li>
+ * <p/>
+ * <li><p>The "confirmChoices" page uses value binding expressions to
+ * pull the user's choices from the currently chosen model.</p></li>
+ * <p/>
+ * </ul>
+ */
+
+public class CarStore {
+
+ private static final Logger LOGGER = Logger.getLogger("carstore");
+
+ static final String CARSTORE_PREFIX = "carstore";
+
+ static final String DEFAULT_MODEL = "Jalopy";
+
+ static final String DEFAULT_PACKAGE = "Custom";
+
+ static final String DEFAULT_MODEL_PROPERTIES = CARSTORE_PREFIX +
+ ".bundles." + DEFAULT_MODEL;
+
+ static final String DEFAULT_PACKAGE_PROPERTIES = CARSTORE_PREFIX
+ +
+ ".bundles."
+ + DEFAULT_PACKAGE;
+
+ //
+ // Relationship Instance Variables
+ //
+
+ /**
+ * <p>The locales to be selected for each hotspot, keyed by the
+ * alternate text for that area.</p>
+ */
+ private Map<String, Locale> locales = null;
+
+ /** <p>The currently selected car model.</p> */
+
+ private String currentModelName = DEFAULT_MODEL;
+
+ /**
+ * <p>The car models we offer.</p>
+ * <p/>
+ * <p>Keys: Strings that happen to correspond to the name of the
+ * packages.</p>
+ * <p/>
+ * <p>Values: CarBean instances</p>
+ */
+ private Map<String, CarBean> carModels = null;
+
+ /**
+ * <p>Keys: Strings that happen to correspond to the name of the
+ * Properties file for the car (without the package prefix).</p>
+ * <p/>
+ * <p>Values: CarBeanCustomizer instances</p>
+ */
+
+ private Map<String, CarCustomizer> carCustomizers = null;
+
+
+ public CarStore() {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Creating main CarStore bean");
+ LOGGER.fine("Populating locale map");
+ }
+ locales = new HashMap<String, Locale>(4);
+ locales.put("NAmerica", Locale.ENGLISH);
+ locales.put("SAmerica", new Locale("es", "es"));
+ locales.put("Germany", Locale.GERMAN);
+ locales.put("France", Locale.FRENCH);
+ }
+
+ //
+ // ActionListener handlers
+ //
+
+ public void chooseLocaleFromMap(ActionEvent actionEvent) {
+ AreaSelectedEvent event = (AreaSelectedEvent) actionEvent;
+ String current = event.getMapComponent().getCurrent();
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.getViewRoot().setLocale(locales.get(current));
+ resetMaps();
+ }
+
+
+ public void chooseLocaleFromLink(ActionEvent event) {
+ String current = event.getComponent().getId();
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.getViewRoot().setLocale(locales.get(current));
+ resetMaps();
+ }
+
+
+ private void resetMaps() {
+ if (null != carModels) {
+ carModels.clear();
+ carModels = null;
+ }
+ if (null != carCustomizers) {
+ carCustomizers.clear();
+ carCustomizers = null;
+ }
+ }
+
+
+ public void choosePackage(ActionEvent event) {
+ String packageName = event.getComponent().getId();
+ choosePackage(packageName);
+ }
+
+
+ public void choosePackage(String packageName) {
+ CarCustomizer packageCustomizer = carCustomizers.get(packageName);
+ packageCustomizer.customizeCar(getCurrentModel());
+ getCurrentModel().getCurrentPrice();
+
+ // HERE IS WHERE WE UPDATE THE BUTTON STYLE!
+
+ // go through all the available packages and set the button
+ // style accordingly.
+ for (String curName : carCustomizers.keySet()) {
+ packageCustomizer = carCustomizers.get(curName);
+ if (curName.equals(packageName)) {
+ packageCustomizer.setButtonStyle("package-selected");
+ } else {
+ packageCustomizer.setButtonStyle("package-unselected");
+ }
+ }
+ }
+
+ //
+ // action handlers
+ //
+
+ public String storeFrontJalopyPressed() {
+ setCurrentModelName("Jalopy");
+ return "carDetail";
+ }
+
+
+ public String storeFrontRoadsterPressed() {
+ setCurrentModelName("Roadster");
+ return "carDetail";
+ }
+
+
+ public String storeFrontLuxuryPressed() {
+ setCurrentModelName("Luxury");
+ return "carDetail";
+ }
+
+
+ public String storeFrontSUVPressed() {
+ setCurrentModelName("SUV");
+ return "carDetail";
+ }
+
+
+ public String buyCurrentCar() {
+ getCurrentModel().getCurrentPrice();
+ return "confirmChoices";
+ }
+
+ //
+ // Accessors
+ //
+
+ public CarBean getCurrentModel() {
+ return carModels.get(getCurrentModelName());
+ }
+
+
+ public Map getModels() {
+ if (null == carModels) {
+ carModels = new HashMap<String, CarBean>(4);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Populating carModel map");
+ }
+ carModels.put(DEFAULT_MODEL,
+ new CarBean(DEFAULT_MODEL_PROPERTIES));
+ carModels.put("Roadster",
+ new CarBean(CARSTORE_PREFIX + ".bundles.Roadster"));
+ carModels.put("Luxury", new CarBean(CARSTORE_PREFIX +
+ ".bundles.Luxury"));
+ carModels.put("SUV", new CarBean(CARSTORE_PREFIX +
+ ".bundles.SUV"));
+ }
+
+ return carModels;
+ }
+
+
+ public Map getCustomizers() {
+ getModels();
+ if (null == carCustomizers) {
+ carCustomizers = new HashMap<String, CarCustomizer>(4);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Populating carCustomizers map");
+ }
+ carCustomizers.put("Custom", new CarCustomizer(CARSTORE_PREFIX +
+ ".bundles.Custom"));
+ carCustomizers.put("Standard",
+ new CarCustomizer(CARSTORE_PREFIX +
+ ".bundles.Standard"));
+ carCustomizers.put("Performance",
+ new CarCustomizer(CARSTORE_PREFIX +
+ ".bundles.Performance"));
+ carCustomizers.put("Deluxe",
+ new CarCustomizer(CARSTORE_PREFIX +
+ ".bundles.Deluxe"));
+ choosePackage("Custom");
+ }
+ return carCustomizers;
+ }
+
+ //
+ // private methods
+ //
+
+ private String getCurrentModelName() {
+ return currentModelName;
+ }
+
+
+ private void setCurrentModelName(String newName) {
+ currentModelName = newName;
+ }
+
+ // package private util methods
+
+ static Class loadClass(String name,
+ Object fallbackClass) throws ClassNotFoundException {
+ ClassLoader loader = getCurrentLoader(fallbackClass);
+ return loader.loadClass(name);
+ }
+
+
+ static ClassLoader getCurrentLoader(Object fallbackClass) {
+ ClassLoader loader =
+ Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = fallbackClass.getClass().getClassLoader();
+ }
+ return loader;
+ }
+
+
+}
Added: myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CreditCardConverter.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CreditCardConverter.java?rev=948569&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CreditCardConverter.java (added)
+++ myfaces/portlet-bridge/core/trunk/examples/carstore/src/main/java/carstore/CreditCardConverter.java Wed May 26 20:20:51 2010
@@ -0,0 +1,138 @@
+/*
+ * $Id: CreditCardConverter.java,v 1.3 2006/03/09 01:17:29 rlubke Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt.
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * [Name of File] [ver.__] [Date]
+ *
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * CreditCardConverter Class accepts a Credit Card Number of type String
+ * and strips blanks and <oode>"-"</code> if any from it. It also formats the
+ * CreditCardNumber such a blank space separates every four characters.
+ * Blanks and <oode>"-"</code> characters are the expected demiliters
+ * that could be used as part of a CreditCardNumber.
+ */
+public class CreditCardConverter implements Converter {
+
+ /**
+ * <p>The message identifier of the Message to be created if
+ * the conversion fails. The message format string for this
+ * message may optionally include a <code>{0}</code> and
+ * <code>{1}</code> placeholders, which
+ * will be replaced by the object and value.</p>
+ */
+ public static final String CONVERSION_ERROR_MESSAGE_ID =
+ "carstore.Conversion_Error";
+
+
+ /**
+ * <p>Parses the credit card number and strips any whitespace or
+ * <code>"-"</code> characters from it.</p>
+ * @param context the <code>FacesContext</code> of the current request
+ * @param component the component associated with the value
+ * @param newValue the new value
+ * @return the credit card number less any whitespace or <code>"-"<code>
+ * characters
+ * @throws ConverterException if the value cannot be converted
+ */
+ public Object getAsObject(FacesContext context,
+ UIComponent component,
+ String newValue) throws ConverterException {
+
+ if (newValue == null) {
+ return newValue;
+ }
+ // Since this is only a String to String conversion, this conversion
+ // does not throw ConverterException.
+ String convertedValue = newValue.trim();
+ if (((convertedValue.indexOf('-')) != -1) ||
+ ((convertedValue.indexOf(' ')) != -1)) {
+ char[] input = convertedValue.toCharArray();
+ StringBuilder buffer = new StringBuilder(50);
+ for (char anInput : input) {
+ buffer.append(anInput);
+ }
+ convertedValue = buffer.toString();
+ }
+ // System.out.println("Converted value " + convertedValue);
+ return convertedValue;
+ }
+
+ /**
+ * <p>Formats the value by inserting space after every four characters
+ * for better readability if they don't already exist. In the process
+ * converts any <code>"-"</code> characters into blanks for consistency.</p>
+ * @param context the <code>FacesContext</code> of the current request
+ * @param component the component associated with the value
+ * @param value the value to convert
+ * @return a formatted credit card number
+ * @throws ConverterException if the value cannot be converted
+ */
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) throws ConverterException {
+
+ if (value == null) {
+ return null;
+ }
+ // value must be of the type that can be cast to a String.
+ String inputVal = null;
+ try {
+ inputVal = (String) value;
+ } catch (ClassCastException ce) {
+ FacesMessage errMsg = MessageFactory.getMessage(
+ CONVERSION_ERROR_MESSAGE_ID,
+ value,
+ inputVal);
+ throw new ConverterException(errMsg.getSummary());
+ }
+
+ // insert spaces after every four characters for better
+ // readability if it doesn't already exist.
+ char[] input = inputVal.toCharArray();
+ StringBuilder buffer = new StringBuilder(50);
+ for (int i = 0; i < input.length; ++i) {
+ if ((i % 4) == 0 && i != 0) {
+ if (input[i] != ' ' || input[i] != '-') {
+ buffer.append(' ');
+ // if there any "-"'s convert them to blanks.
+ } else if (input[i] == '-') {
+ buffer.append(' ');
+ }
+ }
+ buffer.append(input[i]);
+ }
+ // System.out.println("Formatted value " + convertedValue);
+ return buffer.toString();
+ }
+}