[seam-commits] Seam SVN: r14236 - in branches/community/Seam_2_3: jboss-seam and 54 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Oct 19 17:34:21 EDT 2011
Author: manaRH
Date: 2011-10-19 17:34:20 -0400 (Wed, 19 Oct 2011)
New Revision: 14236
Added:
branches/community/Seam_2_3/jboss-seam-debug-jsf2/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/pom.xml
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/facelets/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/facelets/StateWriterControl.java
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Contexts.java
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Introspector.java
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/jsf2/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/jsf2/SeamDebugPhaseListener.java
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/debug.xhtml
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/faces-config.xml
branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/seam.properties
branches/community/Seam_2_3/jboss-seam-ui-jsf2/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/pom.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/README
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicBooleanConverter.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicIntegerConverter.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicLongConverter.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/button.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/cache.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationId.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationName.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationPropagation.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertDateTime.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEntity.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEnum.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/decorate.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/defaultAction.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/div.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/download.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/enumItem.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/equalityValidator.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fileUpload.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedText.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedTextValidator.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fragment.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/graphicImage.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/label.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/link.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/message.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/modelValidator.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/remote.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/resource.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selectItems.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selection.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/span.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/taskId.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/token.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageBlur.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageSize.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageType.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/validateAll.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/AbstractEntityLoader.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/ClientUidSelector.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/DocumentStoreUtils.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityIdentifierStore.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/JpaEntityLoader.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/RenderStampStore.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/UnauthorizedCommandException.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIAction.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIButton.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UICache.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationId.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationName.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationPropagation.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDownload.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEnumItem.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEqualityValidator.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFormattedText.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFragment.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILabel.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILink.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIMessage.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIRemote.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIResource.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISeamCommandBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelectItems.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelection.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISpan.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIStyle.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UITaskId.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIToken.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIValidateAll.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicBooleanConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicIntegerConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicLongConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/ConverterChain.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/DateTimeConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/NoSelectionConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/PrioritizableConverter.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsJBossLogging.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/HttpSessionManager.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererFacesContextFactory.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/ServletContextManager.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/filter/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/filter/Ajax4jsfFilterInstantiator.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageResource.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageStore.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/Image.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/ImageTransform.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UIGraphicImage.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageBlur.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageSize.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageType.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/CommandButtonParameterComponentHandler.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/DecorateHandler.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/package-info.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ButtonRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CacheRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CommandButtonParameterRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationNameRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationPropagationRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DefaultActionRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DivRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DownloadRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/EqualityValidatorRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FormattedTextRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FragmentRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/LinkRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/RemoteRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ResourceRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/StyleRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/TokenRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ValidateAllRendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/resource/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/resource/WebResource.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Decoration.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Faces.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/HTML.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/JSF.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/ViewUrlBuilder.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/Messages.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodBindingToMethodExpression.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodExpressionToMethodBinding.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererUtils.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/SimpleActionMethodBinding.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentELTagBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/EqualityValidator.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/ModelValidator.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/javadoc/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/javadoc/jdstyle.css
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/META-INF/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/META-INF/components.xml
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/templates/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/templates/README
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicBooleanConverterTest.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicIntegerConverterTest.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicLongConverterTest.java
branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java
Modified:
branches/community/Seam_2_3/jboss-seam-excel/pom.xml
branches/community/Seam_2_3/jboss-seam-flex/pom.xml
branches/community/Seam_2_3/jboss-seam-mail/pom.xml
branches/community/Seam_2_3/jboss-seam-parent/pom.xml
branches/community/Seam_2_3/jboss-seam-pdf/pom.xml
branches/community/Seam_2_3/jboss-seam-rss/pom.xml
branches/community/Seam_2_3/jboss-seam-ui/src/main/config/component/README
branches/community/Seam_2_3/jboss-seam/pom.xml
branches/community/Seam_2_3/seam-integration-tests/pom.xml
Log:
created jsf2 profile for JSF2 support
Modified: branches/community/Seam_2_3/jboss-seam/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -1,4 +1,5 @@
-<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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -33,63 +34,66 @@
</executions>
</plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <links>
- <link>http://java.sun.com/j2se/5.0/docs/api</link>
- </links>
- <keywords>true</keywords>
- <author>true</author>
- <stylesheetfile>jdstyle.css</stylesheetfile>
- <doctitle>JBoss Seam ${project.name} API ${project.version}</doctitle> <!-- Used by javadoc:javadoc goal -->
- <detectOfflineLinks>false</detectOfflineLinks>
- </configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.6</version>
- <configuration>
- <target>
- <jar destfile="${project.build.directory}/jboss-seam-wls-compatible.jar">
- <zipfileset includes="**/*" excludes="org/jboss/seam/async/TimerServiceDispatcher*" src="${project.build.directory}/jboss-seam.jar" />
- <manifest>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/5.0/docs/api</link>
+ </links>
+ <keywords>true</keywords>
+ <author>true</author>
+ <stylesheetfile>jdstyle.css</stylesheetfile>
+ <doctitle>JBoss Seam ${project.name} API ${project.version}</doctitle> <!-- Used by javadoc:javadoc goal -->
+ <detectOfflineLinks>false</detectOfflineLinks>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <configuration>
+ <target>
+ <jar destfile="${project.build.directory}/jboss-seam-wls-compatible.jar">
+ <zipfileset includes="**/*"
+ excludes="org/jboss/seam/async/TimerServiceDispatcher*" src="${project.build.directory}/jboss-seam.jar" />
+ <manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Implementation-Vendor" value="${project.organization.name}" />
<attribute name="Implementation-Title" value="JBoss Seam Weblogic compatible" />
<attribute name="Implementation-Version" value="${project.version}" />
- </manifest>
- </jar>
- <jar destfile="${project.build.directory}/jboss-seam-wls-compatible-sources.jar">
- <zipfileset includes="**/*" excludes="org/jboss/seam/async/TimerServiceDispatcher.java" src="${project.build.directory}/jboss-seam-sources.jar" />
- <manifest>
- <attribute name="Built-By" value="${user.name}" />
- <attribute name="Implementation-Vendor" value="${project.organization.name}" />
- <attribute name="Implementation-Title" value="JBoss Seam Weblogic compatible" />
- <attribute name="Implementation-Version" value="${project.version}" />
- </manifest>
- </jar>
- </target>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ </manifest>
+ </jar>
+ <jar
+ destfile="${project.build.directory}/jboss-seam-wls-compatible-sources.jar">
+ <zipfileset includes="**/*"
+ excludes="org/jboss/seam/async/TimerServiceDispatcher.java" src="${project.build.directory}/jboss-seam-sources.jar" />
+ <manifest>
+ <attribute name="Built-By" value="${user.name}" />
+ <attribute name="Implementation-Vendor" value="${project.organization.name}" />
+ <attribute name="Implementation-Title" value="JBoss Seam Weblogic compatible" />
+ <attribute name="Implementation-Version" value="${project.version}" />
+ </manifest>
+ </jar>
+ </target>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -108,14 +112,14 @@
<artifactId>commons-logging</artifactId>
<optional>true</optional>
</dependency>
-
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<optional>true</optional>
@@ -186,13 +190,6 @@
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <optional>true</optional>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<optional>true</optional>
@@ -415,12 +412,6 @@
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<optional>true</optional>
@@ -451,12 +442,12 @@
<optional>true</optional>
</dependency>
- <dependency>
- <groupId>org.openid4java</groupId>
- <artifactId>openid4java-consumer</artifactId>
- <type>pom</type>
- <optional>true</optional>
- </dependency>
+ <dependency>
+ <groupId>org.openid4java</groupId>
+ <artifactId>openid4java-consumer</artifactId>
+ <type>pom</type>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -467,43 +458,43 @@
</dependency>
</dependencies>
- <profiles>
- <profile>
- <id>code-coverage</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>emma-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.sonatype.maven.plugin</groupId>
- <artifactId>emma4it-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>distribution</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <phase>package</phase>
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>distribution</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>package</phase>
<configuration>
<excludeGroupIds>org.jboss.seam</excludeGroupIds>
<excludeClassifiers>sources, project, distribution</excludeClassifiers>
@@ -512,11 +503,63 @@
<type>jar</type>
<transitive>true</transitive>
</configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ </profile>
+ </profiles>
</project>
Copied: branches/community/Seam_2_3/jboss-seam-debug-jsf2/pom.xml (from rev 14235, branches/community/Seam_2_3/jboss-seam-rss/pom.xml)
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/pom.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,99 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>jboss-seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>2.3.0-SNAPSHOT</version>
+ <relativePath>../jboss-seam-parent/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-seam-debug-jsf2</artifactId>
+ <name>Seam Debug for JSF2</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+<!-- <dependency> -->
+<!-- <groupId>org.jboss.seam</groupId> -->
+<!-- <artifactId>jboss-seam-debug</artifactId> -->
+<!-- </dependency> -->
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>distribution</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <excludeGroupIds>org.jboss.seam</excludeGroupIds>
+ <excludeClassifiers>sources, project, distribution</excludeClassifiers>
+ <outputDirectory>../jar-dependencies</outputDirectory>
+ <stripVersion>true</stripVersion>
+ <type>jar</type>
+ <transitive>true</transitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/facelets/StateWriterControl.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/facelets/StateWriterControl.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/com/sun/facelets/StateWriterControl.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,91 @@
+package com.sun.facelets;
+
+import java.io.Writer;
+import java.lang.reflect.*;
+
+import javax.faces.context.ResponseWriter;
+
+/**
+ * This is a hack to instantiate a thread-local object that Facelets uses to
+ * write the STATE_KEY into the response when directed by JSF. The STATE_KEY is
+ * written in the case when there is a form on the page. This hack is necessary
+ * since we are not calling Facelets in the normal way (and hence it is not
+ * completely initialized).
+ */
+public class StateWriterControl {
+ final static String STATEWRITER_CLASS_NAME = "com.sun.facelets.StateWriter";
+
+ static Class getStateWriter() {
+ try {
+ return Class.forName(STATEWRITER_CLASS_NAME);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not load class com.sun.facelets.StateWriter using reflection", e);
+ }
+ }
+
+ public static void initialize(Writer writer) {
+ try {
+ Class sw = getStateWriter();
+ Constructor constructor = sw.getConstructor(Writer.class, int.class);
+ constructor.setAccessible(true);
+ constructor.newInstance(writer, 1024);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not initilise com.sun.facelets.StateWriter using reflection", e);
+ }
+ }
+
+ public static ResponseWriter createClone(ResponseWriter writer) {
+ try {
+ Class sw = getStateWriter();
+ Method meth = sw.getMethod("getCurrentInstance");
+ meth.setAccessible(true);
+ Writer w = (Writer) meth.invoke(null);
+ return writer.cloneWithWriter(w);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not create clone of com.sun.facelets.StateWriter using reflection", e);
+ }
+ }
+
+ public static boolean isStateWritten() {
+ try {
+ Class sw = getStateWriter();
+ Method meth = sw.getMethod("getCurrentInstance");
+ meth.setAccessible(true);
+ Object o = meth.invoke(null);
+ Method instMeth = sw.getMethod("isStateWritten");
+ instMeth.setAccessible(true);
+ return (Boolean) instMeth.invoke(o);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not call isStateWritten on com.sun.facelets.StateWriter using reflection", e);
+ }
+ }
+
+ public static String getAndResetBuffer() {
+ try {
+ Class sw = getStateWriter();
+ Method meth = sw.getMethod("getCurrentInstance");
+ meth.setAccessible(true);
+ Object o = meth.invoke(null);
+ Method instMeth = sw.getMethod("getAndResetBuffer");
+ instMeth.setAccessible(true);
+ return (String) instMeth.invoke(o);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not call getAndResetBuffer on com.sun.facelets.StateWriter using reflection", e);
+ }
+ }
+
+ public static void release() {
+ try {
+ Class sw = getStateWriter();
+ Method meth = sw.getMethod("getCurrentInstance");
+ meth.setAccessible(true);
+ Object o = meth.invoke(null);
+ Method instMeth = sw.getMethod("release");
+ instMeth.setAccessible(true);
+ instMeth.invoke(o);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not call release on com.sun.facelets.StateWriter using reflection",e);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Contexts.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Contexts.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Contexts.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,82 @@
+package org.jboss.seam.debug;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.ConversationEntries;
+import org.jboss.seam.core.ConversationEntry;
+import org.jboss.seam.util.Exceptions;
+
+ at Name("org.jboss.seam.debug.contexts")
+ at Scope(ScopeType.APPLICATION)
+ at Install(debug=true, precedence=BUILT_IN)
+public class Contexts
+{
+ public List<ConversationEntry> getConversationEntries()
+ {
+ return new ArrayList<ConversationEntry>( ConversationEntries.instance().getConversationEntries() );
+ }
+
+ public String[] getApplication()
+ {
+ String[] names = org.jboss.seam.contexts.Contexts.getApplicationContext().getNames();
+ Arrays.sort(names);
+ return names;
+ }
+
+ public String[] getSession()
+ {
+ String[] names = org.jboss.seam.contexts.Contexts.getSessionContext().getNames();
+ Arrays.sort(names);
+ return names;
+ }
+
+ public String[] getConversation()
+ {
+ String[] names = org.jboss.seam.contexts.Contexts.getConversationContext().getNames();
+ Arrays.sort(names);
+ return names;
+ }
+
+ public String[] getBusinessProcess()
+ {
+ if ( org.jboss.seam.contexts.Contexts.isBusinessProcessContextActive() )
+ {
+ String[] names = org.jboss.seam.contexts.Contexts.getBusinessProcessContext().getNames();
+ Arrays.sort(names);
+ return names;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Exception getException()
+ {
+ return (Exception) org.jboss.seam.contexts.Contexts.getConversationContext().get("org.jboss.seam.caughtException");
+ }
+
+ public List<Exception> getExceptionCauses()
+ {
+ List<Exception> causes = new ArrayList<Exception>();
+ for (Exception cause=getException(); cause!=null; cause=Exceptions.getCause(cause))
+ {
+ causes.add(cause);
+ }
+ return causes;
+ }
+
+ public boolean isExceptionExists()
+ {
+ return getException()!=null;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Introspector.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Introspector.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/Introspector.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,153 @@
+package org.jboss.seam.debug;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.contexts.Contexts;
+
+ at Name("org.jboss.seam.debug.introspector")
+ at Install(debug=true, precedence=BUILT_IN)
+public class Introspector {
+
+ @RequestParameter
+ private String name;
+
+ public Attribute[] getAttributes() throws Exception
+ {
+ if (name==null) return null;
+ Object component = Contexts.lookupInStatefulContexts(name);
+ if (component==null)
+ {
+ return null;
+ }
+ else if (component instanceof Map)
+ {
+ return getMapAttributes( (Map) component );
+ }
+ else if (component instanceof List)
+ {
+ return getListAttributes( (List) component );
+ }
+ else
+ {
+ return getComponentAttributes(component);
+ }
+ }
+
+ public Attribute[] getMapAttributes(Map<Object, Object> map)
+ {
+ Attribute[] attributes = new Attribute[map.size()];
+ int i=0;
+ for( Map.Entry me: map.entrySet() )
+ {
+ attributes[i++] = new Attribute( me.getKey().toString(), me.getValue() );
+ }
+ return attributes;
+ }
+
+ public Attribute[] getListAttributes(List list)
+ {
+ Attribute[] attributes = new Attribute[list.size()];
+ for(int i=0; i<list.size(); i++ )
+ {
+ attributes[i] = new Attribute( Integer.toString(i), list.get(i) );
+ }
+ return attributes;
+ }
+
+ private Attribute[] getComponentAttributes(Object component) throws IntrospectionException, IllegalAccessException {
+ BeanInfo bi = java.beans.Introspector.getBeanInfo( component.getClass() );
+ //MethodDescriptor[] methods = bi.getMethodDescriptors();
+ PropertyDescriptor[] properties = bi.getPropertyDescriptors();
+ Attribute[] attributes = new Attribute[properties.length+1];
+ for (int i=0; i<properties.length; i++)
+ {
+ Object value;
+ try
+ {
+ Method readMethod = properties[i].getReadMethod();
+ if (readMethod==null) continue;
+ value = readMethod.invoke(component);
+ }
+ catch (InvocationTargetException ite)
+ {
+ Throwable e = ite.getCause();
+ value = toString(e);
+ }
+
+ boolean convertArrayToList = value!=null &&
+ value.getClass().isArray() &&
+ !value.getClass().getComponentType().isPrimitive();
+ if ( convertArrayToList )
+ {
+ value = Arrays.asList( (Object[]) value );
+ }
+
+ attributes[i] = new Attribute( properties[i].getDisplayName(), value );
+ }
+
+ String toString;
+ try
+ {
+ toString = component.toString();
+ }
+ catch (Exception e)
+ {
+ toString = e.getClass().getName() + '[' + e.getMessage() + ']';
+ }
+ attributes[properties.length] = new Attribute("toString()", toString);
+
+ return attributes;
+ }
+
+ private static String toString(Throwable e)
+ {
+ return e.getClass().getName() + '[' + e.getMessage() + ']';
+ }
+
+ public static class Attribute
+ {
+ private String name;
+ private Object value;
+
+ public Attribute(String name, Object value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public String getStringValue()
+ {
+ try
+ {
+ return value==null ? null : value.toString();
+ }
+ catch (Throwable e)
+ {
+ return Introspector.toString(e);
+ }
+ }
+
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/jsf2/SeamDebugPhaseListener.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/jsf2/SeamDebugPhaseListener.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/java/org/jboss/seam/debug/jsf2/SeamDebugPhaseListener.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,125 @@
+package org.jboss.seam.debug.jsf2;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+
+import javax.faces.application.StateManager;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.contexts.FacesLifecycle;
+import org.jboss.seam.navigation.Pages;
+
+import com.sun.facelets.StateWriterControl;
+import com.sun.faces.facelets.Facelet;
+import com.sun.faces.facelets.compiler.SAXCompiler;
+import com.sun.faces.facelets.impl.DefaultFaceletFactory;
+import com.sun.faces.facelets.impl.DefaultResourceResolver;
+
+/**
+ * Intercepts any request for a view-id like /debug.xxx and renders
+ * the Seam debug page using facelets.
+ *
+ * @author Gavin King
+ */
+public class SeamDebugPhaseListener implements PhaseListener
+{
+ private static final String STATE_KEY = "~facelets.VIEW_STATE~";
+
+ public void beforePhase(PhaseEvent event)
+ {
+ FacesLifecycle.setPhaseId( event.getPhaseId() ); //since this gets called before SeamPhaseListener!
+
+ if ( Pages.isDebugPage() )
+ {
+ try
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ URL url = SeamDebugPhaseListener.class.getClassLoader().getResource("META-INF/debug.xhtml");
+ Facelet f = new DefaultFaceletFactory( new SAXCompiler(), new DefaultResourceResolver() ).getFacelet(url);
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ f.apply(facesContext, viewRoot);
+ HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("text/html; UTF-8");
+ ResponseWriter originalWriter = facesContext.getRenderKit().createResponseWriter( response.getWriter(), "text/html", "UTF-8" );
+ StateWriterControl.initialize(originalWriter);
+ ResponseWriter writer = StateWriterControl.createClone(originalWriter);
+ facesContext.setResponseWriter(writer);
+ writer.startDocument();
+ viewRoot.encodeAll(facesContext);
+ writer.endDocument();
+ writer.close();
+ writeState(facesContext, originalWriter);
+ originalWriter.flush();
+ facesContext.responseComplete();
+ }
+ catch (IOException ioe)
+ {
+ throw new RuntimeException(ioe);
+ }
+ }
+ }
+
+ public void afterPhase(PhaseEvent event) {}
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+ private void writeState(FacesContext facesContext, Writer writer) throws IOException {
+ try
+ {
+ if (StateWriterControl.isStateWritten())
+ {
+ String content = StateWriterControl.getAndResetBuffer();
+ int end = content.indexOf(STATE_KEY);
+ if (end >= 0)
+ {
+ StateManager stateMgr = facesContext.getApplication().getStateManager();
+ Object stateObj = stateMgr.saveView(facesContext);
+ String stateStr;
+ if (stateObj == null)
+ {
+ stateStr = null;
+ }
+ else
+ {
+ stateMgr.writeState(facesContext, stateObj);
+ stateStr = StateWriterControl.getAndResetBuffer();
+ }
+
+ int start = 0;
+
+ while (end != -1)
+ {
+ writer.write(content, start, end - start);
+ if (stateStr != null)
+ {
+ writer.write(stateStr);
+ }
+ start = end + STATE_KEY.length();
+ end = content.indexOf(STATE_KEY, start);
+ }
+ writer.write(content, start, content.length() - start);
+ }
+ else
+ {
+ writer.write(content);
+ }
+ }
+ }
+ finally
+ {
+ StateWriterControl.release();
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/debug.xhtml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/debug.xhtml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/debug.xhtml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,255 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html">
+<f:view>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>JBoss Seam Debug Page</title>
+ <style type="text/css">
+ body, div, span, td, th, caption { font-family: 'Trebuchet MS', Verdana, Arial, Sans-Serif; font-size: small; }
+ ul, li, pre { padding: 0; margin: 0; }
+ h1 { color: #090; }
+ h1 a { text-decoration: none; color: #090; }
+ h2, h2 span { font-size: large; color: #339; }
+ h2 a { text-decoration: none; color: #339; }
+ pre { padding: 8px; margin: 10px 0; border: 1px solid #CCC; background-color: #f9f9f9; }
+ #applicationContext { display: none; }
+ #attributes, #conversationContext, #sessionContext, #processContext { display: block; }
+ code { font-size: medium; }
+ table { border: 1px solid #CCC; border-collapse: collapse; border-spacing: 0px; width: 100%; text-align: left; }
+ td { border: 1px solid #CCC; }
+ thead tr th { padding: 2px; color: #030; background-color: #F9F9F9; }
+ tbody tr td { padding: 5px 3px; }
+ table caption { text-align: left; padding: 5px 0; font-size: large; }
+ </style>
+ <style type="text/css" media="print">
+ #sessionContext, #conversationContext, #applicationContext, #attributes, #processContext { display: block; }
+ </style>
+ <script language="Javascript" type="text/javascript">
+ SeamDebugPage = {};
+ SeamDebugPage.toggle = function(id) {
+ var el = document.getElementById(id);
+ var displayStyle = SeamDebugPage.getDisplayStyle(el);
+ if ("block" == displayStyle) {
+ el.style.display = "none";
+ document.getElementById(id+"Off").style.display = "inline";
+ document.getElementById(id+"On").style.display = "none";
+ }
+ else {
+ el.style.display = "block";
+ document.getElementById(id+"Off").style.display = "none";
+ document.getElementById(id+"On").style.display = "inline";
+ }
+ }
+ SeamDebugPage.getDisplayStyle = function(el) {
+ var value = el.style.display;
+
+ if (!value) {
+ if (document.defaultView) {
+ value = document.defaultView.getComputedStyle(el, "").getPropertyValue("display");
+ }
+ else if (el.currentStyle) {
+ value = el.currentStyle.display;
+ }
+ }
+ return value;
+ }
+ function foo() {}
+ </script>
+ </head>
+ <body>
+ <h1><h:outputLink value="#{facesContext.externalContext.request.requestURI}">JBoss Seam Debug Page</h:outputLink></h1>
+ <div>
+ This page allows you to browse and inspect components in any of the Seam
+ contexts associated with the current session. It also shows a list of
+ active, long-running conversations. You can select a conversation to view
+ its contents or destroy it.
+ </div>
+
+ <h2>Conversations</h2>
+ <h:outputText value="No long-running conversations exist"
+ rendered="#{empty org.jboss.seam.debug.contexts.conversationEntries}"/>
+ <h:form rendered="#{not empty org.jboss.seam.debug.contexts.conversationEntries}">
+ <h:dataTable var="_entry" value="#{org.jboss.seam.debug.contexts.conversationEntries}">
+ <h:column>
+ <f:facet name="header">Conversation ID</f:facet>
+ #{_entry.id}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Nested?</f:facet>
+ #{_entry.nested}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Activity</f:facet>
+ <h:outputText value="#{_entry.startDatetime}">
+ <f:convertDateTime type="time" timeZone="#{timeZone}"/>
+ </h:outputText>
+ #{' - '}
+ <h:outputText value="#{_entry.lastDatetime}">
+ <f:convertDateTime type="time" timeZone="#{timeZone}"/>
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Description</f:facet>
+ #{_entry.description}
+ </h:column>
+ <h:column>
+ <f:facet name="header">View ID</f:facet>
+ #{_entry.viewId}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <h:outputLink>
+ Select
+ <f:param name="#{manager.conversationIdParameter}" value="#{_entry.id}"/>
+ </h:outputLink>
+ #{' '}
+ <h:commandLink actionListener="#{_entry.destroy}" action="#{org.jboss.seam.debug.jsf.debugRedirect.execute}" value="Destroy">
+ <f:setPropertyActionListener target="#{org.jboss.seam.debug.jsf.debugRedirect.viewId}" value="#{view.viewId}"/>
+ </h:commandLink>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('attributes'); return false;">
+ <span id="attributesOff" style="display: none;">+</span>
+ <span id="attributesOn">-</span>
+  Component 
+ <h:outputText value="(#{param['name']})"
+ rendered="#{org.jboss.seam.debug.introspector.attributes!=null}"/>
+ <h:outputText value="(None selected)"
+ rendered="#{org.jboss.seam.debug.introspector.attributes==null}"/>
+ </a>
+ </h2>
+ <div id="attributes">
+ <h:outputText value="Select a component from one of the contexts below"
+ rendered="#{org.jboss.seam.debug.introspector.attributes==null}"/>
+ <h:dataTable value="#{org.jboss.seam.debug.introspector.attributes}"
+ rendered="#{org.jboss.seam.debug.introspector.attributes!=null}"
+ var="attribute">
+ <h:column>
+ #{attribute.name}
+ </h:column>
+ <h:column>
+ #{attribute.stringValue}
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('conversationContext'); return false;">
+ <span id="conversationContextOff" style="display: none;">+</span>
+ <span id="conversationContextOn">-</span>
+  Conversation Context 
+ <h:outputText value="(#{manager.currentConversationId})"
+ rendered="#{manager.longRunningConversation}"/>
+ <h:outputText value="(None selected)"
+ rendered="#{!manager.longRunningConversation}"/>
+ </a>
+ </h2>
+ <div id="conversationContext">
+ <h:outputText value="Empty conversation context"
+ rendered="#{empty org.jboss.seam.debug.contexts.conversation}"/>
+ <h:dataTable value="#{org.jboss.seam.debug.contexts.conversation}"
+ var="name">
+ <h:column>
+ <h:outputLink>
+ #{name}
+ <f:param name="name" value="#{name}"/>
+ <f:param name="#{manager.conversationIdParameter}" value="#{conversation.id}"/>
+ </h:outputLink>
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('processContext'); return false;">
+ <span id="processContextOff" style="display: none;">+</span>
+ <span id="processContextOn">-</span>
+  Business Process Context
+ </a>
+ </h2>
+ <div id="processContext">
+ <h:outputText value="Empty business process context"
+ rendered="#{empty org.jboss.seam.debug.contexts.businessProcess}"/>
+ <h:dataTable value="#{org.jboss.seam.debug.contexts.businessProcess}"
+ var="name">
+ <h:column>
+ <h:outputLink>
+ #{name}
+ <f:param name="name" value="#{name}"/>
+ <f:param name="#{manager.conversationIdParameter}" value="#{conversation.id}"/>
+ </h:outputLink>
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('sessionContext'); return false;">
+ <span id="sessionContextOff" style="display: none;">+</span>
+ <span id="sessionContextOn">-</span>
+  Session Context
+ </a>
+ </h2>
+ <div id="sessionContext">
+ <h:outputText value="Empty session context"
+ rendered="#{empty org.jboss.seam.debug.contexts.session}"/>
+ <h:dataTable value="#{org.jboss.seam.debug.contexts.session}"
+ var="name">
+ <h:column>
+ <h:outputLink>
+ #{name}
+ <f:param name="name" value="#{name}"/>
+ <f:param name="#{manager.conversationIdParameter}" value="#{conversation.id}"/>
+ </h:outputLink>
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('applicationContext'); return false;">
+ <span id="applicationContextOff">+</span>
+ <span id="applicationContextOn" style="display: none;">-</span>
+  Application Context
+ </a>
+ </h2>
+ <div id="applicationContext">
+ <h:dataTable value="#{org.jboss.seam.debug.contexts.application}"
+ var="name">
+ <h:column>
+ <h:outputLink>
+ #{name}
+ <f:param name="name" value="#{name}"/>
+ <f:param name="#{manager.conversationIdParameter}" value="#{conversation.id}"/>
+ </h:outputLink>
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ <f:subview rendered="#{org.jboss.seam.debug.contexts.exceptionExists}">
+ <h2>
+ <a href="#" onclick="SeamDebugPage.toggle('stackTrace'); return false;">
+ <span id="stackTraceOff" style="display: none;">+</span>
+ <span id="stackTraceOn">-</span>
+  Exception
+ </a>
+ </h2>
+ <div id="stackTrace">
+ Exception during request processing:
+ <ui:repeat value="#{org.jboss.seam.debug.contexts.exceptionCauses}" var="exception">
+ <div>
+ Caused by #{exception.class.name} with message: "#{exception.getMessage()}"
+ <pre><ui:repeat value="#{exception.stackTrace}" var="stackElement">
+#{stackElement}</ui:repeat></pre>
+ </div>
+ </ui:repeat>
+ </div>
+ </f:subview>
+
+ </body>
+</f:view>
+</html>
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/faces-config.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/META-INF/faces-config.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <lifecycle>
+ <phase-listener>org.jboss.seam.debug.jsf2.SeamDebugPhaseListener</phase-listener>
+ </lifecycle>
+
+</faces-config>
Added: branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/seam.properties
===================================================================
--- branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/seam.properties (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-debug-jsf2/src/main/resources/seam.properties 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1 @@
+
Modified: branches/community/Seam_2_3/jboss-seam-excel/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-excel/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-excel/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -28,25 +28,9 @@
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<type>ejb</type>
- </dependency>
+ </dependency>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
@@ -124,5 +108,43 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Modified: branches/community/Seam_2_3/jboss-seam-flex/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-flex/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-flex/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -33,24 +33,8 @@
<artifactId>jboss-seam</artifactId>
<type>ejb</type>
</dependency>
-
+
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
@@ -107,6 +91,43 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Modified: branches/community/Seam_2_3/jboss-seam-mail/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-mail/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-mail/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -19,11 +19,6 @@
<dependency>
<groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-pdf</artifactId>
<optional>true</optional>
<exclusions>
@@ -39,17 +34,6 @@
</dependency>
<dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>provided</scope>
@@ -120,6 +104,44 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Modified: branches/community/Seam_2_3/jboss-seam-parent/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-parent/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -259,33 +259,7 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.2_12</version>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>1.2_12</version>
- <exclusions>
- <exclusion>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
+ <dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-jpdl</artifactId>
<version>3.2.2</version>
@@ -1803,9 +1777,7 @@
</dependencies>
<modules>
- <module>../jboss-seam-gen</module>
- <module>../jboss-seam-ui</module>
- <module>../jboss-seam-debug</module>
+ <module>../jboss-seam-gen</module>
<module>../jboss-seam-excel</module>
<module>../jboss-seam-flex</module>
<module>../jboss-seam-mail</module>
@@ -1862,6 +1834,74 @@
</profile>
<profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>../jboss-seam-ui</module>
+ <module>../jboss-seam-debug</module>
+ </modules>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_12</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2_12</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <modules>
+ <module>../jboss-seam-ui-jsf2</module>
+ <module>../jboss-seam-debug-jsf2</module>
+ </modules>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.1.3_01</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.1.3_01</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ </dependencyManagement>
+ </profile>
+ <profile>
<id>code-coverage</id>
<activation>
<property>
Modified: branches/community/Seam_2_3/jboss-seam-pdf/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-pdf/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-pdf/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -34,22 +34,6 @@
</dependency>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
@@ -105,6 +89,45 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
Modified: branches/community/Seam_2_3/jboss-seam-rss/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-rss/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/jboss-seam-rss/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -29,22 +29,6 @@
</dependency>
<dependency>
- <groupId>org.jboss.seam</groupId>
- <artifactId>jboss-seam-ui</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
@@ -100,6 +84,44 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Modified: branches/community/Seam_2_3/jboss-seam-ui/src/main/config/component/README
===================================================================
(Binary files differ)
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/pom.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/pom.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,257 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>jboss-seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>2.3.0-SNAPSHOT</version>
+ <relativePath>../jboss-seam-parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ <name>Seam UI JSF2 support</name>
+
+ <build>
+<!-- <finalName>jboss-seam-ui</finalName> -->
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${version.richfaces}</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.jboss.seam.ui</prefix>
+ <description>JSF controls for JBoss Seam</description>
+ <taglib>
+ <displayName>JBoss Seam UI</displayName>
+ <shortName>s</shortName>
+ <uri>http://jboss.com/products/seam/taglib</uri>
+ <tlibVersion>2.0</tlibVersion>
+ <jspVersion>2.1</jspVersion>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/5.0/docs/api</link>
+ </links>
+ <keywords>true</keywords>
+ <author>true</author>
+ <stylesheetfile>jdstyle.css</stylesheetfile>
+ <doctitle>JBoss Seam ${project.name} API ${project.version}</doctitle> <!-- Used by javadoc:javadoc goal -->
+ <detectOfflineLinks>false</detectOfflineLinks>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- See parent pom for notes on how to declare dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-jul</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- Maven's "nearest" dependency resolution doesn't take into account
+ parent dependency management! -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.1.1-b04</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.1.1-b04</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>distribution</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <excludeGroupIds>org.jboss.seam</excludeGroupIds>
+ <excludeClassifiers>sources, project, distribution</excludeClassifiers>
+ <outputDirectory>../jar-dependencies</outputDirectory>
+ <stripVersion>true</stripVersion>
+ <type>jar</type>
+ <transitive>true</transitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Copied: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/README (from rev 14235, branches/community/Seam_2_3/jboss-seam-ui/src/main/config/component/README)
===================================================================
(Binary files differ)
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicBooleanConverter.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicBooleanConverter.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicBooleanConverter.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false">
+ <id>org.jboss.seam.ui.AtomicBooleanConverter</id>
+ <classname>org.jboss.seam.ui.converter.AtomicBooleanConverter</classname>
+ <description>
+ <![CDATA[Converter for java.util.concurrent.atomic.AtomicBoolean]]>
+ </description>
+ <tag>
+ <name>convertAtomicBoolean</name>
+ <classname>org.jboss.seam.ui.taglib.AtomicBooleanTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ </converter>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicIntegerConverter.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicIntegerConverter.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicIntegerConverter.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false">
+ <id>org.jboss.seam.ui.AtomicIntegerConverter</id>
+ <classname>org.jboss.seam.ui.converter.AtomicIntegerConverter</classname>
+ <description>
+ <![CDATA[Converter for java.util.concurrent.atomic.AtomicInteger]]>
+ </description>
+ <tag>
+ <name>convertAtomicInteger</name>
+ <classname>org.jboss.seam.ui.taglib.AtomicIntegerTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ </converter>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicLongConverter.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicLongConverter.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/atomicLongConverter.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false">
+ <id>org.jboss.seam.ui.AtomicLongConverter</id>
+ <classname>org.jboss.seam.ui.converter.AtomicLongConverter</classname>
+ <description>
+ <![CDATA[Converter for java.util.concurrent.atomic.AtomicLong]]>
+ </description>
+ <tag>
+ <name>convertAtomicLong</name>
+ <classname>org.jboss.seam.ui.taglib.AtomicLongTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ </converter>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/button.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/button.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/button.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Button</name>
+ <family>org.jboss.seam.ui.Button</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlButton</classname>
+ <superclass>org.jboss.seam.ui.component.UIButton</superclass>
+ <description>
+ <![CDATA[A link that supports invocation of an action with control over conversation propagation. <i>Does not submit the form.</i>]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.ButtonRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.ButtonRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>button</name>
+ <classname>org.jboss.seam.ui.taglib.ButtonTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_output_attributes;
+ &html_button_attributes;
+ &html_universal_attributes;
+ &html_events;
+ &ui_command_attributes;
+ <property>
+ <name>view</name>
+ <classname>java.lang.String</classname>
+ <description>the JSF view id to link to.</description>
+ </property>
+ <property>
+ <name>pageflow</name>
+ <classname>java.lang.String</classname>
+ <description>a pageflow definition to begin. (This is only useful when propagation="begin" or propagation="join".)</description>
+ </property>
+ <property el="false">
+ <name>propagation</name>
+ <classname>java.lang.String</classname>
+ <description>determines the conversation propagation style: begin, join, nest, none, end or endRoot.</description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ <property transient="true">
+ <name>fragment</name>
+ <classname>java.lang.String</classname>
+ <description>the fragment identifier to link to.</description>
+ </property>
+ <property transient="true" el="false">
+ <name>outcome</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property transient="false">
+ <name>image</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property elonly="true" transient="true" >
+ <name>taskInstance</name>
+ <classname>java.lang.Object</classname>
+ <description>Specify the task to operate on (e.g. for @StartTask)</description>
+ </property>
+ <property>
+ <name>conversationName</name>
+ <classname>java.lang.String</classname>
+ <description>The name of the conversation for natural conversations</description>
+ </property>
+ <property>
+ <name>includePageParams</name>
+ <classname>boolean</classname>
+ <description>Include page parameters defined in pages.xml when rendering the button</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/cache.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/cache.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/cache.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Cache</name>
+ <family>org.jboss.seam.ui.Cache</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlCache</classname>
+ <superclass>org.jboss.seam.ui.component.UICache</superclass>
+ <description>
+ <![CDATA[Cache the rendered page fragment using the installed cache provider.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.CacheRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.CacheRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>cache</name>
+ <classname>org.jboss.seam.ui.taglib.CacheTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ <property>
+ <name>key</name>
+ <classname>java.lang.String</classname>
+ <description>the key to cache rendered content, often a value expression. For example, if we were caching a page fragment that displays a document, we might use key="Document-#{document.id}".</description>
+ </property>
+ <property>
+ <name>region</name>
+ <classname>java.lang.String</classname>
+ <description>a cache node to use (different nodes can have different expiry policies).</description>
+ </property>
+ <property elonly="true">
+ <name>cacheProvider</name>
+ <classname>org.jboss.seam.cache.CacheProvider</classname>
+ <description>The cache provider to use, only needed if you install alter the default cache provider in an application where multiple cache providers are in use</description>
+ <defaultvalue>org.jboss.seam.cache.CacheProvider.instance()</defaultvalue>
+ </property>
+ <property elonly="true">
+ <name>enabled</name>
+ <classname>boolean</classname>
+ <description>a value expression that determines if the cache should be used.</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationId.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationId.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationId.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.ConversationId</name>
+ <family>org.jboss.seam.ui.ConversationId</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlConversationId</classname>
+ <superclass>org.jboss.seam.ui.component.UIConversationId</superclass>
+ <description>
+ <![CDATA[Add the conversation id to JSF link or button (e.g. <h:commandLink />, <s:button />).]]>
+ </description>
+ <tag>
+ <name>conversationId</name>
+ <classname>org.jboss.seam.ui.taglib.ConversationIdTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_parameter_attributes;
+ <property hidden="true" el="false" transient="true">
+ <name>viewId</name>
+ <classname>java.lang.String</classname>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationName.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationName.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationName.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.ConversationName</name>
+ <family>org.jboss.seam.ui.ConversationName</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlConversationName</classname>
+ <superclass>org.jboss.seam.ui.component.UIConversationName</superclass>
+
+ <description>
+ <![CDATA[Set the conversation name for a command link or button (or similar JSF control).]]>
+ </description>
+ <renderer generate="false">
+ <name>org.jboss.seam.ui.ConversationNameRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.ConversationNameRendererBase</classname>
+ </renderer>
+ <tag generate="true">
+ <name>conversationName</name>
+ <classname>org.jboss.seam.ui.taglib.ConversationNameTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <taghandler>
+ <classname>org.jboss.seam.ui.handler.CommandButtonParameterComponentHandler</classname>
+ </taghandler>
+ &ui_parameter_attributes;
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationPropagation.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationPropagation.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/conversationPropagation.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.ConversationPropagation</name>
+ <family>org.jboss.seam.ui.ConversationPropagation</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlConversationPropagation</classname>
+ <superclass>org.jboss.seam.ui.component.UIConversationPropagation</superclass>
+ <description>
+ <![CDATA[Customize the conversation propagation for a command link or button (or similar JSF control).]]>
+ </description>
+ <renderer generate="false">
+ <name>org.jboss.seam.ui.ConversationPropagationRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.ConversationPropagationRendererBase</classname>
+ </renderer>
+ <tag generate="true">
+ <name>conversationPropagation</name>
+ <classname>org.jboss.seam.ui.taglib.ConversationPropagationTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <taghandler>
+ <classname>org.jboss.seam.ui.handler.CommandButtonParameterComponentHandler</classname>
+ </taghandler>
+ &ui_parameter_attributes;
+ <!-- should be el="false" -->
+ <property>
+ <name>pageflow</name>
+ <classname>java.lang.String</classname>
+ <description>a pageflow definition to begin. (This is only useful when propagation="begin" or propagation="join".)</description>
+ </property>
+ <!-- should be el="false" -->
+ <property>
+ <name>type</name>
+ <classname>java.lang.String</classname>
+ <description>determines the conversation propagation style: begin, join, nested, none, end or endRoot.</description>
+ <defaultvalue>"none"</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertDateTime.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertDateTime.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertDateTime.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false">
+ <id>org.jboss.seam.ui.DateTimeConverter</id>
+ <classname>org.jboss.seam.ui.converter.DateTimeConverter</classname>
+ <description>
+ <![CDATA[Perform date or time conversions in the Seam timezone.]]>
+ </description>
+ <tag>
+ <name>convertDateTime</name>
+ <classname>org.jboss.seam.ui.taglib.ConvertDateTimeTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ <property>
+ <name>timeStyle</name>
+ <classname>java.lang.String</classname>
+ <description>Predefined formatting style which determines how the time component of a date string is to be formatted and parsed. Applied only if type is "time" or "both". Valid values are "default", "short", "medium", "long", and "full". Default value is "default".</description>
+ </property>
+ <property>
+ <name>dateStyle</name>
+ <classname>java.lang.String</classname>
+ <description>Predefined formatting style which determines how the date component of a date string is to be formatted and parsed. Applied only if type is "date" or "both". Valid values are "default", "short", "medium", "long", and "full". Default value is "default".</description>
+ </property>
+ <property>
+ <name>pattern</name>
+ <classname>java.lang.String</classname>
+ <description>Custom formatting pattern which determines how the date/time string should be formatted and parsed.</description>
+ </property>
+ <property elonly="true">
+ <name>locale</name>
+ <classname>java.util.Locale</classname>
+ <description>Locale whose predefined styles for dates and times are used during formatting or parsing. If not specified, the Locale returned by FacesContext.getViewRoot().getLocale() will be used. Value must be either a VB expression that evaluates to a java.util.Locale instance, or a String that is valid to pass as the first argument to the constructor java.util.Locale(String language, String country). The empty string is passed as the second argument.</description>
+ </property>
+ <property elonly="true">
+ <name>timeZone</name>
+ <classname>java.util.TimeZone</classname>
+ <description>Time zone in which to interpret any time information in the date String. Value must be either a VB expression that evaluates to a java.util.TimeZone instance, or a String that is a timezone ID as described in the javadocs for java.util.TimeZone.getTimeZone().</description>
+ </property>
+ <property>
+ <name>type</name>
+ <classname>java.lang.String</classname>
+ <description>Specifies what contents the string value will be formatted to include, or parsed expecting. Valid values are "date", "time", and "both". Default value is "date".</description>
+ <defaultvalue>"date"</defaultvalue>
+ </property>
+ </converter>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEntity.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEntity.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEntity.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false" >
+ <id>org.jboss.seam.ui.EntityConverter</id>
+ <classname>org.jboss.seam.ui.EntityConverter</classname>
+ <description>
+ <![CDATA[Convert an entity.]]>
+ </description>
+ <tag>
+ <name>convertEntity</name>
+ <classname>org.jboss.seam.ui.taglib.ConvertEntityTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ </converter>
+
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEnum.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEnum.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/convertEnum.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <converter generate="false">
+ <id>org.jboss.seam.ui.EnumConverter</id>
+ <classname>org.jboss.seam.ui.converter.EnumConverter</classname>
+ <description>
+ <![CDATA[Convert an enum.]]>
+ </description>
+ <tag>
+ <name>convertEnum</name>
+ <classname>org.jboss.seam.ui.taglib.ConvertEnumTag</classname>
+ <superclass>
+ javax.faces.webapp.ConverterELTag
+ </superclass>
+ </tag>
+ </converter>
+
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/decorate.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/decorate.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/decorate.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Decorate</name>
+ <family>org.jboss.seam.ui.Decorate</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlDecorate</classname>
+ <superclass>org.jboss.seam.ui.component.UIDecorate</superclass>
+ <description>
+ <![CDATA["Decorate" a JSF input field when validation fails or when required="true" is set.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.DecorateRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.DecorateRendererBase</classname>
+ <!--<template>org/jboss/seam/ui/htmlDecorate.jspx</template>-->
+
+ </renderer>
+ <tag>
+ <name>decorate</name>
+ <classname>org.jboss.seam.ui.taglib.DecorateTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+
+ <taghandler>
+ <classname>org.jboss.seam.ui.handler.DecorateHandler</classname>
+ </taghandler>
+
+ &ui_component_attributes;
+ &html_style_attributes;
+ <property el="false">
+ <name>for</name>
+ <classname>java.lang.String</classname>
+ <description>Id of the input field to decorate</description>
+ </property>
+
+ <property existintag="false">
+ <name>template</name>
+ <classname>java.lang.String</classname>
+ <description>XHTML template to use to decorate the input field</description>
+ </property>
+
+ <property el="false">
+ <name>enclose</name>
+ <classname>boolean</classname>
+ <description>if true, the template used to decorate the input field is
+ enclosed by the element specified with the "element"
+ attribute. By default this is a div element.
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
+ <property el="false">
+ <name>element</name>
+ <classname>java.lang.String</classname>
+ <description>the element to enclose the template used to decorate the input field.
+ By default, the template is enclosed with a div element.</description>
+ <defaultvalue>"div"</defaultvalue>
+ </property>
+
+ </component>
+
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/defaultAction.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/defaultAction.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/defaultAction.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.DefaultAction</name>
+ <family>org.jboss.seam.ui.DefaultAction</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlDefaultAction</classname>
+ <superclass>javax.faces.component.UIOutput</superclass>
+ <description>
+ <![CDATA[Simulate pressing the action source when "enter" is pressed.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.DefaultActionRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.DefaultActionRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>defaultAction</name>
+ <classname>org.jboss.seam.ui.taglib.DefaultActionTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/div.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/div.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/div.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Div</name>
+ <family>org.jboss.seam.ui.Div</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlDiv</classname>
+ <superclass>org.jboss.seam.ui.component.UIStyle</superclass>
+ <description>
+ <![CDATA[Render a HTML <div>.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.DivRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.DivRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>div</name>
+ <classname>org.jboss.seam.ui.taglib.DivTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>style</name>
+ <classname>java.lang.String</classname>
+ <description>CSS style(s) is/are to be applied when this component is rendered</description>
+ </property>
+ <property>
+ <name>styleClass</name>
+ <classname>java.lang.String</classname>
+ <description>Corresponds to the HTML class attribute</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/download.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/download.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/download.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Download</name>
+ <family>org.jboss.seam.ui.Download</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlDownload</classname>
+ <superclass>org.jboss.seam.ui.component.UIDownload</superclass>
+ <description>
+ <![CDATA[Link for downloading a file]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.DownloadRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.DownloadRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>download</name>
+ <classname>org.jboss.seam.ui.taglib.DownloadTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &html_style_attributes;
+ <property>
+ <name>src</name>
+ <classname>java.lang.String</classname>
+ <description>Source xhtml file that acts as resource holder</description>
+ </property>
+ <property>
+ <name>rendered</name>
+ <classname>boolean</classname>
+ <description>true iff this component should be rendered</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/enumItem.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/enumItem.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/enumItem.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.EnumItem</name>
+ <family>org.jboss.seam.ui.EnumItem</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlEnumItem</classname>
+ <superclass>org.jboss.seam.ui.component.UIEnumItem</superclass>
+ <description>
+ <![CDATA[Creates a SelectItem from an enum value.]]>
+ </description>
+ <tag>
+ <name>enumItem</name>
+ <classname>org.jboss.seam.ui.taglib.EnumItemTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_select_item_attributes;
+ <property>
+ <name>enumValue</name>
+ <classname>java.lang.String</classname>
+ <description>
+ the string representation of the enum value.
+ </description>
+ </property>
+ <property>
+ <name>label</name>
+ <classname>java.lang.String</classname>
+ <description>
+ the label to be used when rendering the SelectItem.
+ </description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/equalityValidator.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/equalityValidator.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/equalityValidator.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+
+ <component>
+ <name>org.jboss.seam.ui.EqualityValidator</name>
+ <family>org.jboss.seam.ui.EqualityValidator</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlEqualityValidator</classname>
+ <superclass>org.jboss.seam.ui.component.UIEqualityValidator</superclass>
+ <description>
+ <![CDATA[Validate all child JSF input fields against the bound propertys using Hibernate Validator.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.EqualityValidatorRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.EqualityValidatorRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>validateEquality</name>
+ <classname>org.jboss.seam.ui.taglib.EqualityValidatorTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>for</name>
+ <classname>java.lang.String</classname>
+ <description>Id of component to validate against</description>
+ </property>
+ <property>
+ <name>message</name>
+ <classname>java.lang.String</classname>
+ <description>Error message to show</description>
+ </property>
+ <property>
+ <name>messageId</name>
+ <classname>java.lang.String</classname>
+ <description>Message id to use on failure</description>
+ </property>
+ <property>
+ <name>operator</name>
+ <classname>java.lang.String</classname>
+ <description>Operation to use.</description>
+ </property>
+ <property>
+ <name>required</name>
+ <classname>boolean</classname>
+ <description>True if a value is required for the filed to validate (default:true)</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
+ </component>
+
+</components>
+
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fileUpload.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fileUpload.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fileUpload.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.FileUpload</name>
+ <family>org.jboss.seam.ui.FileUpload</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlFileUpload</classname>
+ <superclass>org.jboss.seam.ui.component.UIFileUpload</superclass>
+ <description>
+ <![CDATA[Renders a file upload control. This control must be used within a form with an encoding type of multipart/form-data, i.e:
+
+<h:form enctype="multipart/form-data">
+
+For multipart requests, the Seam Multipart servlet filter must also be configured in web.xml:
+
+<filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+</filter>
+
+<filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+The following configuration options for multipart requests may be configured in components.xml:
+
+* createTempFiles - if this option is set to true, uploaded files are streamed to a temporary file instead of in memory.
+* maxRequestSize - the maximum size of a file upload request, in bytes.
+
+Here's an example:
+
+<component class="org.jboss.seam.servlet.MultipartConfig">
+ <property name="createTempFiles">true</property>
+ <property name="maxRequestSize">1000000</property>
+</component>]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.FileUploadRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.FileUploadRendererBase</classname>
+ <!--<template>org/jboss/seam/ui/htmlFileUpload.jspx</template>-->
+ </renderer>
+ <tag>
+ <name>fileUpload</name>
+ <classname>org.jboss.seam.ui.taglib.FileUploadTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_input_attributes;
+ &html_style_attributes;
+ &html_input_attributes;
+ &html_events;
+ &html_input_events;
+ <property transient="true">
+ <name>accept</name>
+ <classname>java.lang.String</classname>
+ <description>a comma-separated list of content types to accept, may not be supported by the browser. E.g. "images/png,images/jpg", "images/*".</description>
+ </property>
+ <property elonly="true">
+ <name>data</name>
+ <classname>java.lang.Object</classname>
+ <description>this value binding receives the file's content type (optional).</description>
+ </property>
+ <property elonly="true">
+ <name>contentType</name>
+ <classname>java.lang.String</classname>
+ <description>the property to receive the contentType</description>
+ </property>
+ <property elonly="true">
+ <name>fileName</name>
+ <classname>java.lang.String</classname>
+ <description>this value binding receives the filename (optional).</description>
+ </property>
+ <property elonly="true">
+ <name>fileSize</name>
+ <classname>java.lang.Integer</classname>
+ <description>this value binding receives the file size (optional).</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedText.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedText.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedText.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components >
+ <component>
+ <name>org.jboss.seam.ui.FormattedText</name>
+ <family>org.jboss.seam.ui.FormattedText</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlFormattedText</classname>
+ <superclass>org.jboss.seam.ui.component.UIFormattedText</superclass>
+ <description>
+ <![CDATA[Output Seam Text. Parse errors generate WARN level log messages.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.FormattedTextRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.FormattedTextRendererBase</classname>
+ <!--<template>org/jboss/seam/ui/htmlFormattedText.jspx</template>-->
+ </renderer>
+ <tag>
+ <name>formattedText</name>
+ <classname>org.jboss.seam.ui.taglib.FormattedTextTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_output_attributes;
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedTextValidator.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedTextValidator.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/formattedTextValidator.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <validator generate="false">
+ <id>org.jboss.seam.ui.FormattedTextValidator</id>
+ <classname>org.jboss.seam.ui.validator.FormattedTextValidator</classname>
+ <description>
+ <![CDATA[Validate Seam Text input]]>
+ </description>
+ <tag>
+ <name>validateFormattedText</name>
+ <classname>org.jboss.seam.ui.taglib.FormattedTextValidatorTag</classname>
+ <superclass>javax.faces.webapp.ValidatorELTag</superclass>
+ </tag>
+ </validator>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fragment.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fragment.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/fragment.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Fragment</name>
+ <family>org.jboss.seam.ui.Fragment</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlFragment</classname>
+ <superclass>org.jboss.seam.ui.component.UIFragment</superclass>
+ <description>
+ <![CDATA[Surround a page fragment, allows you to apply render/not render without any html output]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.FragmentRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.FragmentRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>fragment</name>
+ <classname>org.jboss.seam.ui.taglib.FragmentTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/graphicImage.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/graphicImage.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/graphicImage.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.graphicImage.GraphicImage</name>
+ <family>org.jboss.seam.ui.graphicImage.GraphicImage</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlGraphicImage</classname>
+ <superclass>org.jboss.seam.ui.graphicImage.UIGraphicImage</superclass>
+ <description>
+ <![CDATA[Output an image to the view. You can specify the file as a path, a java.io.File, java.io.InputStream, java.net.URL or byte[]]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.GraphicImageRenderer</name>
+ <classname>org.jboss.seam.ui.graphicImage.GraphicImageRendererBase</classname>
+ <!--<template>org/jboss/seam/ui/htmlGraphicImage.jspx</template>-->
+ </renderer>
+ <tag>
+ <name>graphicImage</name>
+ <classname>org.jboss.seam.ui.taglib.GraphicImageTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &html_style_attributes;
+ &ui_graphic_attributes;
+ &ui_output_attributes;
+ <property>
+ <name>fileName</name>
+ <classname>java.lang.String</classname>
+ <description>File name for the generated URL - allows a stable file name and thus browser caching</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/label.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/label.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/label.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Label</name>
+ <family>javax.faces.Output</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlLabel</classname>
+ <superclass>org.jboss.seam.ui.component.UILabel</superclass>
+ <description>
+ <![CDATA[A label associated with the nearest JSF input component]]>
+ </description>
+ <tag>
+ <name>label</name>
+ <classname>org.jboss.seam.ui.taglib.LabelTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &html_label_attributes;
+ &ui_output_attributes;
+ &html_style_attributes;
+ <property>
+ <name>for</name>
+ <classname>java.lang.String</classname>
+ <description>Id of input component this label is for</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/link.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/link.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/link.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Link</name>
+ <family>org.jboss.seam.ui.Link</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlLink</classname>
+ <superclass>org.jboss.seam.ui.component.UILink</superclass>
+ <description>
+ <![CDATA[A link that supports invocation of an action with control over conversation propagation. Does not submit the form.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.LinkRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.LinkRendererBase</classname>
+ <!-- <template>org/jboss/seam/ui/htmlLink.jspx</template>-->
+ </renderer>
+ <tag>
+ <name>link</name>
+ <classname>org.jboss.seam.ui.taglib.LinkTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_output_attributes;
+ &html_anchor_attributes;
+ &html_universal_attributes;
+ &html_events;
+ &ui_command_attributes;
+ <property>
+ <name>view</name>
+ <classname>java.lang.String</classname>
+ <description>the JSF view id to link to.</description>
+ </property>
+ <property>
+ <name>pageflow</name>
+ <classname>java.lang.String</classname>
+ <description>a pageflow definition to begin. (This is only useful when propagation="begin" or propagation="join".)</description>
+ </property>
+ <!-- Should be el="false" -->
+ <property>
+ <name>propagation</name>
+ <classname>java.lang.String</classname>
+ <description>determines the conversation propagation style: begin, join, nest, none, end or endRoot.</description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ <!-- Should be el="false" -->
+ <property>
+ <name>fragment</name>
+ <classname>java.lang.String</classname>
+ <description>the fragment identifier to link to.</description>
+ </property>
+ <!-- Should be el="false" -->
+ <property>
+ <name>outcome</name>
+ <classname>java.lang.String</classname>
+ <description>The outcome to use when evaluating navigation rules</description>
+ </property>
+ <property>
+ <name>disabled</name>
+ <classname>boolean</classname>
+ <description>If true, write the link as disabled in HTML</description>
+ </property>
+ <property elonly="true" transient="true" >
+ <name>taskInstance</name>
+ <classname>java.lang.Object</classname>
+ <description>Specify the task to operate on (e.g. for @StartTask)</description>
+ </property>
+ <property>
+ <name>conversationName</name>
+ <classname>java.lang.String</classname>
+ <description>The name of the conversation for natural conversations</description>
+ </property>
+ <property>
+ <name>includePageParams</name>
+ <classname>boolean</classname>
+ <description>Include page parameters defined in pages.xml when rendering the button</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/message.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/message.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/message.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Message</name>
+ <family>javax.faces.Message</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlMessage</classname>
+ <superclass>org.jboss.seam.ui.component.UIMessage</superclass>
+ <description>
+ <![CDATA["Decorate" a JSF input field with the validation error message.]]>
+ </description>
+ <tag>
+ <name>message</name>
+ <classname>org.jboss.seam.ui.taglib.MessageTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_message_attributes;
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/modelValidator.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/modelValidator.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/modelValidator.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <validator generate="false">
+ <id>org.jboss.seam.ui.ModelValidator</id>
+ <classname>org.jboss.seam.ui.validator.ModelValidator</classname>
+ <description>
+ <![CDATA[Validate the JSF component against the model]]>
+ </description>
+ <tag>
+ <name>validate</name>
+ <classname>org.jboss.seam.ui.taglib.ModelValidatorTag</classname>
+ <superclass>javax.faces.webapp.ValidatorELTag</superclass>
+ </tag>
+ </validator>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/remote.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/remote.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/remote.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Remote</name>
+ <family>org.jboss.seam.ui.Remote</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlRemote</classname>
+ <superclass>org.jboss.seam.ui.component.UIRemote</superclass>
+ <description>
+ <![CDATA[Write out script element for use with Seam Remoting]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.RemoteRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.RemoteRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>remote</name>
+ <classname>org.jboss.seam.ui.taglib.RemoteTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ &html_style_attributes;
+ <property>
+ <name>include</name>
+ <classname>java.lang.String</classname>
+ <description>The Seam components to include in the Seam Remoting JS interface stubs</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/resource.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/resource.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/resource.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Resource</name>
+ <family>org.jboss.seam.ui.Resource</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlResource</classname>
+ <superclass>org.jboss.seam.ui.component.UIResource</superclass>
+ <description>
+ <![CDATA[Given a data in form of an inputstream, java.util.File or byte[] and a content-type, this tag sends the data to the browser]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.ResourceRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.ResourceRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>resource</name>
+ <classname>org.jboss.seam.ui.taglib.ResourceTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>data</name>
+ <classname>java.lang.Object</classname>
+ <description>Inputstream, File or byte[].</description>
+ </property>
+ <property>
+ <name>contentType</name>
+ <classname>java.lang.String</classname>
+ <description>Content-type of given data</description>
+ </property>
+ <property>
+ <name>fileName</name>
+ <classname>java.lang.String</classname>
+ <description>file name to send to browser (default: name of view)</description>
+ </property>
+ <property>
+ <name>disposition</name>
+ <classname>java.lang.String</classname>
+ <description>Content-Disposition for file (default: inline)</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selectItems.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selectItems.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selectItems.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.SelectItems</name>
+ <family>javax.faces.SelectItems</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlSelectItems</classname>
+ <superclass>org.jboss.seam.ui.component.UISelectItems</superclass>
+ <description>
+ <![CDATA[Creates a List<SelectItem> from a List, Set, DataModel or Array.]]>
+ </description>
+ <tag>
+ <name>selectItems</name>
+ <classname>org.jboss.seam.ui.taglib.SelectItemsTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_select_items_attributes;
+ <property required="true">
+ <name>value</name>
+ <classname>java.lang.Object</classname>
+ <defaultvalue>an EL expression specifying the data that backs the List<SelectItem></defaultvalue>
+ </property>
+ <property required="true" el="false">
+ <name>var</name>
+ <classname>java.lang.String</classname>
+ <description>defines the name of the local variable that holds the current object during iteration</description>
+ </property>
+ <property>
+ <name>itemValue</name>
+ <classname>java.lang.Object</classname>
+ <description>Value to return to the server if this option is selected. Optional, by default the var object is used. Can reference the var variable</description>
+ </property>
+ <property exist="true">
+ <name>label</name>
+ <classname>java.lang.String</classname>
+ <description>the label to be used when rendering the SelectItem. Can reference the var variable</description>
+ <alias>itemLabel</alias>
+ </property>
+ <property>
+ <name>disabled</name>
+ <classname>java.lang.Boolean</classname>
+ <description>if true the SelectItem will be rendered disabled. Can reference the var variable</description>
+ <alias>itemDisabled</alias>
+ </property>
+ <property>
+ <name>noSelectionLabel</name>
+ <classname>java.lang.String</classname>
+ <description>specifies the (optional) label to place at the top of list (if required="true" is also specified then selecting this value will cause a validation error)</description>
+ </property>
+ <property>
+ <name>hideNoSelectionLabel</name>
+ <classname>java.lang.Boolean</classname>
+ <description>if true, the noSelectionLabel will be hidden when a value is selected</description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ <property>
+ <name>escape</name>
+ <classname>java.lang.Boolean</classname>
+ <description>if false, characters in the label will not be escaped. Beware that this is a safety issue when the label is in any way derived from input supplied by the application's user. . Can reference the var variable</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selection.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selection.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/selection.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Selection</name>
+ <family>org.jboss.seam.ui.Selection</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlSelection</classname>
+ <superclass>org.jboss.seam.ui.component.UISelection</superclass>
+ <description>
+ <![CDATA[]]>
+ </description>
+ <tag>
+ <name>selection</name>
+ <classname>org.jboss.seam.ui.taglib.SelectionTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ <property>
+ <name>dataModel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>var</name>
+ <classname>java.lang.String</classname>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/span.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/span.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/span.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Span</name>
+ <family>org.jboss.seam.ui.Span</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlSpan</classname>
+ <superclass>org.jboss.seam.ui.component.UISpan</superclass>
+ <description>
+ <![CDATA[Render a HTML <span>]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.SpanRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.SpanRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>span</name>
+ <classname>org.jboss.seam.ui.taglib.SpanTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ &html_style_attributes;
+ <property>
+ <name>title</name>
+ <classname>java.lang.String</classname>
+ <description>Span title attribute</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/taskId.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/taskId.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/taskId.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.TaskId</name>
+ <family>org.jboss.seam.ui.TaskId</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlTaskId</classname>
+ <superclass>org.jboss.seam.ui.component.UITaskId</superclass>
+ <description>
+ <![CDATA[Add the task id to an output link (or similar JSF control), when the task is available via #{task}.]]>
+ </description>
+ <tag>
+ <name>taskId</name>
+ <classname>org.jboss.seam.ui.taglib.TaskIdTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_parameter_attributes;
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/token.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/token.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/token.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.Token</name>
+ <family>org.jboss.seam.ui.Token</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlToken</classname>
+ <superclass>org.jboss.seam.ui.component.UIToken</superclass>
+ <description>
+ <![CDATA[Render a secure token in the parent form that is validated on postback to guard against CSRF attacks.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.TokenRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.TokenRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>token</name>
+ <classname>org.jboss.seam.ui.taglib.TokenTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ <property>
+ <name>requireSession</name>
+ <classname>boolean</classname>
+ <description>A flag indicating whether the session id should be tied into the secure token.</description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ <property>
+ <name>enableCookieNotice</name>
+ <classname>boolean</classname>
+ <description>A flag indicating whether a notice should be presented to the user if cookies are disabled.</description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ <property>
+ <name>allowMultiplePosts</name>
+ <classname>boolean</classname>
+ <description>A flag indicating whether the form can be submitted multiple times with the same signature (i.e., token).</description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageBlur.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageBlur.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageBlur.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.graphicImage.TransformImageBlur</name>
+ <family>org.jboss.seam.ui.graphicImage.TransformImageBlur</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlTransformImageBlur</classname>
+ <superclass>org.jboss.seam.ui.graphicImage.UITransformImageBlur</superclass>
+ <description>
+ <![CDATA[Nested in a s:graphicImage. Transform an image by applying a blur]]>
+ </description>
+ <tag>
+ <name>transformImageBlur</name>
+ <classname>org.jboss.seam.ui.taglib.TransformImageBlurTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>radius</name>
+ <classname>java.lang.String</classname>
+ <description>The radius of the blur (essentially the ammount of blur)</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageSize.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageSize.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageSize.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.graphicImage.TransformImageSize</name>
+ <family>org.jboss.seam.ui.graphicImage.TransformImageSize</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlTransformImageSize</classname>
+ <superclass>org.jboss.seam.ui.graphicImage.UITransformImageSize</superclass>
+ <description>
+ <![CDATA[Nested in a s:graphicImage. Transform an image by altering the size]]>
+ </description>
+ <tag>
+ <name>transformImageSize</name>
+ <classname>org.jboss.seam.ui.taglib.TransformImageSizeTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>maintainRatio</name>
+ <classname>boolean</classname>
+ <description>If true, don't alter the ratio of the image. In this case only height or width should be specificed.</description>
+ </property>
+ <property>
+ <name>width</name>
+ <classname>java.lang.Integer</classname>
+ <description>The new width of the image</description>
+ </property>
+ <property>
+ <name>height</name>
+ <classname>java.lang.Integer</classname>
+ <description>The new height of the image</description>
+ </property>
+ <property>
+ <name>factor</name>
+ <classname>java.lang.Double</classname>
+ <description>Change the size of the image by a fraction. If factor is specified, height, width and maintainRatio should not be specified</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageType.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageType.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/transformImageType.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.graphicImage.TransformImageType</name>
+ <family>org.jboss.seam.ui.graphicImage.TransformImageType</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlTransformImageType</classname>
+ <superclass>org.jboss.seam.ui.graphicImage.UITransformImageType</superclass>
+ <description>
+ <![CDATA[Nested in a s:graphicImage. Transform an image by changing it's type]]>
+ </description>
+ <tag>
+ <name>transformImageType</name>
+ <classname>org.jboss.seam.ui.taglib.TransformImageTypeTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>contentType</name>
+ <classname>java.lang.String</classname>
+ <description>The mime type of the output image</description>
+ </property>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/validateAll.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/validateAll.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/config/component/validateAll.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
+<components>
+ <component>
+ <name>org.jboss.seam.ui.ValidateAll</name>
+ <family>org.jboss.seam.ui.ValidateAll</family>
+ <classname>org.jboss.seam.ui.component.html.HtmlValidateAll</classname>
+ <superclass>org.jboss.seam.ui.component.UIValidateAll</superclass>
+ <description>
+ <![CDATA[Validate all child JSF input fields against the bound propertys using Hibernate Validator.]]>
+ </description>
+ <renderer generate="false" override="false">
+ <name>org.jboss.seam.ui.ValidateAllRenderer</name>
+ <classname>org.jboss.seam.ui.renderkit.ValidateAllRendererBase</classname>
+ </renderer>
+ <tag>
+ <name>validateAll</name>
+ <classname>org.jboss.seam.ui.taglib.ValidateAllTag</classname>
+ <superclass>
+ org.jboss.seam.ui.util.cdk.UIComponentTagBase
+ </superclass>
+ </tag>
+ </component>
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/AbstractEntityLoader.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/AbstractEntityLoader.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/AbstractEntityLoader.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,58 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.STATELESS;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.framework.Identifier;
+import org.jboss.seam.framework.PersistenceController;
+
+/**
+ * Helper class to load entities for the entity converter
+ * @author Pete Muir
+ *
+ */
+
+public abstract class AbstractEntityLoader<T> extends PersistenceController<T>
+{
+
+ /**
+ * Load and return the entity stored
+ * @param key
+ * @return The entity or null if no entity is available at that key
+ */
+ @Transactional
+ public Object get(String key)
+ {
+ Identifier identifier = EntityIdentifierStore.instance().get(key);
+ if (identifier != null)
+ {
+ return identifier.find(getPersistenceContext());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Store an entity id/clazz
+ * @param entity The entity to store
+ * @return The key under which the clazz/id are stored
+ */
+ @Transactional
+ public String put(Object entity)
+ {
+ return EntityIdentifierStore.instance().put(createIdentifier(entity), entity);
+ }
+
+ protected abstract Identifier createIdentifier(Object entity);
+
+ public abstract void validate();
+
+ public static AbstractEntityLoader instance()
+ {
+ return (AbstractEntityLoader) Component.getInstance("org.jboss.seam.ui.entityLoader", STATELESS);
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/ClientUidSelector.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/ClientUidSelector.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/ClientUidSelector.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,61 @@
+package org.jboss.seam.ui;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.faces.Selector;
+import org.jboss.seam.util.RandomStringUtils;
+
+/**
+ * <p>A selector which manages the cookie that gives the browser a
+ * unique identifier. This value is shared only between the browser
+ * and the server, thus allowing the server to determine if two
+ * distinct requests were made by the same source.</p>
+ *
+ * <p>The identifier is stored in a cookie named <code>javax.faces.ClientToken</code>.</p>
+ *
+ * @author Dan Allen
+ */
+ at Name("org.jboss.seam.ui.clientUidSelector")
+public class ClientUidSelector extends Selector
+{
+
+ private static final long serialVersionUID = 816459544346114991L;
+
+ private String clientUid;
+
+ @Create
+ public void onCreate()
+ {
+ setCookiePath(FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath());
+ setCookieMaxAge(-1);
+ setCookieEnabled(true);
+ clientUid = getCookieValue();
+ }
+
+ public void seed()
+ {
+ if (!isSet()) {
+ clientUid = RandomStringUtils.random(50, true, true);
+ setCookieValueIfEnabled(clientUid);
+ }
+ }
+
+ public boolean isSet()
+ {
+ return clientUid != null;
+ }
+
+ public String getClientUid()
+ {
+ return clientUid;
+ }
+
+ @Override
+ protected String getCookieName()
+ {
+ return "javax.faces.ClientToken";
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/DocumentStoreUtils.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/DocumentStoreUtils.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/DocumentStoreUtils.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,105 @@
+package org.jboss.seam.ui;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.document.DocumentData;
+import org.jboss.seam.document.DocumentStore;
+import org.jboss.seam.document.DocumentData.DocumentType;
+import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.ui.component.UIResource;
+
+public class DocumentStoreUtils
+{
+ private static final int BUFFER_SIZE = 32768;
+
+ public static String addResourceToDataStore(FacesContext ctx, UIResource resource) {
+ String baseName = Pages.getCurrentBaseName();
+ String viewId = Pages.getViewId(ctx);
+
+ DocumentStore store = DocumentStore.instance();
+ String id = store.newId();
+
+ DocumentType type = new DocumentType("", resource.getContentType());
+
+ DocumentData documentData = new DownloadableDocumentData(baseName, type, resource.getData());
+ documentData.setFilename(resource.getFileName());
+ documentData.setDisposition(resource.getDisposition());
+
+ String url = store.preferredUrlForContent(resource.getFileName(), type.getExtension(), id);
+ url = Manager.instance().encodeConversationId(url, viewId);
+ store.saveData(id, documentData);
+ return url;
+ }
+
+ static class DownloadableDocumentData
+ extends DocumentData
+ {
+ private Object data;
+
+ public DownloadableDocumentData(String baseName, DocumentType type, Object data) {
+ super(baseName, type);
+ this.data = data;
+ }
+
+ @Override
+ public void writeDataToStream(OutputStream os)
+ throws IOException
+ {
+ if (data instanceof byte[]) {
+ os.write((byte[]) data);
+ } else if (data instanceof File) {
+ writeStream(os, new FileInputStream((File) data));
+ } else if (data instanceof InputStream) {
+ writeStream(os, (InputStream) data);
+ }
+ }
+
+ private void writeStream(OutputStream os, InputStream is)
+ throws IOException
+
+ {
+ ReadableByteChannel in = Channels.newChannel(is);
+ WritableByteChannel out = Channels.newChannel(os);
+
+ try {
+ copyChannel(in, out);
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // eat it
+ }
+
+ try {
+ out.close();
+ } catch (IOException e) {
+ // eat it
+ }
+ }
+ }
+
+ private void copyChannel(ReadableByteChannel in, WritableByteChannel out)
+ throws IOException
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFER_SIZE);
+
+ while (in.read(buffer) != -1 || buffer.position() > 0) {
+ buffer.flip();
+ out.write(buffer);
+ buffer.compact();
+ }
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,79 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.CONVERSATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.Serializable;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.faces.Converter;
+
+/**
+ * Allows conversion of an entity to/from a key which can be written to a page.
+ *
+ * Support is provided for JPA (by default) and Hibernate (with the session
+ * specified in components.xml)
+ */
+ at Name("org.jboss.seam.ui.EntityConverter")
+ at Scope(CONVERSATION)
+ at Install(precedence = BUILT_IN)
+ at Converter
+ at BypassInterceptors
+public class EntityConverter implements
+ javax.faces.convert.Converter, Serializable
+{
+
+ private AbstractEntityLoader entityLoader;
+
+ public AbstractEntityLoader getEntityLoader()
+ {
+ if (entityLoader == null)
+ {
+ return AbstractEntityLoader.instance();
+ }
+ else
+ {
+ return entityLoader;
+ }
+ }
+
+ public void setEntityLoader(AbstractEntityLoader entityLoader)
+ {
+ this.entityLoader = entityLoader;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Transactional
+ public String getAsString(FacesContext facesContext, UIComponent cmp, Object value) throws ConverterException
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ if (value instanceof String)
+ {
+ return (String) value;
+ }
+ return getEntityLoader().put(value);
+ }
+
+
+ @Transactional
+ public Object getAsObject(FacesContext facesContext, UIComponent cmp, String value) throws ConverterException
+ {
+ if (value == null || value.length() == 0)
+ {
+ return null;
+ }
+ return getEntityLoader().get(value);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityIdentifierStore.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityIdentifierStore.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/EntityIdentifierStore.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,72 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.PAGE;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.AbstractMutable;
+import org.jboss.seam.framework.Identifier;
+
+/**
+ * Page scoped store for entity identifiers used by the EntityConverter.
+ *
+ * By default a list is used and the key returned is the list index. The key
+ * used can be customised by overriding this component and implementing the
+ * get and put methods
+ *
+ * @author Pete Muir
+ *
+ */
+ at Name("org.jboss.seam.ui.entityIdentifierStore")
+ at Install(precedence=BUILT_IN)
+ at Scope(PAGE)
+public class EntityIdentifierStore extends AbstractMutable
+{
+
+ private List<Identifier> store;
+
+ @Create
+ public void create()
+ {
+ store = new ArrayList<Identifier>();
+ }
+
+ public Identifier get(String key)
+ {
+ try
+ {
+ return store.get(new Integer(key));
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ return null;
+ }
+ }
+
+ public String put(Identifier identifier, Object entity)
+ {
+ if (!store.contains(identifier))
+ {
+ store.add(identifier);
+ setDirty();
+ }
+ return ((Integer) store.indexOf(identifier)).toString();
+ }
+
+ public static EntityIdentifierStore instance()
+ {
+ if (!Contexts.isPageContextActive())
+ {
+ throw new IllegalArgumentException("Page scope not active");
+ }
+ return (EntityIdentifierStore) Component.getInstance(EntityIdentifierStore.class, PAGE);
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/HibernateEntityLoader.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,57 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.STATELESS;
+import static org.jboss.seam.annotations.Install.FRAMEWORK;
+
+import org.hibernate.Session;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.framework.HibernateEntityIdentifier;
+import org.jboss.seam.framework.Identifier;
+
+/**
+ * Stores entity identifiers under a key, which can be used on a page
+ *
+ * @author Pete Muir
+ */
+
+ at Name("org.jboss.seam.ui.entityLoader")
+ at Install(precedence=FRAMEWORK, classDependencies="org.hibernate.Session", value=false)
+ at Scope(STATELESS)
+public class HibernateEntityLoader extends AbstractEntityLoader<Session>
+{
+
+ @Override
+ protected Identifier createIdentifier(Object entity)
+ {
+ return new HibernateEntityIdentifier(entity, getPersistenceContext());
+ }
+
+ @Override
+ protected String getPersistenceContextName()
+ {
+ return "hibernateSession";
+ }
+
+ @Override
+ public void validate()
+ {
+ if (getPersistenceContext() == null)
+ {
+ throw new IllegalStateException("Unable to access a Seam Managed Hibernate Session. You must either have a Seam Managed Hibernate Session called hibernateSession or configure one in components.xml");
+ }
+
+ }
+
+ public Session getSession()
+ {
+ return getPersistenceContext();
+ }
+
+ public void setSession(Session session)
+ {
+ setPersistenceContext(session);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/JpaEntityLoader.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/JpaEntityLoader.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/JpaEntityLoader.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,58 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.STATELESS;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.framework.EntityIdentifier;
+import org.jboss.seam.framework.Identifier;
+
+/**
+ * Stores entity identifiers under a key, which can be used on a page
+ *
+ * @author Pete Muir
+ */
+
+ at Name("org.jboss.seam.ui.entityLoader")
+ at Install(precedence=BUILT_IN, value=true, classDependencies="javax.persistence.EntityManager")
+ at Scope(STATELESS)
+public class JpaEntityLoader extends AbstractEntityLoader<EntityManager>
+{
+
+ @Override
+ protected Identifier createIdentifier(Object entity)
+ {
+ return new EntityIdentifier(entity, getPersistenceContext());
+ }
+
+ @Override
+ protected String getPersistenceContextName()
+ {
+ return "entityManager";
+ }
+
+ @Override
+ public void validate()
+ {
+ if (getPersistenceContext() == null)
+ {
+ throw new IllegalStateException("Unable to access a persistence context. You must either have a SMPC called entityManager or configure one in components.xml");
+ }
+
+ }
+
+ public EntityManager getEntityManager()
+ {
+ return getPersistenceContext();
+ }
+
+ public void setEntityManager(EntityManager entityManager)
+ {
+ setPersistenceContext(entityManager);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/RenderStampStore.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/RenderStampStore.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/RenderStampStore.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,96 @@
+package org.jboss.seam.ui;
+
+import static org.jboss.seam.ScopeType.SESSION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+/**
+ * A class that stores render stamps for use with <s:token> when client side
+ * state saving is in use. By default the render stamp store will never remove a
+ * render stamp unless instructed to by a UIToken. If the maxSize property is
+ * larger than zero then it will control the maximum number of tokens stored,
+ * with the oldest token being removed when a token is inserted that will take
+ * the store over the maxSize limit. The default maxSize is 100.
+ *
+ * @author Stuart Douglas
+ */
+ at Name("org.jboss.seam.ui.renderStampStore")
+ at Scope(SESSION)
+ at Install(precedence = BUILT_IN, value = false)
+ at AutoCreate
+ at BypassInterceptors
+public class RenderStampStore implements Serializable {
+
+ class RenderStamp {
+ String stamp;
+ Date timeStamp;
+ }
+
+ int maxSize = 100;
+
+ Map<String, RenderStamp> store = new ConcurrentHashMap<String, RenderStamp>();
+
+ /**
+ * Stores a stamp in the store, and returns the key it is stored under.
+ */
+ public String storeStamp(String stamp) {
+ if (maxSize > 0) {
+ if (store.size() == maxSize) {
+ Date oldest = null;
+ String oldestSigniture = null;
+ for (String sig : store.keySet()) {
+ RenderStamp s = store.get(sig);
+ if (oldest == null || s.timeStamp.before(oldest)) {
+ oldestSigniture = sig;
+ }
+ }
+ store.remove(oldestSigniture);
+ }
+ }
+ RenderStamp s = new RenderStamp();
+ s.stamp = stamp;
+ s.timeStamp = new Date();
+ String key;
+ do {
+ key = UUID.randomUUID().toString();
+ } while (!store.containsKey(key));
+ store.put(key, s);
+ return key;
+ }
+
+ public void removeStamp(String viewSigniture) {
+ store.remove(viewSigniture);
+ }
+
+ public String getStamp(String viewSigniture) {
+ RenderStamp s = store.get(viewSigniture);
+ if (s != null) {
+ return store.get(viewSigniture).stamp;
+ }
+ return null;
+ }
+
+ public static RenderStampStore instance() {
+ return (RenderStampStore) Component.getInstance(RenderStampStore.class);
+ }
+
+ public int getMaxSize() {
+ return maxSize;
+ }
+
+ public void setMaxSize(int maxSize) {
+ this.maxSize = maxSize;
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/UnauthorizedCommandException.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/UnauthorizedCommandException.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/UnauthorizedCommandException.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,50 @@
+package org.jboss.seam.ui;
+
+import javax.faces.FacesException;
+
+/**
+ * An exception is thrown when the authenticity of a JSF command (i.e., form post)
+ * that relies on a UIToken cannot be verified.
+ *
+ * @author Dan Allen
+ */
+public class UnauthorizedCommandException extends FacesException
+{
+ private String viewId;
+
+ /**
+ * <p>Construct a new exception with no detail message or root cause.</p>
+ */
+ public UnauthorizedCommandException() {
+ super();
+ }
+
+ /**
+ * <p>Construct a new exception with a detail message and the view ID</p>
+ */
+ public UnauthorizedCommandException(String viewId, String message) {
+ super(message);
+ this.viewId = viewId;
+ }
+
+ /**
+ * <p>Returns the view ID to which the authorized command was directed.</p>
+ */
+ public String getViewId()
+ {
+ return viewId;
+ }
+
+ /**
+ * <p>Returns the detail message explaining the reason for the denial.
+ * Includes the view ID if specified.</p>
+ */
+ @Override
+ public String getMessage()
+ {
+ if (viewId != null) {
+ return "viewId: " + viewId + " - " + super.getMessage();
+ }
+ return super.getMessage();
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIAction.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIAction.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIAction.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,99 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.navigation.SafeActions;
+
+/*
+ * This is a support component and is not processed by the CDK (doesn't appear in faces-config)
+ *
+ */
+public class UIAction extends UIParameter
+{
+
+ private static final String COMPONENT_FAMILY = "org.jboss.seam.ui.Action";
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ private String action;
+
+ public String getAction()
+ {
+ return action;
+ }
+
+ public void setAction(String action)
+ {
+ this.action = action;
+ }
+
+ private boolean isMethodBinding()
+ {
+ return getAction().startsWith("#{");
+ }
+
+ @Override
+ public String getName()
+ {
+ return isMethodBinding() ? "actionMethod" : "actionOutcome";
+ }
+
+ @Override
+ public Object getValue()
+ {
+ String viewId = Pages.getCurrentViewId();
+ if ( isMethodBinding() )
+ {
+ String actionId = SafeActions.toActionId( viewId, getAction() );
+ SafeActions.instance().addSafeAction(actionId);
+ return actionId;
+ }
+ else
+ {
+ return getAction();
+ }
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ super.restoreState(context, values[0]);
+ action = (String) values[1];
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[2];
+ values[0] = super.saveState(context);
+ values[1] = action;
+ return values;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIButton.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIButton.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIButton.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIButton extends UISeamCommandBase {
+
+ public abstract String getStyleClass();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract String getStyle();
+
+ public abstract void setStyle(String style);
+
+ public abstract boolean isDisabled();
+
+ public abstract void setDisabled(boolean disabled);
+
+ public abstract String getOnclick();
+
+ public abstract void setOnclick(String onclick);
+
+ public abstract String getImage();
+
+ public abstract void setImage(String image);
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UICache.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UICache.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UICache.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.jboss.seam.cache.CacheProvider;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UICache extends UIComponentBase
+{
+
+ public abstract boolean isEnabled();
+
+ public abstract void setEnabled(boolean enabled);
+
+ public abstract String getKey();
+
+ public abstract void setKey(String key);
+
+ public abstract String getRegion();
+
+ public abstract void setRegion(String region);
+
+ public abstract CacheProvider getCacheProvider();
+
+ public abstract void setCacheProvider(CacheProvider cacheProvider);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationId.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationId.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationId.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,86 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.navigation.Page;
+import org.jboss.seam.navigation.Pages;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIConversationId extends UIParameter {
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.ConversationId";
+
+ @Override
+ public String getName()
+ {
+ Conversation conversation = Conversation.instance();
+ if (getViewId()!=null && ( !conversation.isNested() || conversation.isLongRunning() ) )
+ {
+ return Pages.instance().getPage(getViewId())
+ .getConversationIdParameter()
+ .getParameterName();
+ }
+ else
+ {
+ return Manager.instance().getConversationIdParameter();
+ }
+ }
+
+ @Override
+ public Object getValue()
+ {
+ Conversation conversation = Conversation.instance();
+ if ( !conversation.isNested() || conversation.isLongRunning() )
+ {
+ if (getViewId()!=null)
+ {
+ Page page = Pages.instance().getPage(getViewId());
+ return page.getConversationIdParameter().getParameterValue();
+ }
+ else
+ {
+ return conversation.getId();
+ }
+ }
+ else
+ {
+ return conversation.getParentId();
+ }
+ }
+
+ public abstract String getViewId();
+
+ public abstract void setViewId(String viewId);
+
+ public static UIConversationId newInstance() {
+ return (UIConversationId) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationName.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationName.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationName.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,35 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.navigation.ConversationIdParameter;
+import org.jboss.seam.navigation.Pages;
+
+/**
+ * Embeds the natural conversation ID into the request.
+ *
+ * @author Shane Bryzak
+ */
+public abstract class UIConversationName extends UIParameter {
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.ConversationName";
+
+ @Override
+ public String getName()
+ {
+ return "conversationName";
+ }
+
+ @Override
+ public Object getValue()
+ {
+ ConversationIdParameter param = Pages.instance().getConversationIdParameter(super.getValue().toString());
+ return param != null ? param.getConversationId() : null;
+ }
+
+ public static UIConversationName newInstance() {
+ return (UIConversationName) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationPropagation.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationPropagation.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIConversationPropagation.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,59 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIConversationPropagation extends UIParameter {
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.ConversationPropagation";
+
+ @Override
+ public String getName()
+ {
+ return "conversationPropagation";
+ }
+
+ @Override
+ public Object getValue()
+ {
+ return getPageflow()==null ? getType() : getType() + "." + getPageflow();
+ }
+
+ public abstract String getPageflow();
+
+ public abstract void setPageflow(String pageflow);
+
+ public abstract String getType();
+
+ public abstract void setType(String type);
+
+ public static UIConversationPropagation newInstance() {
+ return (UIConversationPropagation) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDecorate.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDecorate.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,94 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.ui.util.Decoration;
+
+public abstract class UIDecorate extends UIComponentBase implements NamingContainer
+{
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.Decorate";
+
+ public boolean hasMessage()
+ {
+ String clientId = getInputClientId();
+ if (clientId==null)
+ {
+ return false;
+ }
+ else
+ {
+ return getFacesContext().getMessages(clientId).hasNext();
+ }
+ }
+
+ public String getInputId()
+ {
+ String id = getFor();
+ if (id==null)
+ {
+ UIComponent evh = Decoration.getEditableValueHolder(this);
+ return evh==null ? null : evh.getId();
+ }
+ else
+ {
+ return id;
+ }
+ }
+
+ private String getInputClientId()
+ {
+ String id = getFor();
+ if (id==null)
+ {
+ UIComponent evh = Decoration.getEditableValueHolder(this);
+ return evh==null ? null : evh.getClientId( getFacesContext() );
+ }
+ else
+ {
+ // As UIDecorate implements NamingContainer it alters the search
+ // algorithm used by JSF
+ UIComponent component = null;
+ if (getParent() != null)
+ {
+ component = getParent().findComponent(id);
+ }
+ return component==null ? null : component.getClientId( getFacesContext() );
+ }
+ }
+
+ public abstract String getFor();
+
+
+ public abstract void setFor(String forId);
+
+ public abstract String getStyleClass();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract String getStyle();
+
+ public abstract void setStyle(String style);
+
+ public abstract boolean isEnclose();
+
+ public abstract void setEnclose(boolean enclose);
+
+ public abstract String getElement();
+
+ public abstract void setElement(String element);
+
+ public UIComponent getDecoration(String name)
+ {
+ return Decoration.getDecoration(name, this);
+ }
+
+ public static UIDecorate newInstance()
+ {
+ return (UIDecorate) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDownload.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDownload.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIDownload.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,14 @@
+package org.jboss.seam.ui.component;
+
+/**
+ *
+ * @author Daniel Roth
+ *
+ */
+public abstract class UIDownload extends UILink
+{
+ public abstract String getSrc();
+
+ public abstract void setSrc(String src);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEnumItem.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEnumItem.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEnumItem.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,55 @@
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UISelectItem;
+import javax.faces.model.SelectItem;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIEnumItem extends UISelectItem
+{
+
+ public abstract String getEnumValue();
+
+ public abstract void setEnumValue(String enumValue);
+
+ public abstract void setLabel(String label);
+
+ public abstract String getLabel();
+
+ @Override
+ public Object getItemValue()
+ {
+ return getEnumValue();
+ }
+
+ @Override
+ public void setItemValue(Object itemValue)
+ {
+ setEnumValue(itemValue == null ? null : itemValue.toString());
+ }
+
+ @Override
+ public String getItemLabel()
+ {
+ return getLabel();
+ }
+
+ @Override
+ public void setItemLabel(String itemLabel)
+ {
+ setLabel(itemLabel);
+ }
+
+ @Override
+ public Object getValue()
+ {
+ Class c = getParent().getValueExpression("value").getType(getFacesContext().getELContext());
+ String enumValue = getEnumValue();
+ String label = getLabel();
+ Object value = Enum.valueOf(c, enumValue);
+ return new SelectItem(value, label == null ? enumValue : label);
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEqualityValidator.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEqualityValidator.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIEqualityValidator.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,33 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * UIComponent for validator
+ *
+ * @author Daniel Roth
+ */
+public abstract class UIEqualityValidator extends UIComponentBase
+{
+
+ public abstract String getFor();
+
+ public abstract void setFor(String forId);
+
+ public abstract String getMessage();
+
+ public abstract void setMessage(String message);
+
+ public abstract String getMessageId();
+
+ public abstract void setMessageId(String messageId);
+
+ public abstract void setOperator(String operator);
+
+ public abstract String getOperator();
+
+ public abstract void setRequired(boolean required);
+
+ public abstract boolean isRequired();
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFileUpload.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,282 @@
+package org.jboss.seam.ui.component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIFileUpload extends UIInput
+{
+
+ private String localContentType;
+
+ private String localFileName;
+
+ private Integer localFileSize;
+
+ private InputStream localInputStream;
+
+ @Override
+ public void processUpdates(FacesContext context)
+ {
+
+ // Skip processing if rendered flag is false.
+ // this logic is in javax.faces.component.UIInput.processUpdates(FacesContext context)
+ if (!isRendered()) {
+ return;
+ }
+
+ ValueExpression dataBinding = getValueExpression("data");
+ if (dataBinding != null)
+ {
+ if (getLocalContentType() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("contentType");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalContentType());
+ }
+ }
+
+ if (getLocalFileName() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("fileName");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalFileName());
+ }
+ }
+
+ if (getLocalFileSize() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("fileSize");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalFileSize());
+ }
+ }
+
+ Class clazz = dataBinding.getType(context.getELContext());
+ if (clazz.isAssignableFrom(InputStream.class))
+ {
+ dataBinding.setValue(context.getELContext(), getLocalInputStream());
+ }
+ else if (clazz.isAssignableFrom(byte[].class))
+ {
+ byte[] bytes = null;
+ if (getLocalInputStream() != null)
+ {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try
+ {
+ byte[] buffer = new byte[512];
+ int read = getLocalInputStream().read(buffer);
+ while (read != -1)
+ {
+ bos.write(buffer, 0, read);
+ read = getLocalInputStream().read(buffer);
+ }
+ bytes = bos.toByteArray();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ dataBinding.setValue(context.getELContext(), bytes);
+ }
+ }
+ }
+
+ public String getLocalContentType()
+ {
+ return localContentType;
+ }
+
+ public void setLocalContentType(String localContentType)
+ {
+ this.localContentType = localContentType;
+ }
+
+ public String getLocalFileName()
+ {
+ return localFileName;
+ }
+
+ public void setLocalFileName(String localFileName)
+ {
+ this.localFileName = extractFilename(localFileName);
+ }
+
+ /**
+ * Workaround for IE, which includes the full path to the file.
+ */
+ private String extractFilename(String filename)
+ {
+ if (filename != null && filename.lastIndexOf("\\") > -1)
+ {
+ return filename.substring(filename.lastIndexOf("\\") + 1);
+ }
+ else
+ {
+ return filename;
+ }
+ }
+
+ public Integer getLocalFileSize()
+ {
+ return localFileSize;
+ }
+
+ public void setLocalFileSize(Integer localFileSize)
+ {
+ this.localFileSize = localFileSize;
+ }
+
+ public InputStream getLocalInputStream()
+ {
+ return localInputStream;
+ }
+
+ public void setLocalInputStream(InputStream localInputStream)
+ {
+ this.localInputStream = localInputStream;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIOutput#getLocalValue()
+ */
+ @Override
+ public Object getLocalValue() {
+ return new LocalUploadValue(localContentType, localFileName, localFileSize,
+ localInputStream);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIInput#setValue(java.lang.Object)
+ */
+ @Override
+ public void setValue(Object value) {
+ // Check if the local values get restored
+ if (value != null && value instanceof LocalUploadValue) {
+ LocalUploadValue localValue = (LocalUploadValue) value;
+ localFileName = localValue.getFileName();
+ localFileSize = localValue.getFileSize();
+ localContentType = localValue.getContentType();
+ localInputStream = localValue.getInputStream();
+ } else {
+ super.setValue(value);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see javax.faces.component.UIInput#isLocalValueSet()
+ */
+ @Override
+ public boolean isLocalValueSet() {
+ return localContentType != null || localFileName != null || localFileSize != null
+ || localInputStream != null;
+ }
+
+ /**
+ * Helper class to store the local values.
+ */
+ protected class LocalUploadValue {
+
+ /** Stores the local content type. */
+ private String contentType;
+
+ /** Stores the local file name. */
+ private String fileName;
+
+ /** Stores the local file size. */
+ private Integer fileSize;
+
+ /** Stores the local stream information. */
+ private InputStream inputStream;
+
+ /**
+ * Constructor for this class.
+ *
+ * @param contentType
+ * The local content type to save
+ * @param fileName
+ * The local file name to save
+ * @param fileSize
+ * The local file size to save
+ * @param inputStream
+ * The local input stream to save
+ */
+ public LocalUploadValue(String contentType, String fileName, Integer fileSize,
+ InputStream inputStream) {
+ super();
+ this.contentType = contentType;
+ this.fileName = fileName;
+ this.fileSize = fileSize;
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Returns the contentType value.
+ *
+ * @return the contentType value
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Returns the fileName value.
+ *
+ * @return the fileName value
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Returns the fileSize value.
+ *
+ * @return the fileSize value
+ */
+ public Integer getFileSize() {
+ return fileSize;
+ }
+
+ /**
+ * Returns the inputStream value.
+ *
+ * @return the inputStream value
+ */
+ public InputStream getInputStream() {
+ return inputStream;
+ }
+ }
+
+ public abstract void setAccept(String accept);
+
+ public abstract String getAccept();
+
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String style);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFormattedText.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFormattedText.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFormattedText.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import javax.faces.component.UIOutput;
+
+import org.jboss.seam.text.SeamTextLexer;
+import org.jboss.seam.text.SeamTextParser;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.log.Log;
+
+import antlr.ANTLRException;
+import antlr.RecognitionException;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIFormattedText extends UIOutput {
+
+ Log log = Logging.getLog(UIFormattedText.class);
+
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.FormattedText";
+
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_FAMILY = "org.jboss.seam.ui.FormattedText";
+
+ public String getFormattedText()
+ {
+ if ( getValue() == null) return null;
+ Reader r = new StringReader( (String) getValue() );
+ SeamTextLexer lexer = new SeamTextLexer(r);
+ SeamTextParser parser = new SeamTextParser(lexer);
+ try
+ {
+ parser.startRule();
+ }
+ catch (RecognitionException rex) {
+ // Log a nice message for any lexer/parser errors, users can disable this if they want to
+ log.warn( "Seam Text parse error: " + rex.getMessage() );
+ } catch (ANTLRException ex) {
+ // All other errors are fatal;
+ throw new RuntimeException(ex);
+ }
+ return parser.toString();
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFragment.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFragment.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIFragment.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIFragment extends UIComponentBase {
+
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.Fragment";
+
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_FAMILY = "org.jboss.seam.ui.Fragment";
+
+ public static UIFragment newInstance() {
+ return (UIFragment) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILabel.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILabel.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILabel.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,69 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputLabel;
+
+
+public abstract class UILabel extends HtmlOutputLabel
+{
+
+ /**
+ * A depth-first search for an EditableValueHolder
+ */
+ protected static UIComponent getEditableValueHolder(UIComponent component)
+ {
+ if (component instanceof EditableValueHolder)
+ {
+ return component.isRendered() ? component : null;
+ }
+ for (Object child: component.getChildren())
+ {
+ if (child instanceof UIComponent)
+ {
+ UIComponent evh = getEditableValueHolder( (UIComponent) child );
+ if (evh!=null) return evh;
+ }
+ }
+ return null;
+ }
+
+ private static String getInputId(UIComponent cmp)
+ {
+ String forId = cmp instanceof UIDecorate ?
+ ( (UIDecorate) cmp ).getFor() : null;
+ if (forId==null)
+ {
+ UIComponent evh = getEditableValueHolder(cmp);
+ return evh==null ? null : evh.getId();
+ }
+ else
+ {
+ return forId;
+ }
+ }
+
+ private static String getFor(UIComponent component)
+ {
+
+ if ( component.getParent()==null )
+ {
+ return null;
+ }
+ else if (component instanceof UIDecorate)
+ {
+ return getInputId(component);
+ }
+ else
+ {
+ return getFor( component.getParent() );
+ }
+ }
+
+ @Override
+ public String getFor()
+ {
+ return getFor(this);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILink.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILink.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UILink.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UILink extends UISeamCommandBase {
+
+ public abstract String getStyleClass();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract String getStyle();
+
+ public abstract void setStyle(String style);
+
+ public abstract boolean isDisabled();
+
+ public abstract void setDisabled(boolean disabled);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIMessage.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIMessage.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIMessage.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,92 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlMessage;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIMessage extends HtmlMessage {
+
+ /**
+ * A depth-first search for an EditableValueHolder
+ */
+ protected static UIComponent getEditableValueHolder(UIComponent component)
+ {
+ if (component instanceof EditableValueHolder)
+ {
+ return component.isRendered() ? component : null;
+ }
+ for (Object child: component.getChildren())
+ {
+ if (child instanceof UIComponent)
+ {
+ UIComponent evh = getEditableValueHolder( (UIComponent) child );
+ if (evh!=null) return evh;
+ }
+ }
+ return null;
+ }
+
+ private static String getInputId(UIComponent cmp)
+ {
+ String forId = cmp instanceof UIDecorate ?
+ ( (UIDecorate) cmp ).getFor() : null;
+ if (forId==null)
+ {
+ UIComponent evh = getEditableValueHolder(cmp);
+ return evh==null ? null : evh.getId();
+ }
+ else
+ {
+ return forId;
+ }
+ }
+
+ private static String getFor(UIComponent component)
+ {
+
+ if ( component.getParent()==null )
+ {
+ return null;
+ }
+ else if (component instanceof UIDecorate)
+ {
+ return getInputId(component);
+ }
+ else
+ {
+ return getFor( component.getParent() );
+ }
+ }
+
+ @Override
+ public String getFor()
+ {
+ return getFor(this);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIRemote.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIRemote.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIRemote.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,17 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * Tag that auto-generates script imports for Seam Remoting
+ *
+ * @author Shane Bryzak
+ */
+public abstract class UIRemote extends UIComponentBase
+{
+
+ public abstract String getInclude();
+
+ public abstract void setInclude(String include);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIResource.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIResource.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIResource.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,41 @@
+package org.jboss.seam.ui.component;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Daniel Roth
+ */
+public abstract class UIResource extends UIComponentBase
+{
+
+ public abstract Object getData();
+
+ public abstract void setData(Object data);
+
+ public abstract String getContentType();
+
+ public abstract void setContentType(String contentType);
+
+ public abstract String getDisposition();
+
+ public abstract void setDisposition(String disposition);
+
+ public abstract String getFileName();
+
+ public abstract void setFileName(String fileName);
+
+ @Override
+ public void encodeBegin(FacesContext arg0) throws IOException
+ {
+ if (!(getParent() instanceof UIViewRoot || getParent() instanceof UIDownload))
+ {
+ throw new IllegalArgumentException("s:remote must be nested in a s:download or alone in the page");
+ }
+ super.encodeBegin(arg0);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISeamCommandBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISeamCommandBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISeamCommandBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,232 @@
+package org.jboss.seam.ui.component;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.el.ValueExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionListener;
+import javax.faces.model.DataModel;
+
+import org.jboss.seam.core.PropagationType;
+import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.ui.util.ViewUrlBuilder;
+import org.jboss.seam.ui.util.cdk.MethodBindingToMethodExpression;
+
+public abstract class UISeamCommandBase extends UIOutput implements ActionSource2
+{
+
+ private static Class PORTLET_REQUEST;
+
+ static
+ {
+ try
+ {
+ PORTLET_REQUEST = Class.forName("javax.portlet.PortletRequest");
+ }
+ catch (Exception e) {}
+ }
+
+ public abstract String getView();
+
+ public String getUrl() throws UnsupportedEncodingException
+ {
+ String encodedUrl;
+ FacesContext context = getFacesContext();
+ String viewId = getView();
+ if (viewId == null)
+ {
+ viewId = Pages.getViewId(getFacesContext());
+ }
+
+ ViewUrlBuilder url = new ViewUrlBuilder(viewId, getFragment(), !isPortletRequest(getFacesContext()));
+
+ Set<String> usedParameters = new HashSet<String>();
+ for (Object child : getChildren())
+ {
+ if (child instanceof UIParameter)
+ {
+ usedParameters.add(((UIParameter) child).getName());
+ url.addParameter((UIParameter) child);
+ }
+ }
+
+ if (viewId != null && isIncludePageParams())
+ {
+ Map<String, Object> pageParameters = Pages.instance().getStringValuesFromModel(context, viewId, usedParameters);
+ for (Map.Entry<String, Object> me : pageParameters.entrySet())
+ {
+ UIParameter uip = new UIParameter();
+ uip.setName(me.getKey());
+ uip.setValue(me.getValue());
+ url.addParameter(uip);
+ }
+ }
+
+ if (getActionExpression() != null)
+ {
+
+ UIAction uiAction = new UIAction();
+ uiAction.setAction(getActionExpression().getExpressionString());
+ url.addParameter(uiAction);
+ }
+
+ PropagationType propagationType = PropagationType.valueOf(getPropagation().toUpperCase());
+ if (propagationType == PropagationType.DEFAULT || propagationType == PropagationType.JOIN ||
+ propagationType == PropagationType.NESTED || propagationType == PropagationType.END)
+ {
+ UIConversationId uiConversationId = UIConversationId.newInstance();
+ uiConversationId.setViewId(viewId);
+ url.addParameter(uiConversationId);
+ }
+
+ if (propagationType == PropagationType.JOIN || propagationType == PropagationType.NESTED ||
+ propagationType == PropagationType.BEGIN || propagationType == PropagationType.END)
+ {
+ UIConversationPropagation uiPropagation = UIConversationPropagation.newInstance();
+ uiPropagation.setType(getPropagation());
+ uiPropagation.setPageflow(getPageflow());
+ url.addParameter(uiPropagation);
+ }
+
+ if (getConversationName() != null)
+ {
+ UIConversationName name = UIConversationName.newInstance();
+ name.setValue(getConversationName());
+ url.addParameter(name);
+ }
+
+ ValueExpression taskInstanceValueExpression = getValueExpression("taskInstance");
+ if (taskInstanceValueExpression != null)
+ {
+ UITaskId uiTaskId = UITaskId.newInstance();
+ uiTaskId.setValueExpression("taskInstance", taskInstanceValueExpression);
+ url.addParameter(uiTaskId);
+ }
+
+ if (!usedParameters.contains("dataModelSelection"))
+ {
+ UISelection uiSelection = getSelection();
+ if (uiSelection != null)
+ {
+ url.addParameter(uiSelection);
+ }
+ }
+ encodedUrl = url.getEncodedUrl();
+
+ return encodedUrl;
+ }
+
+ public abstract void setView(String view);
+
+ public abstract String getPropagation();
+
+ public abstract void setPropagation(String propagtion);
+
+ public abstract String getPageflow();
+
+ public abstract void setPageflow(String pageflow);
+
+ public abstract String getFragment();
+
+ public abstract void setFragment(String fragment);
+
+ public abstract void setConversationName(String name);
+
+ public abstract String getConversationName();
+
+ public abstract void setIncludePageParams(boolean value);
+
+ public abstract boolean isIncludePageParams();
+
+ public UISelection getSelection()
+ {
+ UIData parentUIData = getParentUIData();
+ if (parentUIData != null)
+ {
+ if (parentUIData.getValue() instanceof DataModel)
+ {
+ String dataModelExpression = parentUIData.getValueExpression("value")
+ .getExpressionString();
+ String dataModelName = dataModelExpression.substring(2,
+ dataModelExpression.length() - 1).replace('$', '.');
+ UISelection uiSelection = UISelection.newInstance();
+ uiSelection.setDataModel(dataModelName);
+ uiSelection.setVar(parentUIData.getVar());
+ return uiSelection;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+
+ public UIData getParentUIData()
+ {
+ UIComponent parent = this.getParent();
+ while (parent != null)
+ {
+ if (parent instanceof UIData)
+ {
+ return (UIData) parent;
+ }
+ else
+ {
+ parent = parent.getParent();
+ }
+ }
+ return null;
+ }
+
+ public void removeActionListener(ActionListener listener)
+ {
+ // Silently fail, RF requires this
+ //throw new UnsupportedOperationException("Action listeners not supported by s:link/s:button");
+ }
+
+ public ActionListener[] getActionListeners()
+ {
+ // Silently fail, RF requires this
+ //throw new UnsupportedOperationException("Action listeners not supported by s:link/s:button");
+ return null;
+ }
+
+ public void addActionListener(ActionListener listener)
+ {
+ // Silently fail, RF requires this
+ //throw new UnsupportedOperationException("Action listeners not supported by s:link/s:button");
+ }
+
+ @Deprecated
+ public void setAction(javax.faces.el.MethodBinding methodBinding)
+ {
+ setActionExpression(new MethodBindingToMethodExpression(methodBinding));
+ }
+
+ @Deprecated
+ public javax.faces.el.MethodBinding getAction()
+ {
+ return new org.jboss.seam.ui.util.cdk.MethodExpressionToMethodBinding(getActionExpression());
+ }
+
+ private static boolean isPortletRequest(FacesContext facesContext)
+ {
+ return PORTLET_REQUEST !=null &&
+ PORTLET_REQUEST.isInstance( facesContext.getExternalContext().getRequest() );
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelectItems.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelectItems.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelectItems.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,318 @@
+package org.jboss.seam.ui.component;
+
+import static org.jboss.seam.util.Strings.emptyIfNull;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.ValueHolder;
+import javax.faces.convert.Converter;
+
+import javax.faces.model.DataModel;
+
+import org.jboss.seam.framework.Query;
+import org.jboss.seam.ui.converter.ConverterChain;
+import org.jboss.seam.ui.converter.NoSelectionConverter;
+
+
+/**
+ * @auth Pete Muir
+ *
+ */
+public abstract class UISelectItems extends javax.faces.component.UISelectItems {
+
+ private List<javax.faces.model.SelectItem> selectItems;
+ private Object originalValue;
+
+ private class NullableSelectItem extends javax.faces.model.SelectItem
+ {
+
+ private Object value;
+
+ private NullableSelectItem(Object value, String label)
+ {
+ super.setLabel(label);
+ this.value = value;
+ }
+
+ @Override
+ public Object getValue()
+ {
+ return value;
+ }
+
+ }
+
+ private abstract class ContextualSelectItem {
+
+ private Object varValue;
+
+ public ContextualSelectItem(Object varValue)
+ {
+ if (varValue == null)
+ {
+ throw new FacesException("var attribute must be set");
+ }
+ this.varValue = varValue;
+ }
+
+ /**
+ * @return the varValue
+ */
+ protected Object getVarValue()
+ {
+ return this.varValue;
+ }
+
+ private void setup()
+ {
+ getFacesContext().getExternalContext().getRequestMap().put(getVar(), varValue);
+ }
+
+ private void cleanup()
+ {
+ getFacesContext().getExternalContext().getRequestMap().remove(getVar());
+ }
+
+ protected abstract Object getSelectItemValue();
+ protected abstract String getSelectItemLabel();
+ protected abstract Boolean getSelectItemDisabled();
+ protected abstract Boolean getSelectItemEscape();
+
+ protected javax.faces.model.SelectItem create()
+ {
+ try
+ {
+ setup();
+ return new javax.faces.model.SelectItem(this.getSelectItemValue(), this.getSelectItemLabel(), "", this.getSelectItemDisabled(), this.getSelectItemEscape());
+ }
+ finally
+ {
+ cleanup();
+ }
+ }
+ }
+
+ private static final String NO_SELECTION_VALUE = null;
+
+ /* Kinder impl of get/setLabel */
+
+ private String label;
+
+ public String getLabel()
+ {
+ ValueExpression ve = getValueExpression("label");
+ if (ve != null)
+ {
+ Object object = ve.getValue(getFacesContext().getELContext());
+ if (object != null)
+ {
+ return object.toString();
+ }
+ }
+ return label;
+ }
+
+ public void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+
+ public abstract void setHideNoSelectionLabel(Boolean hideNoSelectionLabel);
+
+ public abstract Boolean getHideNoSelectionLabel();
+
+ public abstract String getNoSelectionLabel();
+
+ public abstract void setNoSelectionLabel(String noSelectionLabel);
+
+ public abstract String getVar();
+
+ public abstract void setVar(String var);
+
+ public abstract Boolean getDisabled();
+
+ public abstract void setDisabled(Boolean disabled);
+
+ public abstract Boolean getEscape();
+
+ public abstract void setEscape(Boolean escape);
+
+ public abstract Object getItemValue();
+
+ public abstract void setItemValue(Object itemValue);
+
+ @Override
+ public Object getValue()
+ {
+ List<javax.faces.model.SelectItem> temporarySelectItems = new ArrayList<javax.faces.model.SelectItem>();
+ javax.faces.model.SelectItem noSelectionLabel = noSelectionLabel();
+ if (noSelectionLabel != null)
+ {
+ temporarySelectItems.add(noSelectionLabel);
+ }
+ if (selectItems == null || originalValue == null || !originalValue.equals(super.getValue()))
+ {
+ originalValue = super.getValue();
+ selectItems = new ArrayList<javax.faces.model.SelectItem>();
+
+ if (originalValue instanceof Iterable)
+ {
+ selectItems.addAll(asSelectItems((Iterable) originalValue));
+ }
+ else if (originalValue instanceof DataModel && ((DataModel) originalValue).getWrappedData() instanceof Iterable)
+ {
+ selectItems.addAll(asSelectItems((Iterable) ((DataModel) originalValue).getWrappedData()));
+ }
+ else if (originalValue instanceof Query)
+ {
+ selectItems.addAll(asSelectItems(((Query) originalValue).getResultList()));
+ }
+ else if (originalValue != null && originalValue.getClass().isArray())
+ {
+ selectItems.addAll(asSelectItems(arrayAsList(originalValue)));
+ }
+ else if (temporarySelectItems.size() == 0)
+ {
+ return originalValue;
+ }
+
+ }
+ temporarySelectItems.addAll(selectItems);
+ return temporarySelectItems;
+ }
+
+ private List<javax.faces.model.SelectItem> asSelectItems(Iterable iterable)
+ {
+ List<javax.faces.model.SelectItem> selectItems = new ArrayList<javax.faces.model.SelectItem>();
+ for (final Object o : iterable)
+ {
+ selectItems.add(new ContextualSelectItem(o)
+ {
+
+ @Override
+ protected Boolean getSelectItemDisabled()
+ {
+ Boolean disabled = getDisabled();
+ return disabled == null ? false : disabled;
+ }
+
+ @Override
+ protected Boolean getSelectItemEscape()
+ {
+ Boolean escape = getEscape();
+ return escape == null ? true : escape;
+ }
+
+ @Override
+ protected String getSelectItemLabel()
+ {
+ return emptyIfNull(getLabel());
+ }
+
+ @Override
+ protected Object getSelectItemValue()
+ {
+ Object value = getItemValue();
+ return value == null ? getVarValue() : value;
+ }
+
+ }.create());
+ }
+ return selectItems;
+ }
+
+
+
+ private javax.faces.model.SelectItem noSelectionLabel()
+ {
+ if (isShowNoSelectionLabel())
+ {
+ NullableSelectItem s = new NullableSelectItem(NO_SELECTION_VALUE, getNoSelectionLabel());
+ ConverterChain converterChain = new ConverterChain(this.getParent());
+ Converter noSelectionConverter = new NoSelectionConverter();
+ // Make sure that the converter is only added once
+ if (!converterChain.containsConverterType(noSelectionConverter)) {
+ converterChain.addConverterToChain(noSelectionConverter, ConverterChain.CHAIN_START);
+ }
+ return s;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private boolean isShowNoSelectionLabel()
+ {
+ ValueExpression vb = getValueExpression("noSelectionLabel");
+ String noSelectionLabel = getNoSelectionLabel();
+ Boolean hideNoSelectionLabel = getHideNoSelectionLabel();
+ Object parentValue = getParentValue();
+
+ /*
+ * This is a slight hack. If you do an EL expresison like this (to hide the label)
+ *
+ * noSelectionLabel="#{x eq y ? 'Please Select' : null}"
+ *
+ * then, if x != y, EL will return an empty String, not null, so we work around that, with the side effect
+ * that if the result of the EL expression is an empty String, then the label will be hidden.
+ */
+ if (noSelectionLabel != null && vb == null && !(hideNoSelectionLabel && parentValue != null))
+ {
+ /*
+ * Here, the user has specfied a noSelectionLabel (may be an empty string), and, if hideNoSelectionLabel
+ * is set, then, if a value is selected, then the label is hidden
+ */
+ return true;
+ }
+ else if (noSelectionLabel != null && !"".equals(noSelectionLabel) && !(hideNoSelectionLabel && parentValue != null))
+ {
+ /*
+ * Here, the user has used an EL expression as the noSelectionLabel. In this case, an empty string is
+ * indicates that the label should be hidden.
+ */
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private Object getParentValue()
+ {
+ if (getParent() instanceof ValueHolder)
+ {
+ ValueHolder parent = (ValueHolder) getParent();
+ return parent.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private static List arrayAsList(Object array)
+ {
+ if (array.getClass().getComponentType().isPrimitive())
+ {
+ List list = new ArrayList();
+ for (int i = 0; i < Array.getLength(array); i++)
+ {
+ list.add(Array.get(array, i));
+ }
+ return list;
+ }
+ else
+ {
+ return Arrays.asList((Object[]) array);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelection.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelection.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISelection.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModel;
+
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UISelection extends UIParameter {
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.Selection";
+
+ @Override
+ public String getName()
+ {
+ return "dataModelSelection";
+ }
+
+ @Override
+ public Object getValue()
+ {
+ Object value = Contexts.lookupInStatefulContexts(getDataModel());
+ if (value==null)
+ {
+ return null;
+ }
+ else
+ {
+ int rowIndex = ( (DataModel) value ).getRowIndex();
+ return rowIndex<0 ? null : getVar() + ':' + getDataModel() + '[' + rowIndex + ']';
+ }
+ }
+
+ public abstract String getDataModel();
+
+ public abstract void setDataModel(String dataModel);
+
+ public abstract String getVar();
+
+ public abstract void setVar(String var);
+
+ public static UISelection newInstance() {
+ return (UISelection) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISpan.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISpan.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UISpan.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,10 @@
+package org.jboss.seam.ui.component;
+
+public abstract class UISpan extends UIStyle
+{
+
+ public abstract String getTitle();
+
+ public abstract void setTitle(String title);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIStyle.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIStyle.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIStyle.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,17 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+
+
+public abstract class UIStyle extends UIComponentBase
+{
+
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String style);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UITaskId.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UITaskId.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UITaskId.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,56 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.component;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jbpm.taskmgmt.exe.TaskInstance;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UITaskId extends UIParameter {
+
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.TaskId";
+
+ @Override
+ public String getName()
+ {
+ return "taskId";
+ }
+
+ @Override
+ public Object getValue()
+ {
+ ValueExpression valueExpression = getValueExpression("taskInstance");
+ if (valueExpression==null) valueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), "#{task}", TaskInstance.class);
+ TaskInstance taskInstance = (TaskInstance) valueExpression.getValue( getFacesContext().getELContext() );
+ return taskInstance==null ? null : taskInstance.getId();
+ }
+
+ public static UITaskId newInstance() {
+ return (UITaskId) FacesContext.getCurrentInstance().getApplication().createComponent(COMPONENT_TYPE);
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIToken.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIToken.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIToken.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,126 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ui.ClientUidSelector;
+import org.jboss.seam.ui.UnauthorizedCommandException;
+
+/**
+ * <p>
+ * <strong>UIToken</strong> is a UIComponent that produces a random token that
+ * is inserted into a hidden form field to help to secure JSF form posts against
+ * cross-site request forgery (XSRF) attacks. This is an adaptation of the
+ * recommendation called Keyed‐Hashing for Message Authentication that is
+ * referenced in the Cross Site Reference Forgery by Jesse Burns
+ * (http://www.isecpartners.com/files/XSRF_Paper_0.pdf)
+ * </p>
+ *
+ * <p>
+ * When placed inside a form, this component will first assign a unique
+ * identifier to the browser using a cookie that lives until the end of the
+ * browser session. This is roughly the browser's private key. Then a unique
+ * token is generated using various pieces of information that comprise the
+ * form's signature. The token may or may not be bound to the session id, as
+ * indicated by the value of the requireSession attribute. The token value is
+ * stored in the hidden form field named javax.faces.FormSignature.
+ * </p>
+ *
+ * <p>
+ * There is an assumption when using this component that the browser supports
+ * cookies. Cookies are the only universally available persistent mechanism that
+ * can give the browser an identifiable signature. It's important to know that
+ * the browser submitting the form is the same browser that is requesting the
+ * form.
+ * </p>
+ *
+ * <p>
+ * During the decode process, the token is generated using the same algorithm
+ * that was used during rendering and compared with the value of the request
+ * parameter javax.faces.FormSignature. If the same token value can be produced,
+ * then the form submission is permitted. Otherwise, an
+ * {@link UnauthorizedCommandException} is thrown indicating the reason for the
+ * failure.
+ * </p>
+ *
+ * <p>
+ * The UIToken can be combined with client-side state saving or the
+ * "build before restore" strategy to unbind a POST from the session that
+ * created the view without sacrificing security. However, it's still the most
+ * secure to require the view state to be present in the session (JSF 1.2
+ * server-side state saving).
+ * </p>
+ *
+ * <p>
+ * Please note that this solution isn't a complete panacea. If your site is
+ * vulnerable to XSS or the connection to wire-tapping, then the unique browser
+ * identifier can be revealed and a request forged.
+ * </p>
+ *
+ * @author Dan Allen
+ */
+public abstract class UIToken extends UIOutput
+{
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_TYPE = "org.jboss.seam.ui.Token";
+
+ @SuppressWarnings("unused")
+ private static final String COMPONENT_FAMILY = "org.jboss.seam.ui.Token";
+
+ /**
+ * Indicates whether the session id should be included in the form signature,
+ * hence binding the token to the session. This value can be set to false
+ * if the "build before restore" mode of Facelets is activated (the
+ * default in JSF 2.0). The default value is false.
+ */
+ public abstract boolean isRequireSession();
+
+ public abstract void setRequireSession(boolean required);
+
+ /**
+ * Indicates whether a JavaScript check should be inserted into the page to
+ * verify that cookies are enabled in the browser. If cookies are not
+ * enabled, present a notice to the user that form posts will not work.
+ * The default value is false.
+ */
+ public abstract boolean isEnableCookieNotice();
+
+ public abstract void setEnableCookieNotice(boolean state);
+
+ /**
+ * Indicates whether to allow the same form to be submitted multiple times
+ * with the same signature (as long as the view does not change). This is a
+ * common need if the form is perform Ajax calls but not rerendering itself
+ * or, at the very least, the UIToken component. The preferred approach is to
+ * have the UIToken component rerendered on any Ajax call where the UIToken
+ * component would be processed. The default value is false.
+ */
+ public abstract boolean isAllowMultiplePosts();
+
+ public abstract void setAllowMultiplePosts(boolean allow);
+
+ /**
+ * Return the selector that controls the unique browser identifier cookie.
+ */
+ public ClientUidSelector getClientUidSelector() {
+ return (ClientUidSelector) Component.getInstance(ClientUidSelector.class);
+ }
+
+ public String getClientUid() {
+ return getClientUidSelector().getClientUid();
+ }
+
+ public UIForm getParentForm() {
+ UIComponent parent = getParent();
+ while (parent != null) {
+ if (parent instanceof UIForm) {
+ return (UIForm) parent;
+ }
+ parent = parent.getParent();
+ }
+
+ return null;
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIValidateAll.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIValidateAll.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/component/UIValidateAll.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,24 @@
+package org.jboss.seam.ui.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIValidateAll extends UIComponentBase
+{
+
+ // TODO Make this a hidden=true, el=false property in validateAll.xml
+ private boolean validatorsAdded = false;
+
+ public boolean isValidatorsAdded()
+ {
+ return validatorsAdded;
+ }
+
+ public void setValidatorsAdded(boolean validatorsAdded)
+ {
+ this.validatorsAdded = validatorsAdded;
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicBooleanConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicBooleanConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicBooleanConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,44 @@
+package org.jboss.seam.ui.converter;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicBooleanConverter implements Converter
+{
+
+ public Object getAsObject(FacesContext ctx, UIComponent ui, String string)
+ {
+ return string != null && string.trim().length() > 0 ? new AtomicBoolean(Boolean.parseBoolean(string.trim())) : null;
+ }
+
+ public String getAsString(FacesContext ctx, UIComponent ui, Object object)
+ {
+ String string = "";
+ if (object != null)
+ {
+ if (object instanceof String)
+ {
+ string = (String) object;
+ }
+ else if (object instanceof AtomicBoolean)
+ {
+ string = ((AtomicBoolean) object).toString();
+ }
+ else
+ {
+ throw new ConverterException("Received an instance of " + object.getClass().getName() + ", but was expecting an instance of " + AtomicInteger.class.getName());
+ }
+ }
+ return string;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicIntegerConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicIntegerConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicIntegerConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,55 @@
+package org.jboss.seam.ui.converter;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicIntegerConverter implements Converter
+{
+
+ public Object getAsObject(FacesContext ctx, UIComponent ui, String value)
+ {
+ Object object = null;
+ if (value != null && value.trim().length() > 0)
+ {
+ try
+ {
+ object = new AtomicInteger(Integer.parseInt(value.trim()));
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new ConverterException(nfe);
+ }
+ }
+ return object;
+ }
+
+ public String getAsString(FacesContext ctx, UIComponent ui, Object object)
+ {
+ String string = "";
+ if (object != null)
+ {
+ if (object instanceof String)
+ {
+ string = (String) object;
+ }
+ else if (object instanceof AtomicInteger)
+ {
+ string = ((AtomicInteger) object).toString();
+ }
+ else
+ {
+ throw new ConverterException("Received an instance of " + object.getClass().getName() + ", but was expecting an instance of " + AtomicInteger.class.getName());
+ }
+ }
+ return string;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicLongConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicLongConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/AtomicLongConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,54 @@
+package org.jboss.seam.ui.converter;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicLongConverter implements Converter
+{
+
+ public Object getAsObject(FacesContext ctx, UIComponent ui, String value)
+ {
+ Object object = null;
+ if (value != null && value.trim().length() > 0)
+ {
+ try
+ {
+ object = new AtomicLong(Long.parseLong(value.trim()));
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new ConverterException(nfe);
+ }
+ }
+ return object;
+ }
+
+ public String getAsString(FacesContext ctx, UIComponent ui, Object object)
+ {
+ String string = "";
+ if (object != null)
+ {
+ if (object instanceof String)
+ {
+ string = (String) object;
+ }
+ else if (object instanceof AtomicLong)
+ {
+ string = ((AtomicLong) object).toString();
+ }
+ else
+ {
+ throw new ConverterException("Received an instance of " + object.getClass().getName() + ", but was expecting an instance of " + AtomicLong.class.getName());
+ }
+ }
+ return string;
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/ConverterChain.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/ConverterChain.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/ConverterChain.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,230 @@
+package org.jboss.seam.ui.converter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.el.ValueExpression;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * This class provides a chainable converter for JSF.
+ *
+ * Any JSF converter can be placed at the end of the chain. A converter that is
+ * placed higher up the chain should return ConverterChain.CONTINUE if
+ * conversion has failed. If the all converters run return
+ * ConverterChain.CONTINUE an unconverted value will be returned.
+ *
+ * A converter can be placed in the chain with a priority, the order in which
+ * converters with the same priority is run is not specified.
+ *
+ */
+public class ConverterChain implements Converter, StateHolder
+{
+
+ public static final String CONTINUE = "org.jboss.seam.ui.ConverterChain.continue";
+
+ /**
+ * This places the converter at the end of the chain. No garuntee is made
+ * about the order converters which are placed on the queue with this
+ * priority will be run
+ */
+ public static final int CHAIN_END = Integer.MAX_VALUE;
+
+ /**
+ * This places the converter at the head of the chain. No garuntee is made
+ * about the order converters which are placed on the queue with this
+ * priority will be run
+ */
+ public static final int CHAIN_START = 0;
+
+ private List<PrioritizableConverter> converters;
+
+ private boolean dirty;
+
+ public ConverterChain()
+ {
+ // A Priority Queue would be nice but JSF has issues serializing that
+ converters = new ArrayList<PrioritizableConverter>();
+ }
+
+ /**
+ * Set up a ConverterChain for this component.
+ *
+ * This replaces any existing converter with a ConverterChain with the
+ * existing Converter at the end of the chain
+ *
+ * @param component
+ */
+ public ConverterChain(UIComponent component)
+ {
+ this();
+ if (component instanceof ValueHolder)
+ {
+ ValueHolder valueHolder = (ValueHolder) component;
+ if (!(valueHolder.getConverter() instanceof ConverterChain))
+ {
+ ValueExpression converterValueExpression = component.getValueExpression("converter");
+ if (converterValueExpression != null)
+ {
+ addConverterToChain(converterValueExpression);
+ }
+ else if (valueHolder.getConverter() != null)
+ {
+ addConverterToChain(valueHolder.getConverter());
+ }
+ else
+ {
+ ValueExpression valueExpression = component.getValueExpression("value");
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (valueExpression != null)
+ {
+ Class<?> type = valueExpression.getType(facesContext.getELContext());
+ if (type != null)
+ {
+ Converter converter = facesContext.getApplication().createConverter(type);
+ if (converter != null)
+ {
+ addConverterToChain(converter);
+ }
+ }
+ }
+ }
+ valueHolder.setConverter(this);
+ }
+ }
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
+ throws ConverterException
+ {
+ Object output = value;
+ for (Converter converter : getConverters())
+ {
+ Object result = converter.getAsObject(context, component, value);
+ if (!CONTINUE.equals(result))
+ {
+ output = result;
+ break;
+ }
+ }
+ return output;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value)
+ throws ConverterException
+ {
+ String output = value == null ? null : value.toString();
+ for (Converter converter : getConverters())
+ {
+ String result = converter.getAsString(context, component, value);
+ if (!CONTINUE.equals(result))
+ {
+ output = result;
+ break;
+ }
+ }
+ return output;
+ }
+
+ /**
+ * Add a converter to the end of the chain
+ */
+ public boolean addConverterToChain(Converter c)
+ {
+ return addConverterToChain(c, CHAIN_END);
+ }
+
+ /**
+ * Add a converter to the end of the chain
+ */
+ public boolean addConverterToChain(ValueExpression c)
+ {
+ return addConverterToChain(c, CHAIN_END);
+ }
+
+ /**
+ * Add a converter to the chain with a defined priority
+ */
+ public boolean addConverterToChain(Converter c, int priority)
+ {
+ if (c != null)
+ {
+ dirty = true;
+ return converters.add(new PrioritizableConverter(c, priority));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Add a converter to the chain with a defined priority
+ */
+ public boolean addConverterToChain(ValueExpression c, int priority)
+ {
+ if (c != null)
+ {
+ dirty = true;
+ return converters.add(new PrioritizableConverter(c, priority));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private boolean _transient;
+
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] values = (Object[]) state;
+ converters = (List<PrioritizableConverter>) UIComponentBase.restoreAttachedState(context,
+ values[0]);
+ dirty = true;
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ Object[] values = new Object[1];
+ values[0] = UIComponentBase.saveAttachedState(context, converters);
+ return values;
+ }
+
+ public void setTransient(boolean newTransientValue)
+ {
+ this._transient = newTransientValue;
+
+ }
+
+ private List<PrioritizableConverter> getConverters()
+ {
+ if (dirty)
+ {
+ Collections.sort(converters);
+ }
+ return converters;
+ }
+
+ public boolean containsConverterType(Converter converter) {
+ // TODO Improve this
+ for (Converter c : converters) {
+ if (c.getClass().equals(converter.getClass())) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/DateTimeConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/DateTimeConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/DateTimeConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,48 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.converter;
+
+import java.util.TimeZone;
+
+import org.jboss.seam.contexts.Contexts;
+
+public class DateTimeConverter extends javax.faces.convert.DateTimeConverter{
+
+ public DateTimeConverter()
+ {
+ setTimeZone( getTimeZone() );
+ }
+
+ @Override
+ public TimeZone getTimeZone()
+ {
+ if ( Contexts.isApplicationContextActive() )
+ {
+ return org.jboss.seam.international.TimeZone.instance();
+ }
+ else
+ {
+ return TimeZone.getDefault();
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/EnumConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,65 @@
+package org.jboss.seam.ui.converter;
+
+import java.util.Collection;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+
+public class EnumConverter implements javax.faces.convert.Converter
+{
+ public Object getAsObject(FacesContext context, UIComponent comp, String value)
+ throws ConverterException
+ {
+ ValueExpression expr = comp.getValueExpression("value");
+
+ Class enumType = expr == null ? null : expr.getType(context.getELContext());
+ if (enumType != null && enumType.isEnum())
+ {
+ return Enum.valueOf(enumType, value);
+ }
+ else
+ {
+ for (Object child : comp.getChildren())
+ {
+ if (child instanceof UIComponent)
+ {
+ UIComponent c = (UIComponent) child;
+ expr = c.getValueExpression("value");
+ Object val = expr == null ? null : expr.getValue(context.getELContext());
+ if (val == null)
+ {
+ throw new ConverterException("Cannot get items");
+ }
+
+ Class t = val.getClass();
+ if (t.isArray() && t.getComponentType().isEnum())
+ {
+ return Enum.valueOf(t.getComponentType(), value);
+ }
+ else if (val instanceof Collection)
+ {
+ Object firstItem = ((Collection) val).iterator().next();
+ if (firstItem instanceof Enum) {
+ t = ((Enum) firstItem).getDeclaringClass();
+ } else {
+ t = firstItem.getClass();
+ }
+
+ return Enum.valueOf(t, value);
+ }
+ }
+ }
+ }
+
+ throw new ConverterException("Unable to find selectItems with enum values.");
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object object)
+ throws ConverterException
+ {
+ return object == null ? null : ((Enum) object).name();
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/NoSelectionConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/NoSelectionConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/NoSelectionConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,32 @@
+package org.jboss.seam.ui.converter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+public class NoSelectionConverter implements Converter
+{
+ public static final String NO_SELECTION_VALUE = "org.jboss.seam.ui.NoSelectionConverter.noSelectionValue";
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException
+ {
+ if (value == null) {
+ return null;
+ } else if (value.equals(NO_SELECTION_VALUE)) {
+ return null;
+ } else {
+ return ConverterChain.CONTINUE;
+ }
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException
+ {
+ if (value == null) {
+ return NO_SELECTION_VALUE;
+ } else {
+ return ConverterChain.CONTINUE;
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/PrioritizableConverter.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/PrioritizableConverter.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/converter/PrioritizableConverter.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,104 @@
+package org.jboss.seam.ui.converter;
+
+import javax.el.ValueExpression;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * Helper class for ConverterChain
+ *
+ */
+public class PrioritizableConverter implements Converter, Comparable<PrioritizableConverter>,
+ StateHolder
+{
+
+ private ValueExpression valueExpression;
+
+ private Converter delegate;
+
+ private int priority;
+
+ public PrioritizableConverter()
+ {
+ }
+
+ public PrioritizableConverter(ValueExpression vb, int priority)
+ {
+ this.valueExpression = vb;
+ this.priority = priority;
+ }
+
+ public PrioritizableConverter(Converter delegate, int priority)
+ {
+ this.delegate = delegate;
+ this.priority = priority;
+ }
+
+ public Converter getDelegate()
+ {
+ if (valueExpression != null)
+ {
+ return (Converter) valueExpression.getValue(FacesContext.getCurrentInstance().getELContext());
+ }
+ else
+ {
+ return delegate;
+ }
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value)
+ throws ConverterException
+ {
+ return getDelegate().getAsObject(context, component, value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value)
+ throws ConverterException
+ {
+ return getDelegate().getAsString(context, component, value);
+ }
+
+ public int compareTo(PrioritizableConverter o)
+ {
+ return this.getPriority() - o.getPriority();
+ }
+
+ private boolean _transient;
+
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] values = (Object[]) state;
+ delegate = (Converter) UIComponentBase.restoreAttachedState(context, values[0]);
+ priority = (Integer) values[1];
+ valueExpression = (ValueExpression) values[2];
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ Object[] values = new Object[3];
+ values[0] = UIComponentBase.saveAttachedState(context, delegate);
+ values[1] = priority;
+ values[2] = valueExpression;
+ return values;
+ }
+
+ public void setTransient(boolean newTransientValue)
+ {
+ this._transient = newTransientValue;
+
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletCompiler.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,66 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+import com.sun.faces.application.ApplicationAssociate;
+import com.sun.faces.facelets.compiler.SAXCompiler;
+
+ at Name("org.jboss.seam.ui.faces.facelet.faceletCompiler")
+ at Scope(APPLICATION)
+ at BypassInterceptors
+ at AutoCreate
+ at Install(value = true, precedence = Install.BUILT_IN, classDependencies="com.sun.faces.facelets.Facelet")
+public class FaceletCompiler
+{
+
+ private LogProvider log = Logging.getLogProvider(FaceletCompiler.class);
+ private com.sun.faces.facelets.compiler.Compiler compiler;
+
+ @Create
+ public void create()
+ {
+ compiler = new SAXCompiler();
+ // fill the necessary parameters
+ initializeCompiler(compiler);
+ }
+
+ /*
+ * This method cribbed from FaceletViewHandler
+ */
+ protected void initializeCompiler(com.sun.faces.facelets.compiler.Compiler compiler)
+ {
+ compiler = ApplicationAssociate.getCurrentInstance().getCompiler();
+ }
+
+
+ @Unwrap
+ public com.sun.faces.facelets.compiler.Compiler unwrap()
+ {
+ return compiler;
+ }
+
+ public static com.sun.faces.facelets.compiler.Compiler instance()
+ {
+ if ( !Contexts.isApplicationContextActive() )
+ {
+ throw new IllegalStateException("No active application scope");
+ }
+ return (com.sun.faces.facelets.compiler.Compiler) Component.getInstance(FaceletCompiler.class, ScopeType.APPLICATION);
+ }
+
+}
+
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsJBossLogging.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsJBossLogging.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsJBossLogging.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,111 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.lang.reflect.Field;
+import java.util.logging.Filter;
+import java.util.logging.Logger;
+
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.interop.jul.Log4JConversionFilter;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.util.Reflections;
+
+import com.sun.faces.facelets.impl.DefaultFaceletFactory;
+import com.sun.faces.facelets.tag.jsf.core.ViewHandler;
+import com.sun.faces.facelets.util.Resource;
+import javax.faces.view.facelets.ComponentHandler;
+
+ at Name("org.jboss.seam.ui.facelet.faceletsJBossLogging")
+ at Scope(APPLICATION)
+ at Install(classDependencies={"com.sun.faces.facelets.Facelet", "org.jboss.logging.Logger", "org.apache.log4j.Logger", "org.jboss.seam.interop.jul.Log4JConversionFilter"}, precedence=BUILT_IN)
+ at Startup
+ at BypassInterceptors
+public class FaceletsJBossLogging
+{
+
+ private LogProvider log = Logging.getLogProvider(FaceletsJBossLogging.class);
+
+ @SuppressWarnings("deprecation")
+ @Create
+ public void create()
+ {
+ Filter conversionFilter = null;
+ try
+ {
+ conversionFilter = new Log4JConversionFilter();
+ }
+ catch (Exception e)
+ {
+ // Filter isn't installed in the container
+ return;
+ }
+ try
+ {
+
+
+ java.util.logging.Logger julLogger;
+
+ // Gah have to do this by reflection as the loggers are protected
+
+ // And some aren't static, so this really is best effort
+
+// julLogger = getPrivateStaticLogger(TagLibraryConfig.class, "log");
+// julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger(com.sun.faces.facelets.compiler.Compiler.class, "log");
+ julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger(DefaultFaceletFactory.class, "log");
+ julLogger.setFilter(conversionFilter);
+
+// julLogger = getPrivateStaticLogger(TagLibraryConfig.class, "log");
+// julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger(ComponentHandler.class, "log");
+ julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger(Resource.class, "log");
+ julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger(ViewHandler.class, "log");
+ julLogger.setFilter(conversionFilter);
+
+ // These ones are in a package-scoped class
+
+ julLogger = getPrivateStaticLogger("com.sun.faces.facelets.compiler.CompilationManager", "log");
+ julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger("com.sun.faces.facelets.tag.jsf.ComponentRule", "log");
+ julLogger.setFilter(conversionFilter);
+
+ julLogger = getPrivateStaticLogger("com.sun.faces.facelets.tag.MetaRulesetImpl", "log");
+ julLogger.setFilter(conversionFilter);
+
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to wrap Facelets JDK logging in Log4j logging", e);
+ }
+ }
+
+ private Logger getPrivateStaticLogger(Class clazz, String fieldName) throws Exception
+ {
+ Field field = Reflections.getField(clazz, fieldName);
+ field.setAccessible(true);
+ return (Logger) Reflections.get(field, new Object());
+ }
+
+ private Logger getPrivateStaticLogger(String className, String fieldName) throws Exception
+ {
+ return getPrivateStaticLogger(Reflections.classForName(className), fieldName);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/FaceletsRenderer.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,52 @@
+package org.jboss.seam.ui.facelet;
+
+import java.io.IOException;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.faces.Renderer;
+
+/**
+ *
+ * Implementation of Renderer using Facelets
+ *
+ * Especially useful for sending email using Seam Mail
+ *
+ * @author Pete Muir
+ * @author Norman Richards
+ *
+ */
+
+ at Scope(ScopeType.STATELESS)
+ at BypassInterceptors
+ at Name("org.jboss.seam.faces.renderer")
+ at AutoCreate
+ at Install(value = true, precedence = Install.BUILT_IN, classDependencies="com.sun.facelets.Facelet")
+public class FaceletsRenderer extends Renderer
+{
+
+
+ /**
+ * Render the viewId, anything written to the JSF ResponseWriter is
+ * returned
+ */
+ @Override
+ public String render(final String viewId)
+ {
+ RendererRequest rendererRequest = new RendererRequest(viewId);
+ try
+ {
+ rendererRequest.run();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("error rendering " + viewId, e);
+ }
+ return rendererRequest.getOutput();
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/HttpSessionManager.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/HttpSessionManager.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/HttpSessionManager.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,48 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.io.Serializable;
+
+import javax.servlet.http.HttpSession;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.mock.MockHttpSession;
+
+ at Name("org.jboss.seam.ui.facelet.mockHttpSession")
+ at Scope(SESSION)
+ at BypassInterceptors
+ at Install(dependencies="org.jboss.seam.faces.renderer")
+ at AutoCreate
+public class HttpSessionManager implements Serializable
+{
+
+ private transient HttpSession session;
+
+ @Unwrap
+ public HttpSession getSession()
+ {
+ if (session == null)
+ {
+ this.session = new MockHttpSession(ServletContextManager.instance());
+ }
+ return session;
+ }
+
+ public static HttpSession instance()
+ {
+ if (!Contexts.isSessionContextActive())
+ {
+ throw new IllegalStateException("Session context is not active");
+ }
+ return (HttpSession) Component.getInstance(HttpSessionManager.class, SESSION);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererFacesContextFactory.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererFacesContextFactory.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererFacesContextFactory.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,75 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import javax.faces.FactoryFinder;
+import javax.faces.context.FacesContext;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+
+
+/**
+ * A copy of the FacesServlet for use in our Renderer.
+ *
+ * Shamelessly adapted from the RI
+ *
+ * @author Pete Muir
+ *
+ */
+
+ at Name("org.jboss.seam.ui.facelet.facesContextFactory")
+ at Scope(APPLICATION)
+ at BypassInterceptors
+ at Install(dependencies="org.jboss.seam.faces.renderer")
+ at AutoCreate
+public class RendererFacesContextFactory
+{
+
+ private javax.faces.context.FacesContextFactory facesContextFactory;
+ private Lifecycle lifecycle;
+
+ @Create
+ public void create()
+ {
+ // Acquire our FacesContextFactory instance
+ facesContextFactory = (javax.faces.context.FacesContextFactory) FactoryFinder.getFactory (FactoryFinder.FACES_CONTEXT_FACTORY);
+
+ // Acquire our Lifecycle instance
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ }
+
+ public FacesContext getFacesContext(ServletRequest request, ServletResponse response)
+ {
+ return facesContextFactory.getFacesContext(ServletContextManager.instance(), request, response, lifecycle);
+ }
+
+ @Destroy
+ public void destroy()
+ {
+ facesContextFactory = null;
+ lifecycle = null;
+ }
+
+ public static RendererFacesContextFactory instance()
+ {
+ if (!Contexts.isApplicationContextActive())
+ {
+ throw new IllegalStateException("Application context is not active");
+ }
+ return (RendererFacesContextFactory) Component.getInstance(RendererFacesContextFactory.class, APPLICATION);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,142 @@
+package org.jboss.seam.ui.facelet;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.core.ResourceLoader;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.jsf.DelegatingFacesContext;
+import org.jboss.seam.mock.MockHttpServletRequest;
+import org.jboss.seam.mock.MockHttpServletResponse;
+import org.jboss.seam.ui.util.JSF;
+
+import com.sun.faces.facelets.Facelet;
+import com.sun.faces.facelets.impl.DefaultFaceletFactory;
+import com.sun.faces.facelets.impl.DefaultResourceResolver;
+
+public class RendererRequest
+{
+ private static final LogProvider log = Logging.getLogProvider(RendererRequest.class);
+
+ private FacesContext originalFacesContext;
+ private FacesContext facesContext;
+
+ private MockHttpServletRequest request;
+ private MockHttpServletResponse response;
+
+ private StringWriter writer;
+
+ private String viewId;
+
+ private ClassLoader originalClassLoader;
+
+ public RendererRequest(String viewId)
+ {
+ this.viewId = viewId;
+ }
+
+ private void init()
+ {
+ if (FacesContext.getCurrentInstance() != null) {
+ request = new MockHttpServletRequest(HttpSessionManager.instance(), FacesContext.getCurrentInstance().getExternalContext());
+ } else {
+ request = new MockHttpServletRequest(HttpSessionManager.instance());
+ }
+ response = new MockHttpServletResponse();
+
+ setContextClassLoader();
+
+ // Generate the FacesContext from the JSF FacesContextFactory
+ originalFacesContext = FacesContext.getCurrentInstance();
+ facesContext = RendererFacesContextFactory.instance().getFacesContext(request, response);
+ DelegatingFacesContext.setCurrentInstance(facesContext);
+
+ // Create the viewRoot
+ UIViewRoot newRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
+ facesContext.setViewRoot(newRoot);
+
+ // Set the responseWriter to write to a buffer
+ writer = new StringWriter();
+ facesContext.setResponseWriter(facesContext.getRenderKit().createResponseWriter(writer,
+ null, null));
+ }
+
+ private void cleanup()
+ {
+ facesContext.release();
+ DelegatingFacesContext.setCurrentInstance(originalFacesContext);
+
+ originalFacesContext = null;
+ facesContext = null;
+ request = null;
+ response = null;
+ }
+
+ protected void setContextClassLoader() {
+ // JBSEAM-3555 Quick fix
+ // Set the context classloader to the cached one
+ originalClassLoader = Thread.currentThread().getContextClassLoader();
+ ServletContext ctx = request.getSession().getServletContext();
+ WeakReference<ClassLoader> ref = (WeakReference<ClassLoader>)ctx.getAttribute("seam.context.classLoader");
+ if (ref == null || ref.get() == null) {
+ log.warn("Failed to bootstrap context classloader. Facelets may not work properly from MDBs");
+ } else {
+ Thread.currentThread().setContextClassLoader(ref.get());
+ }
+ }
+
+ protected void resetContextClassLoader() {
+ // JBSEAM-3555 Quick fix
+ if (originalClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(originalClassLoader);
+ originalClassLoader = null;
+ }
+ }
+
+ public void run() throws IOException
+ {
+ try {
+ init();
+ renderFacelet(facesContext, faceletForViewId(viewId));
+ } finally {
+ cleanup();
+ resetContextClassLoader();
+ }
+ }
+
+ public String getOutput()
+ {
+ return writer.getBuffer().toString();
+ }
+
+ /**
+ * Get a Facelet for a URL
+ */
+ protected Facelet faceletForViewId(String viewId) throws IOException
+ {
+ URL url = ResourceLoader.instance().getResource(viewId);
+ if (url == null)
+ {
+ throw new IllegalArgumentException("resource doesn't exist: " + viewId);
+ }
+ return new DefaultFaceletFactory(FaceletCompiler.instance(), new DefaultResourceResolver())
+ .getFacelet(url);
+ }
+
+ /**
+ * Render a Facelet
+ */
+ protected void renderFacelet(FacesContext facesContext, Facelet facelet) throws IOException
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ facelet.apply(facesContext, root);
+ JSF.renderChildren(facesContext, root);
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/ServletContextManager.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/ServletContextManager.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/facelet/ServletContextManager.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,58 @@
+package org.jboss.seam.ui.facelet;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.ServletLifecycle;
+import org.jboss.seam.mock.MockServletContext;
+
+ at Name("org.jboss.seam.ui.facelet.mockServletContext")
+ at Scope(APPLICATION)
+ at BypassInterceptors
+ at Install(dependencies="org.jboss.seam.faces.renderer")
+ at AutoCreate
+public class ServletContextManager
+{
+
+ private ServletContext servletContext;
+
+ @Create
+ public void create()
+ {
+ // TODO A bit of a hack, we should store the servlet context properly
+ if (ServletLifecycle.getCurrentServletContext() != null)
+ {
+ servletContext = ServletLifecycle.getCurrentServletContext();
+ }
+ else
+ {
+ this.servletContext = new MockServletContext();
+ }
+ }
+
+ @Unwrap
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ public static ServletContext instance()
+ {
+ if (!Contexts.isApplicationContextActive())
+ {
+ throw new IllegalStateException("Application context is not active");
+ }
+ return (ServletContext) Component.getInstance(ServletContextManager.class, APPLICATION);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/filter/Ajax4jsfFilterInstantiator.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/filter/Ajax4jsfFilterInstantiator.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/filter/Ajax4jsfFilterInstantiator.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,27 @@
+package org.jboss.seam.ui.filter;
+
+import static org.jboss.seam.annotations.Install.FRAMEWORK;
+
+import javax.servlet.Filter;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+ at Name("org.jboss.seam.web.ajax4jsfFilterInstantiator")
+ at Install(precedence = FRAMEWORK, classDependencies={"org.ajax4jsf.Filter", "org.apache.commons.digester.Digester"})
+ at BypassInterceptors
+ at Scope(ScopeType.STATELESS)
+public class Ajax4jsfFilterInstantiator
+{
+
+ @Unwrap
+ public Filter create()
+ {
+ return new org.ajax4jsf.Filter();
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,67 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.graphicImage.GraphicImageStore.ImageWrapper;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class GraphicImageRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIGraphicImage.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIGraphicImage graphicImage = (UIGraphicImage) component;
+
+ String key = graphicImage.getFileName();
+ String extension = null;
+
+ Image image = Image.instance();
+ image.setInput(graphicImage.getValue());
+
+ // Do transforms
+
+ for (UIComponent cmp : graphicImage.getChildren())
+ {
+ if (cmp instanceof ImageTransform)
+ {
+ ImageTransform imageTransform = (ImageTransform) cmp;
+ imageTransform.applyTransform(image);
+ }
+ }
+
+ key = GraphicImageStore.instance().put(new ImageWrapper(image.getImage(), image.getContentType()),
+ key);
+ extension = image.getContentType().getExtension();
+
+ writer.startElement(HTML.IMG_ELEM, graphicImage);
+ if (graphicImage.getId() != null)
+ {
+ writer.writeAttribute(HTML.ID_ATTR, graphicImage.getClientId(context), HTML.ID_ATTR);
+ }
+
+ String url = context.getExternalContext().getRequestContextPath()
+ + GraphicImageResource.GRAPHIC_IMAGE_RESOURCE_PATH + "/" + key + extension;
+ writer.writeAttribute(HTML.SRC_ATTR, url, HTML.SRC_ATTR);
+ HTML.renderHTMLAttributes(writer, component, HTML.IMG_PASSTHROUGH_ATTRIBUTES);
+ writer.endElement(HTML.IMG_ELEM);
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageResource.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageResource.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageResource.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,78 @@
+package org.jboss.seam.ui.graphicImage;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.servlet.ContextualHttpServletRequest;
+import org.jboss.seam.ui.graphicImage.GraphicImageStore.ImageWrapper;
+import org.jboss.seam.web.AbstractResource;
+
+/**
+ * Serves images from the image store
+ */
+ at Scope(APPLICATION)
+ at Name("org.jboss.seam.ui.graphicImage.graphicImageResource")
+ at Install(precedence = BUILT_IN)
+ at BypassInterceptors
+public class GraphicImageResource extends AbstractResource
+{
+
+ public static final String GRAPHIC_IMAGE_RESOURCE_PATH = "/seam/resource/graphicImage";
+
+ private static final String RESOURCE_PATH = "/graphicImage";
+
+ @Override
+ public String getResourcePath()
+ {
+ return RESOURCE_PATH;
+ }
+
+ @Override
+ public void getResource(final HttpServletRequest request, final HttpServletResponse response)
+ throws ServletException, IOException
+ {
+
+ new ContextualHttpServletRequest(request)
+ {
+ @Override
+ public void process() throws IOException
+ {
+ doWork(request, response);
+ }
+ }.run();
+
+ }
+
+ private void doWork(HttpServletRequest request, HttpServletResponse response)
+ throws IOException
+ {
+ String pathInfo = request.getPathInfo().substring(getResourcePath().length() + 1,
+ request.getPathInfo().lastIndexOf("."));
+ ImageWrapper image = GraphicImageStore.instance().remove(pathInfo);
+ if (image != null && image.getImage() != null)
+ {
+ response.setContentType(image.getContentType().getMimeType());
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentLength(image.getImage().length);
+ ServletOutputStream os = response.getOutputStream();
+ os.write(image.getImage());
+ os.flush();
+ }
+ else
+ {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageStore.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageStore.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/GraphicImageStore.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,108 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.Serializable;
+import java.rmi.server.UID;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.core.AbstractMutable;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.log.Logging;
+
+ at Name("org.jboss.seam.ui.graphicImage.graphicImageStore")
+ at Scope(ScopeType.SESSION)
+ at Install(precedence = Install.BUILT_IN)
+ at BypassInterceptors
+public class GraphicImageStore extends AbstractMutable implements Serializable
+{
+ private Log log = Logging.getLog(GraphicImageStore.class);
+
+ public static class ImageWrapper implements Serializable
+ {
+
+ private byte[] image;
+
+ private Image.Type contentType;
+
+ public ImageWrapper(byte[] image, Image.Type contentType)
+ {
+ this.image = image;
+ this.contentType = contentType;
+ }
+
+ public Image.Type getContentType()
+ {
+ return contentType;
+ }
+
+ public byte[] getImage()
+ {
+ return image;
+ }
+ }
+
+ private Map<String, ImageWrapper> store = new HashMap<String, ImageWrapper>();
+
+ /**
+ * Put a image into the store
+ * @param image
+ * @return the key of the image
+ */
+ public String put(ImageWrapper image)
+ {
+ return put(image, null);
+ }
+
+ /**
+ * Put an image into the store.
+ * @param image
+ * @param key The key to use, if null, a key will be generated
+ * @return The key of the image
+ */
+ public String put(ImageWrapper image, String key)
+ {
+ if (key == null)
+ {
+ key = "org.jboss.seam.ui.GraphicImageStore." + new UID().toString().replace(":", "-");
+ }
+ store.put(key, image);
+ setDirty();
+ log.debug("Put image into to session with key #0", key);
+ return key;
+ }
+
+ public ImageWrapper get(String key)
+ {
+ log.debug("Get image into to session with key #0", key);
+ ImageWrapper image = store.get(key);
+ return image;
+ }
+
+ public ImageWrapper remove(String key)
+ {
+ log.debug("Get image from session with key #0", key);
+ ImageWrapper imageWrapper = store.remove(key);
+ if ( imageWrapper != null )
+ {
+ setDirty();
+ }
+ return imageWrapper;
+ }
+
+ public boolean contains(String key)
+ {
+ return store.containsKey(key);
+ }
+
+ public static GraphicImageStore instance()
+ {
+ return (GraphicImageStore) Component.getInstance(GraphicImageStore.class);
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/Image.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/Image.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/Image.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,495 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.image.ConvolveOp;
+import java.awt.image.Kernel;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.ResourceLoader;
+
+/**
+ * Image manipulation and interrogation
+ *
+ * @author pmuir
+ *
+ */
+ at Name("org.jboss.seam.graphicImage.image")
+ at Install(precedence = Install.BUILT_IN)
+ at BypassInterceptors
+public class Image implements Serializable
+{
+
+ public enum Type
+ {
+ IMAGE_PNG("image/png", ".png", "PNG"), IMAGE_JPEG("image/jpeg", ".jpg", "JPEG", "image/jpg"), IMAGE_GIF(
+ "image/gif", ".gif", "GIF");
+
+ private String mimeType;
+
+ private String extension;
+
+ private String imageFormatName;
+
+ private List<String> alternativeMimeTypes;
+
+ Type(String mimeType, String extension, String imageFormatName,
+ String... alternativeMimeTypes)
+ {
+ this.mimeType = mimeType;
+ this.extension = extension;
+ this.alternativeMimeTypes = Arrays.asList(alternativeMimeTypes);
+ this.imageFormatName = imageFormatName;
+ }
+
+ public String getMimeType()
+ {
+ return mimeType;
+ }
+
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ public List<String> getAlternativeMimeTypes()
+ {
+ return alternativeMimeTypes;
+ }
+
+ protected String getImageFormatName()
+ {
+ return imageFormatName;
+ }
+
+ public static Type getTypeByMimeType(String mimeType)
+ {
+ for (Type type : values())
+ {
+ if (type.getMimeType().equals(mimeType) || type.alternativeMimeTypes.contains(mimeType))
+ {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ public static Type getTypeByFormatName(String formatName)
+ {
+ for (Type type : values())
+ {
+ if (type.getImageFormatName().equalsIgnoreCase(formatName))
+ {
+ return type;
+ }
+ }
+ return null;
+ }
+ }
+
+ public static final int PNG_IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB;
+
+ public static final int DEFAULT_IMAGE_TYPE = BufferedImage.TYPE_INT_RGB;
+
+ private static final Type DEFAULT_CONTENT_TYPE = Type.IMAGE_PNG;
+
+ private transient Object input;
+
+ private byte[] output;
+
+ private boolean dirty;
+
+ private Type contentType = DEFAULT_CONTENT_TYPE;
+
+ private transient BufferedImage bufferedImage;
+
+ public Image()
+ {
+ }
+
+ /**
+ * Set the image. This can be one of String (loaded from the classpath), a
+ * URL, a File, an InputStream or a byte[]
+ *
+ * @param value
+ * @throws IOException
+ */
+ public Image setInput(Object value) throws IOException
+ {
+ this.input = value;
+ readImage();
+ return this;
+ }
+
+ /**
+ * Get the image as a byte[], any conversions having been applied. Returns null if the
+ * image could not be read
+ */
+ public byte[] getImage() throws IOException
+ {
+ if ((dirty || output == null) && bufferedImage != null)
+ {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ ImageIO.write(bufferedImage, getContentType().getImageFormatName(), outputStream);
+ output = outputStream.toByteArray();
+ }
+ return output;
+ }
+
+ /**
+ * The content type of the output image, by default DEFAULT_CONTENT_TYPE
+ */
+ public Type getContentType()
+ {
+ return contentType;
+ }
+
+ public void setContentType(Type contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public BufferedImage getBufferedImage()
+ {
+ return bufferedImage;
+ }
+
+ public void setBufferedImage(BufferedImage bufferedImage)
+ {
+ this.bufferedImage = bufferedImage;
+ dirty = true;
+ }
+
+ /**
+ * The aspect ratio of the image
+ */
+ public Double getRatio() throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return null;
+ }
+ // Do the operation with double precision
+ Double ratio = (double) bufferedImage.getWidth() / (double) bufferedImage.getHeight();
+ return ratio;
+ }
+
+ /**
+ * Check whether the image is of a given ratio to within a given precision
+ */
+ public Boolean isRatio(double ratio, double precision) throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return null;
+ }
+ double error = ratio * precision;
+ return (ratio - error) < getRatio() && getRatio() <= (ratio + error);
+ }
+
+ /**
+ * The width of the image
+ */
+ public Integer getWidth() throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return null;
+ }
+ return bufferedImage.getWidth();
+ }
+
+ /**
+ * The height of the image
+ */
+ public Integer getHeight() throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return null;
+ }
+ return bufferedImage.getHeight();
+ }
+
+ /**
+ * Alter the ratio of the output image <b>without</b> altering the ratio of
+ * the input by adding transparent strips. If the image is already of the
+ * correct ratio (to within the given precision) nothing happens
+ */
+ public Image adjustRatio(double desiredRatio, double precision) throws InterruptedException,
+ IOException
+ {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ if (!isRatio(desiredRatio, precision))
+ {
+ if (getRatio() > desiredRatio)
+ {
+ // The image is too wide - add a transparent strip across the
+ // top/bottom to make the image squarer
+ double desiredHeight = getRatio() * getHeight() / desiredRatio;
+ double stripHeight = (desiredHeight - getHeight()) / 2;
+ BufferedImage newImage = new BufferedImage(getWidth(),
+ (int) (getHeight() + stripHeight * 2), getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, 0, (int) stripHeight, null);
+ bufferedImage = newImage;
+ }
+ else if (getRatio() < desiredRatio)
+ {
+ // The image is too wide - add a transparent strip across the
+ // top/bottom to make the image squarer
+ double desiredWidth = getRatio() * getWidth() / desiredRatio;
+ double stripWidth = (desiredWidth - getWidth()) / 2;
+ BufferedImage newImage = new BufferedImage((int) (getWidth() + stripWidth * 2),
+ getHeight(), getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, (int) stripWidth, 0, null);
+ bufferedImage = newImage;
+ }
+ dirty = true;
+ }
+ return this;
+ }
+
+ /**
+ * Blur the output image using a convolution
+ */
+ public Image blur(int radius) throws IOException {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ BufferedImage newImage = new BufferedImage(getWidth(), getHeight(), getImageType());
+ int blurWidth = ((radius - 1) * 2 + 1);
+ int pixels = blurWidth * blurWidth;
+ float weight = 1.0f/ pixels;
+ float[] elements = new float[pixels];
+
+ for (int i = 0; i < pixels; i++) {
+ elements[i] = weight;
+ }
+
+ Kernel kernel = new Kernel(blurWidth, blurWidth, elements);
+ ConvolveOp simpleBlur = new ConvolveOp(kernel);
+
+ simpleBlur.filter(bufferedImage, newImage);
+ bufferedImage = newImage;
+ dirty = true;
+ return this;
+ }
+
+ /**
+ * Scale the image to the given width
+ */
+ public Image scaleToWidth(int width) throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ // Always scale, never stretch. We don't care if the requested scaled
+ // ratio is different from the current
+ int height = width * getHeight() / getWidth();
+ BufferedImage newImage = new BufferedImage(width, height, getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, 0, 0, width, height, null);
+ bufferedImage = newImage;
+ dirty = true;
+ return this;
+ }
+
+ public Image scaleToFit(int height, int width)
+ throws IOException
+ {
+ float hratio = (float) height/getHeight();
+ float wratio = (float) width/getWidth();
+
+ if (hratio < wratio) {
+ return scaleToHeight(height);
+ } else {
+ return scaleToWidth(width);
+ }
+ }
+
+ /**
+ * Scale the image to the given height
+ */
+ public Image scaleToHeight(int height) throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ // Always scale, never stretch. We don't care if the requested scaled
+ // ratio is different from the current
+ int width = height * getWidth() / getHeight();
+ BufferedImage newImage = new BufferedImage(width, height, getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, 0, 0, width, height, null);
+ bufferedImage = newImage;
+ dirty = true;
+ return this;
+ }
+
+ /**
+ * Scale the image by the given factor
+ */
+ public Image scale(double factor) throws IOException
+ {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ int width = (int) (getWidth() * factor);
+ int height = (int) (getHeight() * factor);
+ BufferedImage newImage = new BufferedImage(width, height, getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, 0, 0, width, height, null);
+ bufferedImage = newImage;
+ dirty = true;
+ return this;
+ }
+
+ /**
+ * Resize the image to the given width and height, changing the ratio
+ * if necessary
+ */
+ public Image resize(int width, int height)
+ {
+ if (bufferedImage == null)
+ {
+ return this;
+ }
+ BufferedImage newImage = new BufferedImage(width, height, getImageType());
+ Graphics2D graphics2D = createGraphics(newImage);
+ graphics2D.drawImage(bufferedImage, 0, 0, width, height, null);
+ bufferedImage = newImage;
+ dirty = true;
+ return this;
+ }
+
+ private void readImage() throws IOException
+ {
+ if (input instanceof URL)
+ {
+ readImage(((URL) input).openStream());
+ }
+ else if (input instanceof File)
+ {
+ readImage(((File) input).toURL().openStream());
+ }
+ else if (input instanceof String)
+ {
+ readImage(ResourceLoader.instance().getResourceAsStream((String) input));
+ }
+ else if (input instanceof InputStream)
+ {
+ readImage((InputStream) input);
+ }
+ else if (input != null && input.getClass().isArray())
+ {
+ if (input.getClass().getComponentType().isAssignableFrom(Byte.TYPE))
+ {
+ byte[] b = (byte[]) input;
+ readImage(new ByteArrayInputStream(b));
+ }
+ }
+ }
+
+ /**
+ * Create Canvas, set some defaults (bg colour, rendering hints)
+ *
+ * @param image
+ */
+ private Graphics2D createGraphics(BufferedImage image)
+ {
+ if (image == null)
+ {
+ return null;
+ }
+ Graphics2D graphics2D = image.createGraphics();
+ graphics2D.setBackground(new Color(255, 255, 255));
+ if (Type.IMAGE_PNG.equals(getContentType()))
+ {
+ graphics2D.setComposite(java.awt.AlphaComposite.Src);
+ }
+ graphics2D.clearRect(0, 0, image.getWidth(), image.getHeight());
+ graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ return graphics2D;
+ }
+
+ public static Image instance()
+ {
+ if (!Contexts.isConversationContextActive())
+ {
+ throw new IllegalStateException("No active conversation scope");
+ }
+ return (Image) Component.getInstance(Image.class);
+ }
+
+ private void readImage(InputStream inputStream) throws IOException
+ {
+ if (inputStream == null)
+ {
+ throw new IllegalArgumentException("Image pointed to must exist (input stream must not be null)");
+ }
+ ImageInputStream stream = ImageIO.createImageInputStream(inputStream);
+ if (stream == null)
+ {
+ throw new IllegalArgumentException("Error creating image input stream from image");
+ }
+
+ Iterator iter = ImageIO.getImageReaders(stream);
+ if (!iter.hasNext())
+ {
+ return;
+ }
+
+ ImageReader reader = (ImageReader) iter.next();
+ ImageReadParam param = reader.getDefaultReadParam();
+ reader.setInput(stream, true, true);
+ String type = reader.getFormatName();
+ setContentType(Type.getTypeByFormatName(type));
+ bufferedImage = reader.read(0, param);
+ stream.close();
+ reader.dispose();
+ dirty = true;
+ inputStream.close();
+ }
+
+ private int getImageType() {
+ if (Type.IMAGE_PNG.equals(getContentType()))
+ {
+ return PNG_IMAGE_TYPE;
+ }
+ else
+ {
+ return DEFAULT_IMAGE_TYPE;
+ }
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/ImageTransform.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/ImageTransform.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/ImageTransform.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,11 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.IOException;
+
+
+public interface ImageTransform
+{
+ public static final String FAMILY = "org.jboss.seam.ui.UIImageTransform";
+
+ public abstract void applyTransform(Image image) throws IOException;
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UIGraphicImage.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UIGraphicImage.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UIGraphicImage.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,16 @@
+package org.jboss.seam.ui.graphicImage;
+
+import javax.faces.component.html.HtmlGraphicImage;
+
+public abstract class UIGraphicImage extends HtmlGraphicImage
+{
+
+ public static final String FAMILY = "org.jboss.seam.ui.UIGraphicImage";
+
+ public abstract String getFileName();
+
+ public abstract void setFileName(String fileName);
+
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageBlur.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageBlur.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageBlur.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,26 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponentBase;
+
+
+public abstract class UITransformImageBlur extends UIComponentBase implements ImageTransform
+{
+
+ public void applyTransform(Image image) throws IOException
+ {
+ if (!isRendered())
+ {
+ return;
+ }
+ image.blur(new Integer(getRadius()));
+ }
+
+ public abstract String getRadius();
+
+ public abstract void setRadius(String width);
+
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageSize.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageSize.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageSize.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,70 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponentBase;
+
+
+public abstract class UITransformImageSize extends UIComponentBase implements ImageTransform
+{
+
+ public void applyTransform(Image image) throws IOException
+ {
+ if (!isRendered())
+ {
+ return;
+ }
+ // TODO reduce number of decimal places
+ if (isMaintainRatio())
+ {
+ if (getWidth() != null && getHeight() != null)
+ {
+ throw new UnsupportedOperationException(
+ "Cannot maintain ratio and specify height and width");
+ }
+ else if (getWidth() != null)
+ {
+ image.scaleToWidth(new Integer(getWidth()));
+ }
+ else if (getHeight() != null)
+ {
+ image.scaleToHeight(new Integer(getHeight()));
+ }
+ }
+ else if (getFactor() != null)
+ {
+ if (getWidth() != null || getHeight() != null)
+ {
+ throw new UnsupportedOperationException(
+ "Cannot scale by a factor and specify height and width");
+ }
+ image.scale(getFactor());
+ }
+ else
+ {
+ if (getWidth() == null || getHeight() == null)
+ {
+ throw new UnsupportedOperationException(
+ "If not specifying a factor or maintain ratio you must specify width and heigh");
+ }
+ image.resize(new Integer(getWidth()), new Integer(getHeight()));
+ }
+ }
+
+ public abstract boolean isMaintainRatio();
+
+ public abstract void setMaintainRatio(boolean maintainRatio);
+
+ public abstract Integer getWidth();
+
+ public abstract void setWidth(Integer width);
+
+ public abstract Integer getHeight();
+
+ public abstract void setHeight(Integer height);
+
+ public abstract Double getFactor();
+
+ public abstract void setFactor(Double factor);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageType.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageType.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/graphicImage/UITransformImageType.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,28 @@
+package org.jboss.seam.ui.graphicImage;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponentBase;
+
+
+public abstract class UITransformImageType extends UIComponentBase implements ImageTransform
+{
+
+ public void applyTransform(Image image) throws IOException
+ {
+ if (!isRendered())
+ {
+ return;
+ }
+ Image.Type type = Image.Type.getTypeByMimeType(getContentType());
+ if (type != null)
+ {
+ image.setContentType(type);
+ }
+ }
+
+ public abstract String getContentType();
+
+ public abstract void setContentType(String width);
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/CommandButtonParameterComponentHandler.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/CommandButtonParameterComponentHandler.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/CommandButtonParameterComponentHandler.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,35 @@
+package org.jboss.seam.ui.handler;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import static org.jboss.seam.ui.util.cdk.RendererBase.getUtils;
+
+/**
+ * If user didn't specify id on button, do it for them (we need one rendered)
+ *
+ * @author Pete Muir
+ *
+ */
+public class CommandButtonParameterComponentHandler extends ComponentHandler
+{
+
+ public CommandButtonParameterComponentHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+ @Override
+ public void onComponentCreated(FaceletContext ctx, UIComponent c,
+ UIComponent parent)
+ {
+ if (getUtils().isCommandButton(parent) && parent.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ {
+ parent.setId("seam" + parent.getId());
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/DecorateHandler.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/DecorateHandler.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/handler/DecorateHandler.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,39 @@
+package org.jboss.seam.ui.handler;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+
+public class DecorateHandler extends ComponentHandler
+{
+ private com.sun.faces.facelets.tag.ui.DecorateHandler delegate;
+
+ public DecorateHandler(ComponentConfig config)
+ {
+ super(config);
+ if ( tag.getAttributes().get("template")!=null )
+ {
+ delegate = new com.sun.faces.facelets.tag.ui.DecorateHandler(config);
+ }
+ }
+
+ @Override
+ public void applyNextHandler(FaceletContext context, UIComponent component)
+ throws IOException, FacesException, ELException
+ {
+ if ( tag.getAttributes().get("template")!=null )
+ {
+ delegate.apply(context, component);
+ }
+ else
+ {
+ nextHandler.apply(context, component);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/package-info.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/package-info.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/package-info.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,10 @@
+/**
+ * Seam UI
+ *
+ */
+ at Namespace(value="http://jboss.com/products/seam/ui", prefix="org.jboss.seam.ui")
+ at AutoCreate
+package org.jboss.seam.ui;
+
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Namespace;
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ButtonRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ButtonRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ButtonRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,97 @@
+package org.jboss.seam.ui.renderkit;
+
+
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIButton;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class ButtonRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIButton.class;
+ }
+
+ private String getType(UIButton button)
+ {
+ if (button.getImage() == null) {
+ return "button";
+ } else {
+ return "image";
+ }
+ }
+
+
+ private String getOnClick(UIButton button) throws IOException
+ {
+ String onclick = button.getOnclick();
+ String url = button.getUrl();
+ if (onclick == null)
+ {
+ onclick = "";
+ }
+ else if (onclick.length() > 0 && !onclick.endsWith(";"))
+ {
+ onclick += "; ";
+ }
+ if (url != null)
+ {
+ onclick += "location.href='" + url + "'; ";
+ }
+ onclick += "return false;";
+ if (!button.isDisabled())
+ {
+ return onclick;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIButton button = (UIButton) component;
+ writer.startElement(HTML.INPUT_ELEM, button);
+ String onclick = getOnClick(button);
+ if (!("").equals(onclick) && !button.isDisabled())
+ {
+ writer.writeAttribute(HTML.ONCLICK_ATTR, onclick, HTML.ONCLICK_ATTR);
+ }
+ if (button.getId() != null)
+ {
+ writer.writeAttribute(HTML.ID_ATTR, button.getClientId(context), HTML.ID_ATTR);
+ }
+ HTML.renderHTMLAttributes(writer, button, HTML.BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
+ if (button.getValue() != null)
+ {
+ writer.writeAttribute(HTML.VALUE_ATTR, button.getValue(), HTML.VALUE_ATTR);
+ }
+ if (button.isDisabled())
+ {
+ writer.writeAttribute(HTML.DISABLED_ATTR, true, HTML.DISABLED_ATTR);
+ }
+ writer.writeAttribute(HTML.TYPE_ATTR, getType(button), HTML.TYPE_ATTR);
+ if (button.getImage() != null)
+ {
+ writer.writeAttribute(HTML.SRC_ATTR, button.getImage(), HTML.SRC_ATTR);
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CacheRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CacheRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CacheRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,69 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Calendar;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.ui.component.UICache;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class CacheRendererBase extends RendererBase {
+
+ private static final LogProvider log = Logging.getLogProvider(UICache.class);
+
+ /**
+ * last time we logged the failure of the cache
+ */
+ private static Calendar lastLog = null;
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UICache.class;
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UICache cache = (UICache) component;
+ if (cache.isEnabled())
+ {
+ String key = cache.getKey();
+ String cachedContent = (String) cache.getCacheProvider().get(cache.getRegion(), key);
+ if (cachedContent == null)
+ {
+ log.debug("rendering from scratch: " + key);
+ StringWriter stringWriter = new StringWriter();
+ ResponseWriter cachingResponseWriter = writer.cloneWithWriter(stringWriter);
+ context.setResponseWriter(cachingResponseWriter);
+ renderChildren(context, component);
+ context.setResponseWriter(writer);
+ String output = stringWriter.getBuffer().toString();
+ writer.write(output);
+ cache.getCacheProvider().put(cache.getRegion(), key, output);
+ }
+ else
+ {
+ log.debug("rendering from cache: " + key);
+ writer.write(cachedContent);
+ }
+ }
+ else
+ {
+ renderChildren(context, component);
+ }
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CommandButtonParameterRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CommandButtonParameterRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/CommandButtonParameterRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,101 @@
+package org.jboss.seam.ui.renderkit;
+
+import static org.jboss.seam.ui.util.HTML.SCRIPT_ELEM;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_LANGUAGE_ATTR;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_LANGUAGE_JAVASCRIPT;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_TYPE_ATTR;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public abstract class CommandButtonParameterRendererBase extends RendererBase
+{
+
+ protected abstract LogProvider getLog();
+
+ protected abstract String getParameterName(UIComponent component);
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException
+ {
+ UIComponent actionComponent = component.getParent();
+ UIComponent form = getUtils().getForm(actionComponent);
+ UIParameter parameter = (UIParameter) component;
+ if (getUtils().isCommandButton(actionComponent))
+ {
+ String formId = form.getClientId(context);
+ writer.startElement(SCRIPT_ELEM, component);
+ writer.writeAttribute(SCRIPT_LANGUAGE_ATTR, SCRIPT_LANGUAGE_JAVASCRIPT, SCRIPT_LANGUAGE_ATTR);
+ writer.writeAttribute(SCRIPT_TYPE_ATTR, SCRIPT_TYPE_TEXT_JAVASCRIPT, SCRIPT_TYPE_ATTR);
+ if (actionComponent.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ {
+ getLog().warn("Must set an id for the command buttons with s:conversationPropagation");
+ }
+
+
+ String functionBody =
+ "{" +
+ "if (document.getElementById)" +
+ "{" +
+ "var form = document.getElementById('" + formId + "');" +
+ "var input = document.createElement('input');" +
+ "if (document.all)" +
+ "{ " + // what follows should work with NN6 but doesn't in M14"
+ "input.type = 'hidden';" +
+ "input.name = '" + getParameterName(component) + "';" +
+ "input.value = '" + parameter.getValue() + "';" +
+ "}" +
+ "else if (document.getElementById) " +
+ "{" + // so here is theNN6 workaround
+ "input.setAttribute('type', 'hidden');" +
+ "input.setAttribute('name', '" + getParameterName(component) + "');" +
+ "input.setAttribute('value', '" + parameter.getValue() + "');" +
+ "}" +
+ "form.appendChild(input);" +
+ "return true;" +
+ "}" +
+ "}";
+
+ String functionName = "cp_" + actionComponent.getId();
+
+ String functionCode =
+ "var " + functionName + " = " +
+ "new Function(\"event\", \"" + functionBody + "\");";
+
+ writer.write(functionCode);
+
+ // We are either written before the HTML element (e.g. a:commandButton)
+ // In this case we can simply prepend to the existing onClick
+
+ String existingOnClick = (String) actionComponent.getAttributes().get("onclick");
+
+ actionComponent.getAttributes().put("onclick", functionName + "();" + existingOnClick);
+
+ // But we also might be written after (e.g. JSF RI h:commandButton
+ // In this case we can use event capture
+
+ String functionRegister =
+ "if (document.getElementById('" + actionComponent.getClientId(context) + "'))" +
+ "{" +
+ "document.getElementById('" + actionComponent.getClientId(context) + "').onclick = new Function(\"event\", \"" + functionBody + "\");" +
+ "}";
+ writer.write(functionRegister);
+ writer.endElement("script");
+ }
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationNameRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationNameRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationNameRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,37 @@
+package org.jboss.seam.ui.renderkit;
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.ui.component.UIConversationName;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class ConversationNameRendererBase extends CommandButtonParameterRendererBase
+{
+
+ private static LogProvider log = Logging.getLogProvider(ConversationNameRendererBase.class);
+
+
+ @Override
+ protected LogProvider getLog()
+ {
+ return log;
+ }
+
+ @Override
+ protected String getParameterName(UIComponent component)
+ {
+ return ((UIConversationName) component).getName();
+ }
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIConversationName.class;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationPropagationRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationPropagationRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ConversationPropagationRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,38 @@
+package org.jboss.seam.ui.renderkit;
+
+
+
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.ui.component.UIConversationPropagation;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class ConversationPropagationRendererBase extends CommandButtonParameterRendererBase
+{
+
+ private static LogProvider log = Logging.getLogProvider(ConversationPropagationRendererBase.class);
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIConversationPropagation.class;
+ }
+
+ @Override
+ protected LogProvider getLog()
+ {
+ return log;
+ }
+
+ @Override
+ protected String getParameterName(UIComponent component)
+ {
+ return ((UIConversationPropagation) component).getName();
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,173 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.contexts.Context;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.ui.component.UIDecorate;
+import org.jboss.seam.ui.util.Decoration;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class DecorateRendererBase extends RendererBase
+{
+ // Place the attributes you want to store away
+ private Map<String, Object> originalValues = new HashMap();
+ // The list of attributes in the event scope to store away
+ String[] storeOriginals = new String[] {"invalid", "required"};
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIDecorate.class;
+ }
+
+ /**
+ * Store away the attribute from the event context (if it is set)
+ *
+ * @param names The list of context keys to store away
+ * @param context The context to target
+ */
+ private void storeOriginalValues(String[] names, Context context)
+ {
+ for (String name : names)
+ {
+ if (context.isSet(name))
+ {
+ originalValues.put(name, context.get(name));
+ }
+ }
+ }
+
+ /**
+ * Restores the state of the event context. If the value is stored away, it is restored
+ * It it was not in the map, it was not in the context in the first place so clean
+ * up what we have placed there during this run.
+ *
+ * @param names The list of context keys to restore
+ * @param context The context to target
+ */
+ private void restoreOriginalValues(String[] names, Context context) {
+ for (String name : names) {
+ if (originalValues.containsKey(name)) {
+ context.set(name, originalValues.get(name));
+ } else {
+ context.remove(name);
+ }
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIDecorate decorate = (UIDecorate) component;
+
+ storeOriginalValues(storeOriginals, Contexts.getEventContext());
+
+ Contexts.getEventContext().set("invalid", Decoration.hasMessage(decorate, context));
+ Contexts.getEventContext().set("required", Decoration.hasRequired(component, context));
+
+ boolean hasMessage = decorate.hasMessage();
+
+ if (decorate.isEnclose())
+ {
+ writer.startElement(decorate.getElement(), decorate);
+ if (decorate.getStyleClass() != null)
+ {
+ writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
+ }
+ if (decorate.getStyle() != null)
+ {
+ writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
+ }
+ writer.writeAttribute("id", decorate.getClientId(context), "id");
+ }
+
+ UIComponent aroundDecoration = decorate.getDecoration("aroundField");
+ UIComponent aroundInvalidDecoration = decorate.getDecoration("aroundInvalidField");
+ if (aroundDecoration != null && !hasMessage)
+ {
+ aroundDecoration.setParent(decorate);
+ aroundDecoration.encodeBegin(context);
+ }
+ if (aroundInvalidDecoration != null && hasMessage)
+ {
+ aroundInvalidDecoration.setParent(decorate);
+ aroundInvalidDecoration.encodeBegin(context);
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIDecorate decorate = (UIDecorate) component;
+
+ boolean hasMessage = decorate.hasMessage();
+ UIComponent aroundDecoration = decorate.getDecoration("aroundField");
+ UIComponent aroundInvalidDecoration = decorate.getDecoration("aroundInvalidField");
+ if (aroundDecoration != null && !hasMessage)
+ {
+ aroundDecoration.setParent(decorate);
+ aroundDecoration.encodeEnd(context);
+ }
+ if (aroundInvalidDecoration != null && hasMessage)
+ {
+ aroundInvalidDecoration.setParent(decorate);
+ aroundInvalidDecoration.encodeEnd(context);
+ }
+ if (decorate.isEnclose())
+ {
+ context.getResponseWriter().endElement(decorate.getElement());
+ }
+
+ restoreOriginalValues(storeOriginals, Contexts.getEventContext());
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIDecorate decorate = (UIDecorate) component;
+
+ boolean hasMessage = decorate.hasMessage();
+
+ UIComponent beforeDecoration = decorate.getDecoration("beforeField");
+ UIComponent beforeInvalidDecoration = decorate.getDecoration("beforeInvalidField");
+ if (beforeDecoration != null && !hasMessage)
+ {
+ beforeDecoration.setParent(decorate);
+ renderChild(context, beforeDecoration);
+ }
+ if (beforeInvalidDecoration != null && hasMessage)
+ {
+ beforeInvalidDecoration.setParent(decorate);
+ renderChild(context, beforeInvalidDecoration);
+ }
+
+ renderChildren(context, decorate);
+
+ UIComponent afterDecoration = decorate.getDecoration("afterField");
+ UIComponent afterInvalidDecoration = decorate.getDecoration("afterInvalidField");
+ if (afterDecoration != null && !hasMessage)
+ {
+ afterDecoration.setParent(decorate);
+ renderChild(context, afterDecoration);
+ }
+ if (afterInvalidDecoration != null && hasMessage)
+ {
+ afterInvalidDecoration.setParent(decorate);
+ renderChild(context, afterInvalidDecoration);
+ }
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DefaultActionRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DefaultActionRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DefaultActionRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,86 @@
+package org.jboss.seam.ui.renderkit;
+
+import static org.jboss.seam.ui.util.HTML.SCRIPT_ELEM;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_LANGUAGE_ATTR;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_LANGUAGE_JAVASCRIPT;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_TYPE_ATTR;
+import static org.jboss.seam.ui.util.HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+/**
+ * @author Pete Muir
+ * @author sim
+ *
+ */
+public class DefaultActionRendererBase extends RendererBase
+{
+
+ public static final String MARK = "org.jboss.seam.ui.DefaultAction";
+
+ private static LogProvider log = Logging.getLogProvider(DefaultActionRendererBase.class);
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException
+ {
+ UIComponent actionComponent = component.getParent();
+ String actionComponentId = actionComponent.getClientId(context);
+ UIComponent form = getUtils().getForm(actionComponent);
+ if (form == null)
+ {
+ log.warn("Must embed default action inside a form");
+ }
+ else
+ {
+ String formId = form.getClientId(context);
+ writer.startElement(SCRIPT_ELEM, component);
+ writer.writeAttribute(SCRIPT_LANGUAGE_ATTR, SCRIPT_LANGUAGE_JAVASCRIPT, SCRIPT_LANGUAGE_ATTR);
+ writer.writeAttribute(SCRIPT_TYPE_ATTR, SCRIPT_TYPE_TEXT_JAVASCRIPT, SCRIPT_TYPE_ATTR);
+ if (actionComponent.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ {
+ log.warn("Must set an id for the default action source");
+ }
+ if (form.getAttributes().containsKey(MARK))
+ {
+ if (!form.getAttributes().get(MARK).equals(component.getClientId(context)))
+ {
+ log.warn("Can only specify one default action per form");
+ }
+ }
+ else
+ {
+ form.getAttributes().put(MARK, component.getClientId(context));
+ }
+ String functionBody =
+ "{var keycode;" +
+ "if (window.event) keycode = window.event.keyCode;" +
+ "else if (event) keycode = event.which;" +
+ "else return true;" +
+ "if (keycode == 13) " +
+ "{ document.getElementById('" + actionComponentId + "').click();return false; } " +
+ "else return true; }";
+ String functionCode =
+ "document.forms['" + formId + "'].onkeypress = " +
+ "new Function(\"event\", \"" + functionBody + "\");";
+ writer.write(functionCode);
+ writer.endElement("script");
+ }
+ }
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIOutput.class;
+ }
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DivRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DivRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DivRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,30 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIStyle;
+
+public class DivRendererBase extends StyleRendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIStyle.class;
+ }
+
+ @Override
+ public void endElement(ResponseWriter writer) throws IOException
+ {
+ writer.endElement("div");
+ }
+
+ @Override
+ public void startElement(ResponseWriter writer, UIStyle style) throws IOException
+ {
+ writer.startElement("div", style);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DownloadRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DownloadRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/DownloadRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,81 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.ui.component.UIDownload;
+import org.jboss.seam.ui.component.UIResource;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.ViewUrlBuilder;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class DownloadRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIDownload.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(javax.faces.context.ResponseWriter writer, FacesContext ctx, UIComponent component) throws IOException
+ {
+ UIDownload download = (UIDownload) component;
+
+ if (!download.isRendered())
+ return;
+
+ if (download.getSrc() != null)
+ {
+
+ ViewUrlBuilder builder = new ViewUrlBuilder(download.getSrc(), null);
+
+ for (Object child : download.getChildren())
+ {
+ if (child instanceof UIParameter)
+ {
+ builder.addParameter((UIParameter) child);
+ }
+
+ }
+ writeStartTag(writer, download, builder.getEncodedUrl());
+ renderNonResourceChildren(ctx, download);
+ writer.endElement(HTML.ANCHOR_ELEM);
+
+ }
+
+ }
+
+ private void renderNonResourceChildren(FacesContext ctx, UIComponent component) throws IOException
+ {
+ for (Object child : component.getChildren())
+ {
+ if (!(child instanceof UIParameter) && !(child instanceof UIResource) && (child instanceof UIComponent))
+ {
+ renderChild(ctx, (UIComponent) child);
+ }
+
+ }
+ }
+
+ private void writeStartTag(javax.faces.context.ResponseWriter writer, UIDownload download, String url) throws IOException
+ {
+ writer.startElement(HTML.ANCHOR_ELEM, null);
+ writer.writeAttribute(HTML.HREF_ATTR, url, null);
+ if (download.getStyle() != null)
+ writer.writeAttribute(HTML.STYLE_ATTR, download.getStyle(), null);
+ if (download.getStyleClass() != null)
+ writer.writeAttribute(HTML.STYLE_CLASS_ATTR, download.getStyleClass(), null);
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/EqualityValidatorRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/EqualityValidatorRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/EqualityValidatorRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,70 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.validator.Validator;
+
+import org.jboss.seam.ui.component.UIEqualityValidator;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+import org.jboss.seam.ui.validator.EqualityValidator;
+
+/**
+ * This class mainly does some validation "hook-in"
+ *
+ * @author Daniel Roth
+ *
+ */
+public class EqualityValidatorRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIEqualityValidator.class;
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIEqualityValidator ev = (UIEqualityValidator) component;
+ EditableValueHolder evh = null;
+ if (ev != null && ev.getParent() instanceof EditableValueHolder)
+ {
+ evh = (EditableValueHolder) ev.getParent();
+ }
+
+ if (evh == null)
+ throw new IllegalArgumentException("validateEquality tag must be nested in an EditableValueHolder (\"input tag\")");
+
+ if (!hasEqualityValidator(evh))
+ {
+ evh.addValidator(new EqualityValidator(ev.getFor(), ev.getMessage(), ev.getMessageId(), ev.getOperator()));
+ evh.setRequired(ev.isRequired());
+ }
+
+ renderChildren(context, component);
+ }
+
+ private boolean hasEqualityValidator(EditableValueHolder evh)
+ {
+ for (Validator validator : evh.getValidators())
+ {
+ if (validator instanceof EqualityValidator)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,134 @@
+package org.jboss.seam.ui.renderkit;
+
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.servlet.ServletRequest;
+
+import org.jboss.seam.ui.component.UIFileUpload;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+import org.jboss.seam.web.MultipartRequest;
+
+public class FileUploadRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIFileUpload.class;
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIFileUpload fileUpload = (UIFileUpload) component;
+
+ writer.startElement(HTML.INPUT_ELEM, fileUpload);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.FILE_ATTR, null);
+
+ String clientId = fileUpload.getClientId(context);
+ writer.writeAttribute(HTML.ID_ATTR, clientId, null);
+ writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
+
+
+ /*if (fileUpload.getAccept() != null)
+ {
+ writer.writeAttribute(HTML.ACCEPT_ATTR, fileUpload.getAccept(), "accept");
+ }
+
+ if (fileUpload.getStyleClass() != null)
+ {
+ writer.writeAttribute(HTML.CLASS_ATTR, fileUpload.getStyleClass(), JSF.STYLE_CLASS_ATTR);
+ }
+
+ if (fileUpload.getStyle() != null)
+ {
+ writer.writeAttribute(HTML.STYLE_ATTR, fileUpload.getStyle(), "style");
+ }*/
+
+ HTML.renderHTMLAttributes(writer, component, HTML.INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+
+
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component)
+ {
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ ServletRequest request = (ServletRequest) context.getExternalContext().getRequest();
+
+ if (!(request instanceof MultipartRequest))
+ {
+ request = unwrapMultipartRequest(request);
+ }
+
+ if (request instanceof MultipartRequest)
+ {
+ MultipartRequest multipartRequest = (MultipartRequest) request;
+
+ String clientId = component.getClientId(context);
+ fileUpload.setLocalInputStream(multipartRequest.getFileInputStream(clientId));
+ fileUpload.setLocalContentType(multipartRequest.getFileContentType(clientId));
+ fileUpload.setLocalFileName(multipartRequest.getFileName(clientId));
+ fileUpload.setLocalFileSize(multipartRequest.getFileSize(clientId));
+ }
+ }
+
+ /**
+ * Finds an instance of MultipartRequest wrapped within a request or its
+ * (recursively) wrapped requests.
+ */
+ private static ServletRequest unwrapMultipartRequest(ServletRequest request)
+ {
+ while (!(request instanceof MultipartRequest))
+ {
+ boolean found = false;
+
+ for (Method m : request.getClass().getMethods())
+ {
+ if (ServletRequest.class.isAssignableFrom(m.getReturnType())
+ && m.getParameterTypes().length == 0)
+ {
+ try
+ {
+ request = (ServletRequest) m.invoke(request);
+ found = true;
+ break;
+ }
+ catch (Exception ex)
+ { /* Ignore, try the next one */
+ }
+ }
+ }
+
+ if (!found)
+ {
+ for (Field f : request.getClass().getDeclaredFields())
+ {
+ if (ServletRequest.class.isAssignableFrom(f.getType()))
+ {
+ try
+ {
+ request = (ServletRequest) f.get(request);
+ }
+ catch (Exception ex)
+ { /* Ignore */
+ }
+ }
+ }
+ }
+
+ if (!found) break;
+ }
+
+ return request;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FormattedTextRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FormattedTextRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FormattedTextRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,30 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIFormattedText;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class FormattedTextRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIFormattedText.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ String formattedText = ((UIFormattedText) component).getFormattedText();
+ if (formattedText != null)
+ {
+ writer.write(formattedText);
+ }
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FragmentRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FragmentRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/FragmentRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,32 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIFragment;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class FragmentRendererBase extends RendererBase
+{
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIFragment.class;
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException
+ {
+ renderChildren(facesContext, component);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/LinkRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/LinkRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/LinkRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,50 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UILink;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class LinkRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UILink.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UILink link = (UILink) component;
+ String url = link.getUrl();
+ writer.startElement(HTML.ANCHOR_ELEM, link);
+ if (url != null && !link.isDisabled())
+ {
+ writer.writeAttribute(HTML.HREF_ATTR, url, HTML.HREF_ATTR);
+ }
+ if (link.getId() != null)
+ {
+ writer.writeAttribute(HTML.ID_ATTR, link.getClientId(context), HTML.ID_ATTR);
+ }
+ HTML.renderHTMLAttributes(writer, link, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+ if (link.getValue() != null)
+ {
+ writer.writeText(link.getValue(), null);
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ writer.endElement(HTML.ANCHOR_ELEM);
+ }
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/RemoteRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/RemoteRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/RemoteRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,65 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIRemote;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+/**
+ * Renderer for rendering the required <script> tags for Seam Remoting
+ *
+ * @author Shane Bryzak
+ */
+public class RemoteRendererBase extends RendererBase
+{
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIRemote.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException
+ {
+ UIRemote remote = (UIRemote) component;
+
+ writeScript(context, remote);
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException
+ {
+ writer.flush();
+ }
+
+ public void writeScript(FacesContext context, UIRemote remote)
+ throws IOException
+ {
+ ResponseWriter response = context.getResponseWriter();
+
+ Map request = context.getExternalContext().getRequestMap();
+ if (!request.containsKey("REMOTE_SCRIPT"))
+ {
+ response.startElement("script", null);
+ response.writeAttribute("type", "text/javascript", null);
+ response.writeAttribute("src", context.getExternalContext().getRequestContextPath()
+ + "/seam/resource/remoting/resource/remote.js", null);
+ response.endElement("script");
+ request.put("REMOTE_SCRIPT", true);
+ }
+
+ response.startElement("script", null);
+ response.writeAttribute("type", "text/javascript", null);
+ response.writeAttribute("src", context.getExternalContext().getRequestContextPath()
+ + "/seam/resource/remoting/interface.js?" +
+ remote.getInclude().replace(',', '&'), null);
+ response.endElement("script");
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ResourceRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ResourceRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ResourceRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,35 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.ui.DocumentStoreUtils;
+import org.jboss.seam.ui.component.UIResource;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public class ResourceRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIResource.class;
+ }
+
+ @Override
+ protected void doEncodeBegin(javax.faces.context.ResponseWriter writer, FacesContext ctx, UIComponent component) throws IOException
+ {
+
+ UIResource resource = (UIResource) component;
+
+ String url = DocumentStoreUtils.addResourceToDataStore(ctx, resource);
+
+ ctx.getExternalContext().redirect(url);
+
+ }
+
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,58 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UISpan;
+import org.jboss.seam.ui.component.UIStyle;
+
+public class SpanRendererBase extends StyleRendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UISpan.class;
+ }
+
+ @Override
+ public void endElement(ResponseWriter writer) throws IOException
+ {
+ writer.endElement("span");
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UISpan span = (UISpan) component;
+
+ startElement(writer, span);
+
+ writer.writeAttribute("id", component.getClientId(context), "id");
+
+ if (span.getStyleClass() != null)
+ {
+ writer.writeAttribute("class", span.getStyleClass(), "styleClass");
+ }
+
+ if (span.getStyle() != null)
+ {
+ writer.writeAttribute("style", span.getStyle(), "style");
+ }
+
+ if (span.getTitle() != null)
+ {
+ writer.writeAttribute("title", span.getTitle(), "title");
+ }
+ }
+
+ @Override
+ public void startElement(ResponseWriter writer, UIStyle style) throws IOException
+ {
+ writer.startElement("span", style);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/StyleRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/StyleRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/StyleRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,45 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIStyle;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+
+public abstract class StyleRendererBase extends RendererBase
+{
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIStyle style = (UIStyle) component;
+
+ startElement(writer, style);
+
+ writer.writeAttribute("id", component.getClientId(context), "id");
+
+ if (style.getStyleClass() != null)
+ {
+ writer.writeAttribute("class", style.getStyleClass(), "styleClass");
+ }
+
+ if (style.getStyle() != null)
+ {
+ writer.writeAttribute("style", style.getStyle(), "style");
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ endElement(writer);
+ }
+
+
+ public abstract void startElement(ResponseWriter writer, UIStyle style) throws IOException;
+ public abstract void endElement(ResponseWriter writer) throws IOException;
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/TokenRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/TokenRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/TokenRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,210 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.seam.ui.RenderStampStore;
+import org.jboss.seam.ui.UnauthorizedCommandException;
+import org.jboss.seam.ui.component.UIToken;
+import org.jboss.seam.ui.util.HTML;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+import org.jboss.seam.util.Base64;
+import org.jboss.seam.util.RandomStringUtils;
+
+/**
+ * <p>
+ * The <strong>TokenRendererBase</strong> renders the form's signature as a
+ * hidden form field for the UIToken component. If the renderStampStore
+ * component is enabled, the actually signature will be stored in the session
+ * and the key to this token store in the hidden form field, providing the same
+ * guarantee for client-side state saving as with server-side state saving.
+ * </p>
+ *
+ * <p>
+ * The form signature is calculated as follows:
+ * </p>
+ *
+ * <pre>
+ * sha1(signature = contextPath + viewId + "," + formClientId + random alphanum, salt = clientUid)
+ * </pre>
+ *
+ * <p>
+ * The developer can also choose to incorporate the session id into this hash to
+ * generate a more secure token (at the cost of binding it to the session) by
+ * setting the requireSession attribute to true. Then the calculation becomes:
+ * </p>
+ *
+ * <pre>
+ * sha1(signature = contextPath + viewId + "," + formClientId + "," + random alphanum + sessionId, salt = clientUid)
+ * </pre>
+ *
+ * <p>
+ * The decode method performs the following steps:
+ * </p>
+ * <ol>
+ * <li>Check if this is a postback, otherwise skip the check</li>
+ * <li>Check that this form was the one that was submitted, otherwise skip the
+ * check</li>
+ * <li>Get the unique client identifier (from cookie), otherwise throw an
+ * exception that the browser must have unique identifier</li>
+ * <li>Get the javax.faces.FormSignature request parameter, otherwise throw an
+ * exception that the form signature is missing</li>
+ * <li>If the renderStampStore component is enabled, retrieve the render stamp
+ * from the store using the key stored in the render stamp attribute of the form.</li>
+ * <li>Generate the hash as before and verify that it equals the value of the
+ * javax.faces.FormSignature request parameter, otherwise throw an exception</li>
+ * </ol>
+ *
+ * <p>
+ * If all of that passes, we are okay to process the form (advance to validate
+ * phase as decode() is called in apply request values).
+ * </p>
+ *
+ * @author Dan Allen
+ * @author Stuart Douglas
+ * @see UnauthorizedCommandException
+ */
+public class TokenRendererBase extends RendererBase
+{
+ public static final String FORM_SIGNATURE_PARAM = "javax.faces.FormSignature";
+
+ public static final String RENDER_STAMP_ATTR = "javax.faces.RenderStamp";
+
+ private static final String COOKIE_CHECK_SCRIPT_KEY = "org.jboss.seam.ui.COOKIE_CHECK_SCRIPT";
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIToken.class;
+ }
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component)
+ {
+ UIToken token = (UIToken) component;
+ UIForm form = token.getParentForm();
+ if (context.getRenderKit().getResponseStateManager().isPostback(context) && form.isSubmitted())
+ {
+ String clientToken = token.getClientUid();
+ String viewId = context.getViewRoot().getViewId();
+ if (clientToken == null)
+ {
+ throw new UnauthorizedCommandException(viewId, "No client identifier provided");
+ }
+
+ String requestedViewSig = context.getExternalContext().getRequestParameterMap().get(FORM_SIGNATURE_PARAM);
+ if (requestedViewSig == null)
+ {
+ throw new UnauthorizedCommandException(viewId, "No form signature provided");
+ }
+
+ if (!requestedViewSig.equals(generateViewSignature(context, form, !token.isAllowMultiplePosts(), token.isRequireSession(), clientToken)))
+ {
+ throw new UnauthorizedCommandException(viewId, "Form signature invalid");
+ }
+ RenderStampStore store = RenderStampStore.instance();
+ if (store != null)
+ {
+ // remove the key from the store if we are using it
+ store.removeStamp(String.valueOf(form.getAttributes().get(RENDER_STAMP_ATTR)));
+ }
+ form.getAttributes().remove(RENDER_STAMP_ATTR);
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIToken token = (UIToken) component;
+ UIForm form = token.getParentForm();
+ if (form == null)
+ {
+ throw new IllegalStateException("UIToken must be inside a UIForm.");
+ }
+
+ String renderStamp = RandomStringUtils.randomAlphanumeric(50);
+ RenderStampStore store = RenderStampStore.instance();
+ if (store != null)
+ {
+ // if the store is not null we store the key
+ // instead of the actual stamp; this puts the
+ // server in control of this value rather than
+ // the component tree, which is owned by the client
+ // when using client-side state saving
+ renderStamp = store.storeStamp(renderStamp);
+ }
+
+ writeCookieCheckScript(context, writer, token);
+
+ token.getClientUidSelector().seed();
+ form.getAttributes().put(RENDER_STAMP_ATTR, renderStamp);
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, HTML.TYPE_ATTR);
+ writer.writeAttribute(HTML.NAME_ATTR, FORM_SIGNATURE_PARAM, HTML.NAME_ATTR);
+ writer.writeAttribute(HTML.VALUE_ATTR, generateViewSignature(context, form, !token.isAllowMultiplePosts(), token.isRequireSession(), token.getClientUidSelector().getClientUid()), HTML.VALUE_ATTR);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+ /**
+ * If the client has not already delivered us a cookie and the cookie notice is enabled, write out JavaScript that will show the user
+ * an alert if cookies are not enabled.
+ */
+ private void writeCookieCheckScript(FacesContext context, ResponseWriter writer, UIToken token) throws IOException
+ {
+ if (!token.getClientUidSelector().isSet() && token.isEnableCookieNotice() && !context.getExternalContext().getRequestMap().containsKey(COOKIE_CHECK_SCRIPT_KEY)) {
+ writer.startElement(HTML.SCRIPT_ELEM, token);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", HTML.TYPE_ATTR);
+ writer.write("if (!document.cookie) {" +
+ " alert('This website uses a security measure that requires cookies to be enabled in your browser. Since you have cookies disabled, you will not be permitted to submit a form.');" +
+ " }");
+ writer.endElement(HTML.SCRIPT_ELEM);
+ context.getExternalContext().getRequestMap().put(COOKIE_CHECK_SCRIPT_KEY, true);
+ }
+ }
+
+ private String generateViewSignature(FacesContext context, UIForm form, boolean useRenderStamp, boolean useSessionId, String saltPhrase)
+ {
+ String rawViewSignature = context.getExternalContext().getRequestContextPath() + "," + context.getViewRoot().getViewId() + "," + form.getClientId(context);
+ if (useRenderStamp)
+ {
+ String renderStamp = form.getAttributes().get(RENDER_STAMP_ATTR).toString();
+ RenderStampStore store = RenderStampStore.instance();
+ if (store != null)
+ {
+ // if we are using the RenderStampStore the key to access the render
+ // stamp
+ // is stored in the view root instead of the actual render stamp
+ renderStamp = store.getStamp(renderStamp);
+ }
+ rawViewSignature += "," + renderStamp;
+ }
+ if (useSessionId)
+ {
+ rawViewSignature += "," + ((HttpSession) context.getExternalContext().getSession(true)).getId();
+ }
+ try
+ {
+ MessageDigest digest = MessageDigest.getInstance("SHA-1");
+ digest.update(saltPhrase.getBytes());
+ byte[] salt = digest.digest();
+ digest.reset();
+ digest.update(rawViewSignature.getBytes());
+ digest.update(salt);
+ byte[] raw = digest.digest();
+ return Base64.encodeBytes(raw);
+ }
+ catch (NoSuchAlgorithmException ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ValidateAllRendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ValidateAllRendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/renderkit/ValidateAllRendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,59 @@
+package org.jboss.seam.ui.renderkit;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.jboss.seam.ui.component.UIValidateAll;
+import org.jboss.seam.ui.util.cdk.RendererBase;
+import org.jboss.seam.ui.validator.ModelValidator;
+
+public class ValidateAllRendererBase extends RendererBase
+{
+
+ @Override
+ protected Class getComponentClass()
+ {
+ return UIValidateAll.class;
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UIValidateAll validateAll = (UIValidateAll) component;
+ if (!validateAll.isValidatorsAdded())
+ {
+ addValidators(validateAll.getChildren());
+ validateAll.setValidatorsAdded(true);
+ }
+ renderChildren(context, component);
+ }
+
+ private void addValidators(List children)
+ {
+ for (Object child: children)
+ {
+ if (child instanceof EditableValueHolder)
+ {
+ EditableValueHolder evh = (EditableValueHolder) child;
+ if ( evh.getValidators().length==0 )
+ {
+ evh.addValidator( new ModelValidator() );
+ }
+ }
+ addValidators( ( (UIComponent) child ).getChildren() );
+ }
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/resource/WebResource.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/resource/WebResource.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/resource/WebResource.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,61 @@
+package org.jboss.seam.ui.resource;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.util.Resources;
+import org.jboss.seam.web.AbstractResource;
+
+ at Scope(APPLICATION)
+ at Name("org.jboss.seam.ui.resource.webResource")
+ at Install(precedence = BUILT_IN)
+ at BypassInterceptors
+public class WebResource extends AbstractResource
+{
+ public static final String WEB_RESOURCE_PATH = "/seam/resource/web";
+
+ private static final String RESOURCE_PATH = "/web";
+
+ @Override
+ public String getResourcePath()
+ {
+ return RESOURCE_PATH;
+ }
+
+ @Override
+ public void getResource(HttpServletRequest request, HttpServletResponse response)
+ throws IOException
+ {
+ String pathInfo = request.getPathInfo().substring(getResourcePath().length());
+
+ InputStream in = Resources.getResourceAsStream( "/org/jboss/seam/ui/resource" + pathInfo, getServletContext() );
+
+ try {
+ if (in != null) {
+ byte[] buffer = new byte[1024];
+ int read = in.read(buffer);
+ while (read != -1) {
+ response.getOutputStream().write(buffer, 0, read);
+ read = in.read(buffer);
+ }
+ response.getOutputStream().flush();
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ } finally {
+ Resources.closeStream(in);
+ }
+ }
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Decoration.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Decoration.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Decoration.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,93 @@
+package org.jboss.seam.ui.util;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+
+public class Decoration
+{
+
+ public static boolean hasMessage(UIComponent component, FacesContext context)
+ {
+
+ // If the component isn't to be rendered, then ignore
+ if ( !component.isRendered() ) return false;
+
+
+ if ( component instanceof EditableValueHolder )
+ {
+
+ // If the component has failed validation, then it's invalid
+ if ( ! ( (EditableValueHolder) component ).isValid() ) return true;
+
+ // If the component has a faces message attached, return true.
+ // TODO enhance this to only consider ERROR and WARN messages probably
+ if ( context.getMessages( component.getClientId(context) ).hasNext() ) return true; //TODO: put this outside the if???
+ }
+
+ for ( Object child: component.getChildren() )
+ {
+ if (child instanceof UIComponent)
+ {
+ boolean message = hasMessage( (UIComponent) child, context );
+ if (message) return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasRequired(UIComponent component, FacesContext context)
+ {
+ if ( !component.isRendered() ) return false;
+
+ if ( component instanceof EditableValueHolder )
+ {
+ if ( ( (EditableValueHolder) component ).isRequired() ) return true;
+ }
+
+ for (Object child: component.getChildren())
+ {
+ if (child instanceof UIComponent)
+ {
+ boolean required = hasRequired( (UIComponent) child, context );
+ if (required) return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A depth-first search for an EditableValueHolder
+ */
+ public static UIComponent getEditableValueHolder(UIComponent component)
+ {
+ for (Object child: component.getChildren())
+ {
+ if (child instanceof EditableValueHolder)
+ {
+ UIComponent evh =(UIComponent) child;
+ if ( evh.isRendered() )
+ {
+ return evh;
+ }
+ }
+ else if (child instanceof UIComponent)
+ {
+ UIComponent evh = getEditableValueHolder( (UIComponent) child );
+ if (evh!=null) return evh;
+ }
+ }
+ return null;
+ }
+
+ public static UIComponent getDecoration(String name, UIComponent component)
+ {
+ UIComponent dec = component.getFacet(name);
+ if (dec!=null) return dec;
+ if ( component.getParent()==null ) return null;
+ return getDecoration( name, component.getParent() );
+ }
+
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Faces.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Faces.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/Faces.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,22 @@
+package org.jboss.seam.ui.util;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+public class Faces
+{
+
+ public static String getDefaultSuffix(ServletContext servletContext) throws FacesException
+ {
+ String viewSuffix = servletContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+ return (viewSuffix != null) ? viewSuffix : ViewHandler.DEFAULT_SUFFIX;
+ }
+
+ public static String getDefaultSuffix(FacesContext context) throws FacesException {
+ String viewSuffix = context.getExternalContext().getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+ return (viewSuffix != null) ? viewSuffix : ViewHandler.DEFAULT_SUFFIX;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/HTML.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/HTML.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/HTML.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,545 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.seam.ui.util;
+import java.io.IOException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.ResponseWriter;
+/**
+ * Constant declarations for HTML rendering.
+ * @author Manfred Geiler
+ * @author Anton Koinov
+ * @version $Revision: 5294 $ $Date: 2007-06-19 23:57:50 +0200 (Út, 19 VI 2007) $
+ */
+public final class HTML
+{
+
+ private static String[] concat(String[]... x)
+ {
+ int len = 0;
+ for (String[] y: x) len+=y.length;
+ String[] result = new String[len];
+ int i=0;
+ for (String[] y: x)
+ {
+ for (String s: y)
+ {
+ result[i++] = s;
+ }
+ }
+ return result;
+ }
+ /**
+ * @return true, if an attribute was written
+ * @throws java.io.IOException
+ */
+ public static boolean renderHTMLAttributes(ResponseWriter writer,
+ UIComponent component, String[] attributes) throws IOException {
+ boolean somethingDone = false;
+ for (int i = 0, len = attributes.length; i < len; i++) {
+ String attrName = attributes[i];
+ if (renderHTMLAttribute(writer, component, attrName, attrName)) {
+ somethingDone = true;
+ }
+ }
+ return somethingDone;
+ }
+ /**
+ * @return true, if the attribute was written
+ * @throws java.io.IOException
+ */
+ public static boolean renderHTMLAttribute(ResponseWriter writer,
+ UIComponent component, String componentProperty, String htmlAttrName)
+ throws IOException {
+ Object value = component.getAttributes().get(componentProperty);
+ return renderHTMLAttribute(writer, componentProperty, htmlAttrName,
+ value);
+ }
+ /**
+ * @return true, if the attribute was written
+ * @throws java.io.IOException
+ */
+ public static boolean renderHTMLAttribute(ResponseWriter writer,
+ String componentProperty, String attrName, Object value)
+ throws IOException {
+ if (!isDefaultAttributeValue(value)) {
+ // render JSF "styleClass" attribute as "class"
+ String htmlAttrName = attrName.equals(HTML.STYLE_CLASS_ATTR) ? HTML.CLASS_ATTR
+ : attrName;
+ writer.writeAttribute(htmlAttrName, value, componentProperty);
+ return true;
+ }
+ return false;
+ }
+ /**
+ * See JSF Spec. 8.5 Table 8-1
+ * @param value
+ * @return boolean
+ */
+ public static boolean isDefaultAttributeValue(Object value)
+ {
+ if (value == null)
+ {
+ return true;
+ }
+ else if (value instanceof Boolean)
+ {
+ return ((Boolean)value).booleanValue() == false;
+ }
+ else if (value instanceof Number)
+ {
+ if (value instanceof Integer)
+ {
+ return ((Number)value).intValue() == Integer.MIN_VALUE;
+ }
+ else if (value instanceof Double)
+ {
+ return ((Number)value).doubleValue() == Double.MIN_VALUE;
+ }
+ else if (value instanceof Long)
+ {
+ return ((Number)value).longValue() == Long.MIN_VALUE;
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Number)value).byteValue() == Byte.MIN_VALUE;
+ }
+ else if (value instanceof Float)
+ {
+ return ((Number)value).floatValue() == Float.MIN_VALUE;
+ }
+ else if (value instanceof Short)
+ {
+ return ((Number)value).shortValue() == Short.MIN_VALUE;
+ }
+ }
+ return false;
+ }
+ private HTML()
+ {
+ // disable instantiation
+ }
+ // Common attributes
+ public static final String ALIGN_ATTR = "align";
+ public static final String DATAFLD_ATTR = "datafld";
+ public static final String DATASRC_ATTR = "datasrc";
+ public static final String DATAFORMATAS_ATTR = "dataformatas";
+ public static final String BORDER_ATTR = "border";
+ public static final String WIDTH_ATTR = "width";
+ public static final String READONLY_ATTR = "readonly";
+ public static final String FILE_ATTR = "file";
+ public static final String ACCEPT_ATTR = "accept";
+ // Common event handler attributes
+ public static final String ONCLICK_ATTR = "onclick";
+ public static final String ONDBLCLICK_ATTR = "ondblclick";
+ public static final String ONMOUSEDOWN_ATTR = "onmousedown";
+ public static final String ONMOUSEUP_ATTR = "onmouseup";
+ public static final String ONMOUSEOVER_ATTR = "onmouseover";
+ public static final String ONMOUSEMOVE_ATTR = "onmousemove";
+ public static final String ONMOUSEOUT_ATTR = "onmouseout";
+ public static final String ONKEYPRESS_ATTR = "onkeypress";
+ public static final String ONKEYDOWN_ATTR = "onkeydown";
+ public static final String ONKEYUP_ATTR = "onkeyup";
+ public static final String[] EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK =
+ {
+ ONDBLCLICK_ATTR,
+ ONMOUSEDOWN_ATTR,
+ ONMOUSEUP_ATTR,
+ ONMOUSEOVER_ATTR,
+ ONMOUSEMOVE_ATTR,
+ ONMOUSEOUT_ATTR,
+ ONKEYPRESS_ATTR,
+ ONKEYDOWN_ATTR,
+ ONKEYUP_ATTR
+ };
+ public static final String[] EVENT_HANDLER_ATTRIBUTES =
+ concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ new String[] {ONCLICK_ATTR});
+ // Input field event handler attributes
+ public static final String ONFOCUS_ATTR = "onfocus";
+ public static final String ONBLUR_ATTR = "onblur";
+ public static final String ONSELECT_ATTR = "onselect";
+ public static final String ONCHANGE_ATTR = "onchange";
+ public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES =
+ {
+ ONFOCUS_ATTR,
+ ONBLUR_ATTR,
+ ONSELECT_ATTR,
+ ONCHANGE_ATTR
+ };
+ public static final String[] COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS =
+ {
+ ONBLUR_ATTR,
+ ONSELECT_ATTR,
+ ONCHANGE_ATTR
+ };
+ // universal attributes
+ public static final String DIR_ATTR = "dir";
+ public static final String LANG_ATTR = "lang";
+ public static final String STYLE_ATTR = "style";
+ public static final String TITLE_ATTR = "title";
+ public static final String STYLE_CLASS_ATTR = "styleClass"; //"class" cannot be used as property name
+ public static final String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE =
+ {
+ DIR_ATTR,
+ LANG_ATTR,
+ TITLE_ATTR,
+ //NOTE: if changed, please verify universal attributes in HtmlMessageRenderer !
+ };
+ public static final String[] UNIVERSAL_ATTRIBUTES =
+ concat(
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE,
+ new String[] {STYLE_ATTR, STYLE_CLASS_ATTR});
+ //universal, but not the same property-name -
+ //styleClass attribute is rendered as such
+ public static final String CLASS_ATTR = "class";
+ // common form field attributes
+ public static final String ACCESSKEY_ATTR = "accesskey";
+ public static final String TABINDEX_ATTR = "tabindex";
+ public static final String DISABLED_ATTR = "disabled";
+ public static final String[] COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED =
+ {
+ ACCESSKEY_ATTR,
+ TABINDEX_ATTR
+ };
+ public static final String[] COMMON_FIELD_ATTRIBUTES =
+ concat(
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ new String[] {DISABLED_ATTR});
+ // Common Attributes
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES =
+ concat(
+ EVENT_HANDLER_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE =
+ concat(
+ EVENT_HANDLER_ATTRIBUTES,
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK =
+ concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ UNIVERSAL_ATTRIBUTES);
+ public static final String[] COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
+ concat(
+ EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
+ UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS =
+ concat(
+ COMMON_PASSTROUGH_ATTRIBUTES,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
+ concat(
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONFOCUS);
+ public static final String[] COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
+ concat(
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK,
+ COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
+ COMMON_FIELD_EVENT_ATTRIBUTES);
+ // <a>
+ public static final String TARGET_ATTR = "target"; //used by <a> and <form>
+ public static final String CHARSET_ATTR = "charset";
+ public static final String COORDS_ATTR = "coords";
+ public static final String HREF_ATTR = "href";
+ public static final String HREFLANG_ATTR = "hreflang";
+ public static final String REL_ATTR = "rel";
+ public static final String REV_ATTR = "rev";
+ public static final String SHAPE_ATTR = "shape";
+ public static final String TYPE_ATTR = "type";
+ public static final String[] ANCHOR_ATTRIBUTES =
+ {
+ ACCESSKEY_ATTR,
+ CHARSET_ATTR,
+ COORDS_ATTR,
+ HREFLANG_ATTR,
+ REL_ATTR,
+ REV_ATTR,
+ SHAPE_ATTR,
+ TABINDEX_ATTR,
+ TARGET_ATTR,
+ TYPE_ATTR
+ };
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE =
+ concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_STYLE);
+ public static final String[] ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE =
+ concat(
+ ANCHOR_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE);
+ // <form>
+ public static final String ACCEPT_CHARSET_ATTR = "accept-charset";
+ public static final String ENCTYPE_ATTR = "enctype";
+ public static final String ONRESET_ATTR = "onreset";
+ public static final String ONSUMBIT_ATTR = "onsubmit";
+ public static final String[] FORM_ATTRIBUTES =
+ {
+ ACCEPT_ATTR,
+ ACCEPT_CHARSET_ATTR,
+ ENCTYPE_ATTR,
+ ONRESET_ATTR,
+ ONSUMBIT_ATTR,
+ TARGET_ATTR,
+ };
+ public static final String[] FORM_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ FORM_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ // <img>
+ public static final String SRC_ATTR = "src";
+ public static final String ALT_ATTR = "alt";
+ public static final String HEIGHT_ATTR = "height";
+ public static final String HSPACE_ATTR = "hspace";
+ public static final String ISMAP_ATTR = "ismap";
+ public static final String LONGDESC_ATTR = "longdesc";
+ public static final String USEMAP_ATTR = "usemap";
+ public static final String VSPACE_ATTR = "vspace";
+ public static final String[] IMG_ATTRIBUTES =
+ {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ BORDER_ATTR,
+ HEIGHT_ATTR,
+ HSPACE_ATTR,
+ ISMAP_ATTR,
+ LONGDESC_ATTR,
+ USEMAP_ATTR,
+ VSPACE_ATTR,
+ WIDTH_ATTR
+ };
+ public static final String[] IMG_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ IMG_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ // <input>
+ public static final String SIZE_ATTR = "size";
+ private static final String AUTOCOMPLETE_ATTR = "autocomplete";
+ public static final String CHECKED_ATTR = "checked";
+ public static final String MAXLENGTH_ATTR = "maxlength";
+ public static final String[] INPUT_ATTRIBUTES = {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ CHECKED_ATTR,
+ DATAFLD_ATTR,
+ DATASRC_ATTR,
+ DATAFORMATAS_ATTR,
+ MAXLENGTH_ATTR,
+ READONLY_ATTR,
+ SIZE_ATTR,
+ AUTOCOMPLETE_ATTR
+ };
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK =
+ concat(
+ INPUT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK);
+ //values for input-type attribute
+ public static final String INPUT_TYPE_SUBMIT = "submit";
+ public static final String INPUT_TYPE_IMAGE = "image";
+ public static final String INPUT_TYPE_HIDDEN = "hidden";
+ public static final String INPUT_TYPE_CHECKBOX = "checkbox";
+ public static final String INPUT_TYPE_PASSWORD = "password";
+ public static final String INPUT_TYPE_TEXT = "text";
+ public static final String INPUT_TYPE_RADIO = "radio";
+ public static final String INPUT_TYPE_BUTTON = "button";
+ // <button>
+ public static final String[] BUTTON_ATTRIBUTES =
+ {
+ ALIGN_ATTR,
+ ALT_ATTR,
+ DATAFLD_ATTR,
+ DATASRC_ATTR,
+ DATAFORMATAS_ATTR,
+ };
+ public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ BUTTON_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ public static final String[] BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK =
+ concat(
+ BUTTON_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK);
+ // <iframe>
+ public static final String FRAMEBORDER_ATTR = "frameborder";
+ public static final String SCROLLING_ATTR = "scrolling";
+ // <label>
+ public static final String FOR_ATTR = "for";
+ public static final String[] LABEL_ATTRIBUTES =
+ {
+ ACCESSKEY_ATTR,
+ ONBLUR_ATTR,
+ ONFOCUS_ATTR
+ //FOR_ATTR is no pass through !
+ };
+ public static final String[] LABEL_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ LABEL_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ // <select>
+ public static final String MULTIPLE_ATTR = "multiple";
+ public static final String[] SELECT_ATTRIBUTES =
+ {
+ DATAFLD_ATTR,
+ DATASRC_ATTR,
+ DATAFORMATAS_ATTR,
+ };
+ public static final String[] SELECT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ SELECT_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ // <table>
+ public static final String BGCOLOR_ATTR = "bgcolor";
+ public static final String CELLPADDING_ATTR = "cellpadding";
+ public static final String CELLSPACING_ATTR = "cellspacing";
+ public static final String FRAME_ATTR = "frame";
+ public static final String RULES_ATTR = "rules";
+ public static final String SUMMARY_ATTR = "summary";
+ public static final String[] TABLE_ATTRIBUTES = {
+ ALIGN_ATTR,
+ BGCOLOR_ATTR,
+ BORDER_ATTR,
+ CELLPADDING_ATTR,
+ CELLSPACING_ATTR,
+ DATAFLD_ATTR,
+ DATASRC_ATTR,
+ DATAFORMATAS_ATTR,
+ FRAME_ATTR,
+ RULES_ATTR,
+ SUMMARY_ATTR,
+ WIDTH_ATTR
+ };
+ public static final String[] TABLE_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ TABLE_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ // <textarea>
+ public static final String COLS_ATTR = "cols";
+ public static final String ROWS_ATTR = "rows";
+ public static final String[] TEXTAREA_ATTRIBUTES =
+ {
+ COLS_ATTR,
+ DATAFLD_ATTR,
+ DATASRC_ATTR,
+ DATAFORMATAS_ATTR,
+ READONLY_ATTR,
+ ROWS_ATTR,
+ };
+ public static final String[] TEXTAREA_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ TEXTAREA_ATTRIBUTES,
+ COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ // <input type=file>
+ public static final String[] INPUT_FILE_UPLOAD_ATTRIBUTES =
+ {
+ ACCEPT_ATTR
+ };
+ public static final String[] INPUT_FILE_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED =
+ concat(
+ INPUT_FILE_UPLOAD_ATTRIBUTES,
+ INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+ /*
+ public static final String[] MESSAGE_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ new String[] {DIR_ATTR, LANG_ATTR, TITLE_ATTR, STYLE_ATTR, STYLE_CLASS_ATTR},
+ EVENT_HANDLER_ATTRIBUTES);
+ */
+ public static final String[] MESSAGE_PASSTHROUGH_ATTRIBUTES_WITHOUT_TITLE_STYLE_AND_STYLE_CLASS =
+ concat(
+ new String[] {DIR_ATTR, LANG_ATTR},
+ EVENT_HANDLER_ATTRIBUTES);
+ // selectOne/Many table
+ public static final String[] SELECT_TABLE_PASSTHROUGH_ATTRIBUTES =
+ new String[] {STYLE_ATTR, STYLE_CLASS_ATTR, BORDER_ATTR};
+ public static final String COMPACT_ATTR = "compact";
+ public static final String[] UL_ATTRIBUTES = {
+ COMPACT_ATTR,
+ TYPE_ATTR
+ };
+ public static final String[] UL_PASSTHROUGH_ATTRIBUTES =
+ concat(
+ UL_ATTRIBUTES,
+ COMMON_PASSTROUGH_ATTRIBUTES);
+ //HTML attributes needed for renderding only
+ public static final String ID_ATTR = "id";
+ public static final String NAME_ATTR = "name";
+ public static final String VALUE_ATTR = "value";
+ public static final String METHOD_ATTR = "method";
+ public static final String ACTION_ATTR = "action";
+ public static final String COLSPAN_ATTR = "colspan";
+ public static final String SCOPE_ATTR = "scope";
+ public static final String LABEL_ATTR = "label";
+ public static final String SELECTED_ATTR = "selected";
+ //HTML attributes values
+ public static final String SCOPE_COLGROUP_VALUE = "colgroup";
+ //HTML element constants
+ public static final String SPAN_ELEM = "span";
+ public static final String DIV_ELEM = "div";
+ public static final String INPUT_ELEM = "input";
+ public static final String BUTTON_ELEM = "button";
+ public static final String SELECT_ELEM = "select";
+ public static final String OPTION_ELEM = "option";
+ public static final String OPTGROUP_ELEM = "optgroup";
+ public static final String TEXTAREA_ELEM = "textarea";
+ public static final String FORM_ELEM = "form";
+ public static final String ANCHOR_ELEM = "a";
+ public static final String H1_ELEM = "h1";
+ public static final String H2_ELEM = "h2";
+ public static final String H3_ELEM = "h3";
+ public static final String H4_ELEM = "h4";
+ public static final String H5_ELEM = "h5";
+ public static final String H6_ELEM = "h6";
+ public static final String IFRAME_ELEM = "iframe";
+ public static final String IMG_ELEM = "img";
+ public static final String LABEL_ELEM = "label";
+ public static final String TABLE_ELEM = "table";
+ public static final String TR_ELEM = "tr";
+ public static final String TH_ELEM = "th";
+ public static final String TD_ELEM = "td";
+ public static final String TBODY_ELEM = "tbody";
+ public static final String TFOOT_ELEM = "tfoot";
+ public static final String THEAD_ELEM = "thead";
+ public static final String STYLE_ELEM = "style";
+ public static final String SCRIPT_ELEM = "script";
+ public static final String SCRIPT_TYPE_ATTR = "type";
+ public static final String SCRIPT_TYPE_TEXT_JAVASCRIPT = "text/javascript";
+ public static final String SCRIPT_LANGUAGE_ATTR = "language";
+ public static final String SCRIPT_LANGUAGE_JAVASCRIPT = "JavaScript";
+ public static final String UL_ELEM = "ul";
+ public static final String OL_ELEM = "ol";
+ public static final String LI_ELEM = "li";
+ //HTML simple element constants
+ public static final String BR_ELEM = "br";
+ //HTML entities
+ public static final String NBSP_ENTITY = " ";
+ public static final String HREF_PATH_SEPARATOR = "/";
+ public static final String HREF_PATH_FROM_PARAM_SEPARATOR = "?";
+ public static final String HREF_PARAM_SEPARATOR = "&";
+ public static final String HREF_PARAM_NAME_FROM_VALUE_SEPARATOR = "=";
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/JSF.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/JSF.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/JSF.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.seam.ui.util;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * Constant declarations for JSF tags
+ *
+ * @author Anton Koinov
+ * @author Manfred Geiler
+ *
+ */
+public class JSF
+{
+
+ // Common Attributes
+ public static final String ID_ATTR = "id";
+
+ public static final String VALUE_ATTR = "value";
+
+ public static final String BINDING_ATTR = "binding";
+
+ public static final String STYLE_CLASS_ATTR = "styleClass";
+
+ public static final String ESCAPE_ATTR = "escape";
+
+ // Common Output Attributes
+ public static final String FOR_ATTR = "for";
+
+ public static final String CONVERTER_ATTR = "converter";
+
+ // Ouput_Time Attributes
+ public static final String TIME_STYLE_ATTR = "timeStyle";
+
+ public static final String TIMEZONE_ATTR = "timezone";
+
+ // Common Input Attributes
+ public static final String REQUIRED_ATTR = "required";
+
+ public static final String VALIDATOR_ATTR = "validator";
+
+ // Input_Secret Attributes
+ public static final String REDISPLAY_ATTR = "redisplay";
+
+ // Input_Checkbox Attributes
+ public static final String LAYOUT_ATTR = "layout";
+
+ // Select_Menu Attributes
+ public static final String SIZE_ATTR = "size";
+
+ // SelectMany Checkbox List/ Select One Radio Attributes
+ public static final String BORDER_ATTR = "border";
+
+ public static final String DISABLED_CLASS_ATTR = "disabledClass";
+
+ public static final String ENABLED_CLASS_ATTR = "enabledClass";
+
+ // Common Command Attributes
+ /** @deprecated */
+ public static final String COMMAND_CLASS_ATTR = "commandClass";
+
+ public static final String LABEL_ATTR = "label";
+
+ public static final String IMAGE_ATTR = "image";
+
+ public static final String ACTION_ATTR = "action";
+
+ public static final String IMMEDIATE_ATTR = "immediate";
+
+ // Command_Button Attributes
+ public static final String TYPE_ATTR = "type";
+
+ // Common Panel Attributes
+ /** @deprecated */
+ public static final String PANEL_CLASS_ATTR = "panelClass";
+
+ public static final String FOOTER_CLASS_ATTR = "footerClass";
+
+ public static final String HEADER_CLASS_ATTR = "headerClass";
+
+ public static final String COLUMN_CLASSES_ATTR = "columnClasses";
+
+ public static final String ROW_CLASSES_ATTR = "rowClasses";
+
+ // Panel_Grid Attributes
+ public static final String COLUMNS_ATTR = "columns";
+
+ public static final String COLSPAN_ATTR = "colspan"; // extension
+
+ // UIMessage and UIMessages attributes
+ public static final String SHOW_SUMMARY_ATTR = "showSummary";
+
+ public static final String SHOW_DETAIL_ATTR = "showDetail";
+
+ public static final String GLOBAL_ONLY_ATTR = "globalOnly";
+
+ // HtmlOutputMessage attributes
+ public static final String ERROR_CLASS_ATTR = "errorClass";
+
+ public static final String ERROR_STYLE_ATTR = "errorStyle";
+
+ public static final String FATAL_CLASS_ATTR = "fatalClass";
+
+ public static final String FATAL_STYLE_ATTR = "fatalStyle";
+
+ public static final String INFO_CLASS_ATTR = "infoClass";
+
+ public static final String INFO_STYLE_ATTR = "infoStyle";
+
+ public static final String WARN_CLASS_ATTR = "warnClass";
+
+ public static final String WARN_STYLE_ATTR = "warnStyle";
+
+ public static final String TITLE_ATTR = "title";
+
+ public static final String TOOLTIP_ATTR = "tooltip";
+
+ // GraphicImage attributes
+ public static final String URL_ATTR = "url";
+
+ // UISelectItem attributes
+ public static final String ITEM_DISABLED_ATTR = "itemDisabled";
+
+ public static final String ITEM_DESCRIPTION_ATTR = "itemDescription";
+
+ public static final String ITEM_LABEL_ATTR = "itemLabel";
+
+ public static final String ITEM_VALUE_ATTR = "itemValue";
+
+ // UIData attributes
+ public static final String ROWS_ATTR = "rows";
+
+ public static final String VAR_ATTR = "var";
+
+ public static final String FIRST_ATTR = "first";
+
+ public static void renderChildren(FacesContext facesContext,
+ UIComponent component) throws IOException
+ {
+ List children = component.getChildren();
+ for (int j=0, size = component.getChildCount(); j<size; j++)
+ {
+ UIComponent child = (UIComponent) children.get(j);
+ renderChild(facesContext, child);
+ }
+ }
+
+ public static void renderChild(FacesContext facesContext, UIComponent child)
+ throws IOException
+ {
+ if ( child.isRendered() )
+ {
+ child.encodeBegin(facesContext);
+ if ( child.getRendersChildren() )
+ {
+ child.encodeChildren(facesContext);
+ }
+ else
+ {
+ renderChildren(facesContext, child);
+ }
+ child.encodeEnd(facesContext);
+ }
+ }
+
+ public static String getStringValue(FacesContext context, ValueExpression vb)
+ {
+ Object value = vb.getValue(context.getELContext());
+ if (value == null)
+ {
+ return null;
+ }
+ return value.toString();
+ }
+
+ public static Integer getIntegerValue(FacesContext context, ValueExpression vb)
+ {
+ String value = getStringValue(context, vb);
+ if (value == null)
+ {
+ return null;
+ }
+ return new Integer(value);
+ }
+
+ public static Double getDoubleValue(FacesContext context, ValueExpression vb)
+ {
+ String value = getStringValue(context, vb);
+ if (value == null)
+ {
+ return null;
+ }
+ return new Double(value);
+ }
+
+ public static Boolean getBooleanValue(FacesContext context, ValueExpression vb)
+ {
+ Object value = vb.getValue(context.getELContext());
+ if (value == null)
+ {
+ return null;
+ }
+ if (value instanceof Boolean)
+ {
+ return (Boolean) value;
+ }
+ else
+ {
+ return Boolean.valueOf(value.toString());
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,112 @@
+package org.jboss.seam.ui.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.faces.component.UIParameter;
+
+public class UrlBuilder
+{
+ private static final String URL_ENCODING = "UTF-8";
+
+ private String url;
+
+ private String fragment;
+ private String characterEncoding;
+
+ private boolean urlEncodeParameters = true;
+
+ private Map<String, String> parameters;
+
+ protected UrlBuilder(String fragment, String characterEncoding)
+ {
+ this.fragment = fragment;
+ parameters = new LinkedHashMap<String, String>();
+ this.characterEncoding = characterEncoding;
+ }
+
+ public UrlBuilder(String fragment, String characterEncoding, boolean urlEncodeParameters)
+ {
+ this(fragment, characterEncoding);
+ this.urlEncodeParameters = urlEncodeParameters;
+ }
+
+ public UrlBuilder(String url, String fragment, String characterEncoding)
+ {
+ this(fragment, characterEncoding);
+ setUrl(url);
+ }
+
+ public UrlBuilder(String url, String fragment, String characterEncoding, boolean urlEncodeParameters)
+ {
+ this(url, fragment, characterEncoding);
+ this.urlEncodeParameters = urlEncodeParameters;
+ }
+
+ protected void setUrl(String url)
+ {
+ if (url == null)
+ {
+ throw new NullPointerException("url must not be null");
+ }
+ this.url = url;
+ }
+
+ protected String urlEncode(String value) throws UnsupportedEncodingException
+ {
+ return characterEncoding == null ? URLEncoder.encode(value, URL_ENCODING) : URLEncoder.encode(value,
+ characterEncoding);
+ }
+
+ protected String getFragment()
+ {
+ if (fragment != null && !"".equals(fragment))
+ {
+ return "#" + fragment;
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public String getEncodedUrl()
+ {
+ String params = getParametersAsString();
+ if (!"".equals(params) && !url.contains("?"))
+ {
+ params = "?" + params.substring(1);
+ }
+ return url + params + getFragment();
+ }
+
+ protected String getParametersAsString()
+ {
+ String params = "";
+ for (String key : parameters.keySet())
+ {
+ params += "&" + key + "=" + parameters.get(key);
+ }
+ return params;
+ }
+
+ protected Map<String, String> getParameters()
+ {
+ return parameters;
+ }
+
+ public void addParameter(String name, String value) throws UnsupportedEncodingException
+ {
+ parameters.put(name, urlEncodeParameters ? urlEncode(value) : value);
+ }
+
+ public void addParameter(UIParameter parameter) throws UnsupportedEncodingException
+ {
+ String value = parameter.getValue() == null ? "" : parameter.getValue().toString();
+ String name = parameter.getName();
+ addParameter(name, value);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/ViewUrlBuilder.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/ViewUrlBuilder.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/ViewUrlBuilder.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,54 @@
+
+package org.jboss.seam.ui.util;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.navigation.Page;
+import org.jboss.seam.navigation.Pages;
+
+public class ViewUrlBuilder extends UrlBuilder
+{
+
+ private Page page;
+
+ public ViewUrlBuilder(String viewId, String fragment, boolean urlEncodeParameters)
+ {
+ super(fragment, FacesContext.getCurrentInstance().getResponseWriter().getCharacterEncoding(), urlEncodeParameters);
+ if (viewId == null)
+ {
+ throw new NullPointerException("viewId must not be null");
+ }
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ String url = facesContext.getApplication().getViewHandler().getActionURL(facesContext,
+ viewId);
+ url = Pages.instance().encodeScheme(viewId, facesContext, url);
+ setUrl(url);
+
+ page = Pages.instance().getPage(viewId);
+ }
+
+ public ViewUrlBuilder(String viewId, String fragment)
+ {
+ this(viewId, fragment, true);
+
+ }
+
+ @Override
+ public void addParameter(UIParameter parameter) throws UnsupportedEncodingException
+ {
+ String name = parameter.getName();
+ if (parameter.getValue() != null && !(name.equals(page.getConversationIdParameter().getParameterName())
+ && getParameters().containsKey(name)))
+ {
+ super.addParameter(parameter);
+ }
+ }
+
+ @Override
+ public String getEncodedUrl() {
+ return FacesContext.getCurrentInstance().getExternalContext().encodeActionURL(super.getEncodedUrl());
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/Messages.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/Messages.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/Messages.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,311 @@
+package org.jboss.seam.ui.util.cdk;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.ajax4jsf.messages";
+
+ private static Map<ClassLoader, ResourceBundle> bundles = new HashMap<ClassLoader, ResourceBundle>();
+
+ private static synchronized ResourceBundle getBundle() {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ ResourceBundle bundle = bundles.get(contextClassLoader);
+ if (bundle == null) {
+ bundle = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(), contextClassLoader);
+ bundles.put(contextClassLoader, bundle);
+ }
+
+ return bundle;
+ }
+
+ public static final String getMessage(String name) {
+ String value = getBundle().getString(name);
+ return value == null ? "%" + name + "%" : value;
+ }
+
+ public static final String getMessage(String name, Object param) {
+ String pattern = getBundle().getString(name);
+ if(pattern == null) return "%" + name + "%";
+ return MessageFormat.format(pattern, new Object[]{param});
+ }
+
+ public static final String getMessage(String name, Object param1, Object param2) {
+ String pattern = getBundle().getString(name);
+ if(pattern == null) return "%" + name + "%";
+ return MessageFormat.format(pattern, new Object[]{param1, param2});
+ }
+
+ public static final String getMessage(String name, Object[] params) {
+ String pattern = getBundle().getString(name);
+ if(pattern == null) return "%" + name + "%";
+ return MessageFormat.format(pattern, params);
+ }
+
+ public static final String BUNDLE_MAP_NO_PUT_VALUE = "BUNDLE_MAP_NO_PUT_VALUE";
+ public static final String BUNDLE_MAP_NO_REMOVE_VALUE = "BUNDLE_MAP_NO_REMOVE_VALUE";
+ public static final String NO_CONVERTER_REGISTERED = "NO_CONVERTER_REGISTERED";
+ public static final String FOR_TARGETS_NO_AJAX_CONTAINER = "FOR_TARGETS_NO_AJAX_CONTAINER";
+ public static final String VAR_MUST_BE_LITERAL = "VAR_MUST_BE_LITERAL";
+ public static final String EVENT_MUST_BE_LITERAL = "EVENT_MUST_BE_LITERAL";
+ public static final String CREATE_JAVASCRIPT_EVENT = "CREATE_JAVASCRIPT_EVENT";
+ public static final String CALLED_SET_PARENT = "CALLED_SET_PARENT";
+ public static final String DETECT_NEW_COMPONENT = "DETECT_NEW_COMPONENT";
+ public static final String SET_VALUE_BINDING_FOR_EVENT = "SET_VALUE_BINDING_FOR_EVENT";
+ public static final String COULD_NOT_LOAD_RESOURCE_BUNDLE = "COULD_NOT_LOAD_RESOURCE_BUNDLE";
+ public static final String FACES_CONTEXT_NOT_CREATED = "FACES_CONTEXT_NOT_CREATED";
+ public static final String FACES_CONTEXT_HAS_NOT_EXTERNAL = "FACES_CONTEXT_HAS_NOT_EXTERNAL";
+ public static final String FACES_CONTEXT_HAS_NOT_RESPONSE = "FACES_CONTEXT_HAS_NOT_RESPONSE";
+ public static final String CREATE_ALTERNATE_HANDLER = "CREATE_ALTERNATE_HANDLER";
+ public static final String ALTERNATE_HANDLER_CONSTRUCTOR_WARNING = "ALTERNATE_HANDLER_CONSTRUCTOR_WARNING";
+ public static final String VIEW_HANDLER_INSTANTIATION_ERROR = "VIEW_HANDLER_INSTANTIATION_ERROR";
+ public static final String ERROR_ON_PAGE = "ERROR_ON_PAGE";
+ public static final String LIFECYCLE_ERROR = "LIFECYCLE_ERROR";
+ public static final String LIFECYCLE_ERROR_AT_PHASE = "LIFECYCLE_ERROR_AT_PHASE";
+ public static final String COMPONENT_TREE_NOT_CREATED = "COMPONENT_TREE_NOT_CREATED";
+ public static final String SET_AJAX_LISTENER = "SET_AJAX_LISTENER";
+ public static final String ADD_AJAX_AREA = "ADD_AJAX_AREA";
+ public static final String ADD_AJAX_AREAS = "ADD_AJAX_AREAS";
+ public static final String SET_AJAX_REQUEST = "SET_AJAX_REQUEST";
+ public static final String SUBMITTED_AJAX_REQUEST = "SUBMITTED_AJAX_REQUEST";
+ public static final String SEND_EVENT_TO_AJAX_LISTENER = "SEND_EVENT_TO_AJAX_LISTENER";
+ public static final String RENDER_AJAX_REQUEST = "RENDER_AJAX_REQUEST";
+ public static final String RENDERING_AJAX_REGION_ERROR = "RENDERING_AJAX_REGION_ERROR";
+ public static final String RESTORE_AJAX_COMPONENT_STATE = "RESTORE_AJAX_COMPONENT_STATE";
+ public static final String SAVE_AJAX_COMPONENT_STATE = "SAVE_AJAX_COMPONENT_STATE";
+ public static final String CREATE_AJAX_AREAS_SET_TO_RENDER = "CREATE_AJAX_AREAS_SET_TO_RENDER";
+ public static final String ARGUMENT_IS_NOT_AJAX_REGION_ERROR = "ARGUMENT_IS_NOT_AJAX_REGION_ERROR";
+ public static final String NULL_EVENT_SUBMITTED_ERROR = "NULL_EVENT_SUBMITTED_ERROR";
+ public static final String CONTENT_TYPE_ENCODING = "CONTENT_TYPE_ENCODING";
+ public static final String CONTENT_TYPE_NO_ENCODING = "CONTENT_TYPE_NO_ENCODING";
+ public static final String FILTER_START_INFO = "FILTER_START_INFO";
+ public static final String FILTER_XML_OUTPUT = "FILTER_XML_OUTPUT";
+ public static final String FILTER_NO_XML_CHAIN = "FILTER_NO_XML_CHAIN";
+ public static final String FILTER_NO_XML_CHAIN_2 = "FILTER_NO_XML_CHAIN_2";
+ public static final String FILTER_STOP_INFO = "FILTER_STOP_INFO";
+ public static final String PARSER_NOT_INSTANTIATED_ERROR = "PARSER_NOT_INSTANTIATED_ERROR";
+ public static final String PARSING_TIME_INFO = "PARSING_TIME_INFO";
+ public static final String JTIDY_PARSING_ERROR = "JTIDY_PARSING_ERROR";
+ public static final String COMPONENT_NOT_FOUND = "COMPONENT_NOT_FOUND";
+ public static final String EVENT_IS_READ_ONLY = "EVENT_IS_READ_ONLY";
+ public static final String FLUSH_BUFFERED_STREAM_ERROR = "FLUSH_BUFFERED_STREAM_ERROR";
+ public static final String UNSUPPORTED_ENCODING_WARNING = "UNSUPPORTED_ENCODING_WARNING";
+ public static final String UNSUPPORTED_ENCODING_WARNING_2 = "UNSUPPORTED_ENCODING_WARNING_2";
+ public static final String NO_WRITER_CALLED_INFO = "NO_WRITER_CALLED_INFO";
+ public static final String PARSE_XML_DOCUMENT_INFO = "PARSE_XML_DOCUMENT_INFO";
+ public static final String NO_WRITER_POSSIBLE_ERROR = "NO_WRITER_POSSIBLE_ERROR";
+ public static final String CREATE_WRITER_INFO = "CREATE_WRITER_INFO";
+ public static final String NO_STREAM_POSSIBLE_ERROR = "NO_STREAM_POSSIBLE_ERROR";
+ public static final String CREATE_STREAM_INFO = "CREATE_STREAM_INFO";
+ public static final String OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR = "OPEN_CLOSE_TAGS_DO_NOT_MATCH_ERROR";
+ public static final String VARIABLE_SUBSTITUTION_WARNING = "VARIABLE_SUBSTITUTION_WARNING";
+ public static final String START_DOCUMENT_SAX_EXCEPTION = "START_DOCUMENT_SAX_EXCEPTION";
+ public static final String COMMENT_SAX_EXCEPTION = "COMMENT_SAX_EXCEPTION";
+ public static final String END_ELEMENT_SAX_EXCEPTION = "END_ELEMENT_SAX_EXCEPTION";
+ public static final String END_DOCUMENT_SAX_EXCEPTION = "END_DOCUMENT_SAX_EXCEPTION";
+ public static final String START_ELEMENT_SAX_EXCEPTION = "START_ELEMENT_SAX_EXCEPTION";
+ public static final String TEXT_SAX_EXCEPTION = "TEXT_SAX_EXCEPTION";
+ public static final String MESSAGE_PARSING_INFO = "MESSAGE_PARSING_INFO";
+ public static final String CREATE_JTIDY_INFO = "CREATE_JTIDY_INFO";
+ public static final String READING_TIDY_PROPERTIES_ERROR = "READING_TIDY_PROPERTIES_ERROR";
+ public static final String ILLEGAL_METHOD_STATE = "ILLEGAL_METHOD_STATE";
+ public static final String WRAPPED_RULES_NULL_ERROR = "WRAPPED_RULES_NULL_ERROR";
+ public static final String NO_NAME_ATTRIBUTE_ERROR = "NO_NAME_ATTRIBUTE_ERROR";
+ public static final String ENCODE_COMPILED_TEMPLATE_INFO = "ENCODE_COMPILED_TEMPLATE_INFO";
+ public static final String ENCODING_TEMPLATE_TERMINATED_INFO = "ENCODING_TEMPLATE_TERMINATED_INFO";
+ public static final String ENCODE_COMPILED_TEMPLATE_INFO2 = "ENCODE_COMPILED_TEMPLATE_INFO2";
+ public static final String CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR = "CONVERTING_NON_VALUE_HOLDER_COMPONENT_ERROR";
+ public static final String COMPONENT_CLASS_ERROR = "COMPONENT_CLASS_ERROR";
+ public static final String CONTEXT_NULL_ERROR = "CONTEXT_NULL_ERROR";
+ public static final String COMPONENT_NULL_ERROR = "COMPONENT_NULL_ERROR";
+ public static final String START_DECODING_COMPONENT_INFO = "START_DECODING_COMPONENT_INFO";
+ public static final String START_ENCODING_COMPONENT_INFO = "START_ENCODING_COMPONENT_INFO";
+ public static final String CHILDREN_ENCODING_COMPONENT_INFO = "CHILDREN_ENCODING_COMPONENT_INFO";
+ public static final String FINISH_ENCODING_COMPONENT_INFO = "FINISH_ENCODING_COMPONENT_INFO";
+ public static final String NAMESPACE_NOT_RECOGNIZED_ERROR = "NAMESPACE_NOT_RECOGNIZED_ERROR";
+ public static final String RENDERER_METHOD_NOT_SET_ERROR = "RENDERER_METHOD_NOT_SET_ERROR";
+ public static final String METHOD_CALL_ERROR_1 = "METHOD_CALL_ERROR_1";
+ public static final String METHOD_CALL_ERROR_2 = "METHOD_CALL_ERROR_2";
+ public static final String METHOD_CALL_ERROR_3 = "METHOD_CALL_ERROR_3";
+ public static final String METHOD_CALL_ERROR_4 = "METHOD_CALL_ERROR_4";
+ public static final String METHOD_CALL_ERROR_5 = "METHOD_CALL_ERROR_5";
+ public static final String METHOD_CALL_ERROR_6 = "METHOD_CALL_ERROR_6";
+ public static final String METHOD_CALL_ERROR_1a = "METHOD_CALL_ERROR_1a";
+ public static final String METHOD_CALL_ERROR_2a = "METHOD_CALL_ERROR_2a";
+ public static final String METHOD_CALL_ERROR_3a = "METHOD_CALL_ERROR_3a";
+ public static final String METHOD_CALL_ERROR_4a = "METHOD_CALL_ERROR_4a";
+ public static final String METHOD_CALL_ERROR_5a = "METHOD_CALL_ERROR_5a";
+ public static final String METHOD_CALL_ERROR_6a = "METHOD_CALL_ERROR_6a";
+ public static final String PARSING_TEMPLATE_ERROR = "PARSING_TEMPLATE_ERROR";
+ public static final String TEMPLATE_IO_ERROR = "TEMPLATE_IO_ERROR";
+ public static final String PARSING_TEMPLATE_ERROR_2 = "PARSING_TEMPLATE_ERROR_2";
+ public static final String START_COMPILE_TEMPLATE_INFO = "START_COMPILE_TEMPLATE_INFO";
+ public static final String PARSING_TEMPLATE_ERROR_a = "PARSING_TEMPLATE_ERROR_a";
+ public static final String TEMPLATE_IO_ERROR_a = "TEMPLATE_IO_ERROR_a";
+ public static final String PARSING_TEMPLATE_ERROR_2a = "PARSING_TEMPLATE_ERROR_2a";
+ public static final String FINISH_COMPILE_TEMPLATE_INFO = "FINISH_COMPILE_TEMPLATE_INFO";
+ public static final String TEMPLATE_NOT_COMPILED_ERROR = "TEMPLATE_NOT_COMPILED_ERROR";
+ public static final String NO_CHILD_ALLOWED = "NO_CHILD_ALLOWED";
+ public static final String NO_FACET_NAME_ATTRIBUTE = "NO_FACET_NAME_ATTRIBUTE";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR = "BREAKPOINTS_UNSUPPORTED_ERROR";
+ public static final String BREAKPOINT_NOT_REGISTERED_ERROR = "BREAKPOINT_NOT_REGISTERED_ERROR";
+ public static final String CHILD_NOT_ALLOWED_ERROR = "CHILD_NOT_ALLOWED_ERROR";
+ public static final String INVOKE_RENDERER_METHOD_ERROR = "INVOKE_RENDERER_METHOD_ERROR";
+ public static final String METHOD_CALL_ERROR_2b = "METHOD_CALL_ERROR_2b";
+ public static final String METHOD_CALL_ERROR_4b = "METHOD_CALL_ERROR_4b";
+ public static final String METHOD_CALL_ERROR_6b = "METHOD_CALL_ERROR_6b";
+ public static final String STYLE_ATTRIBUTE_ERROR = "STYLE_ATTRIBUTE_ERROR";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR_2 = "BREAKPOINTS_UNSUPPORTED_ERROR_2";
+ public static final String BREAKPOINTS_UNSUPPORTED_ERROR_3 = "BREAKPOINTS_UNSUPPORTED_ERROR_3";
+ public static final String REQUEST_CHAMELEON_RENDER_KIT_INFO = "REQUEST_CHAMELEON_RENDER_KIT_INFO";
+ public static final String GET_DEFAULT_RENDER_KIT_ERROR = "GET_DEFAULT_RENDER_KIT_ERROR";
+ public static final String DEFAULT_RENDER_KIT_INFO = "DEFAULT_RENDER_KIT_INFO";
+ public static final String AJAX_RESPONSE_NOT_RENDERED_INFO = "AJAX_RESPONSE_NOT_RENDERED_INFO";
+ public static final String ENTER_BEFORE_RENDER_VIEW_PHASE = "ENTER_BEFORE_RENDER_VIEW_PHASE";
+ public static final String SET_RENDER_KIT_ID_INFO = "SET_RENDER_KIT_ID_INFO";
+ public static final String PROCESS_AJAX_EVENTS_INFO = "PROCESS_AJAX_EVENTS_INFO";
+ public static final String DELEGATE_AJAX_PROCESSING_INFO = "DELEGATE_AJAX_PROCESSING_INFO";
+ public static final String BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR = "BREAKPOINTS_UNSUPPORTED_INSIDE_ATTRIBUTE_ERROR";
+ public static final String BUILD_ONCLICK_INFO = "BUILD_ONCLICK_INFO";
+ public static final String UNNAMED_PARAMETER_ERROR = "UNNAMED_PARAMETER_ERROR";
+ public static final String AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING = "AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING";
+ public static final String COMPONENT_NULL_ERROR_2 = "COMPONENT_NULL_ERROR_2";
+ public static final String CALCULATE_COMPONENT_ID_INFO = "CALCULATE_COMPONENT_ID_INFO";
+ public static final String DETECTING_ENCODING_DISABLED_ERROR = "DETECTING_ENCODING_DISABLED_ERROR";
+ public static final String OBTAIN_RESPONSE_SET_HEADER_ERROR = "OBTAIN_RESPONSE_SET_HEADER_ERROR";
+ public static final String INVOKE_AJAX_REGION_LISTENER = "INVOKE_AJAX_REGION_LISTENER";
+ public static final String APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING = "APPENDING_AJAX_REGION_TO_NON_AJAX_CONTAINER_WARNING";
+ public static final String RENDER_CHILDREN_NON_AJAX_INFO = "RENDER_CHILDREN_NON_AJAX_INFO";
+ public static final String RENDER_CHILDREN_AJAX_INFO = "RENDER_CHILDREN_AJAX_INFO";
+ public static final String ENCODE_CHILD_AJAX_INFO = "ENCODE_CHILD_AJAX_INFO";
+ public static final String RENDER_AJAX_AREA_INFO = "RENDER_AJAX_AREA_INFO";
+ public static final String DECODE_AJAX_REQUEST_STATUS_INFO = "DECODE_AJAX_REQUEST_STATUS_INFO";
+ public static final String REQUEST_PARAMETERS_MAP = "REQUEST_PARAMETERS_MAP";
+ public static final String SET_MYFACES_SEQUENCE_INFO = "SET_MYFACES_SEQUENCE_INFO";
+ public static final String SKIP_ENCODING_HTML_INFO = "SKIP_ENCODING_HTML_INFO";
+ public static final String SKIP_ENCODE_BEGIN_HTML_INFO = "SKIP_ENCODE_BEGIN_HTML_INFO";
+ public static final String SKIP_ENCODE_END_HTML_INFO = "SKIP_ENCODE_END_HTML_INFO";
+ public static final String QUERY_STRING_BUILDING_ERROR = "QUERY_STRING_BUILDING_ERROR";
+ public static final String BUILD_RESOURCE_URI_INFO = "BUILD_RESOURCE_URI_INFO";
+ public static final String RESTORE_DATA_FROM_RESOURCE_URI_INFO = "RESTORE_DATA_FROM_RESOURCE_URI_INFO";
+ public static final String STREAM_CORRUPTED_ERROR = "STREAM_CORRUPTED_ERROR";
+ public static final String DESERIALIZE_DATA_INPUT_ERROR = "DESERIALIZE_DATA_INPUT_ERROR";
+ public static final String DATA_CLASS_NOT_FOUND_ERROR = "DATA_CLASS_NOT_FOUND_ERROR";
+ public static final String METHOD_NOT_IMPLEMENTED = "METHOD_NOT_IMPLEMENTED";
+ public static final String ENCODE_HTML_INFO = "ENCODE_HTML_INFO";
+ public static final String ENCODE_HTML_INFO_2 = "ENCODE_HTML_INFO_2";
+ public static final String ENCODE_BEGIN_HTML_INFO = "ENCODE_BEGIN_HTML_INFO";
+ public static final String ENCODE_END_HTML_INFO = "ENCODE_END_HTML_INFO";
+ public static final String SEND_CONTENT_INFO = "SEND_CONTENT_INFO";
+ public static final String NO_INPUT_STREAM_ERROR = "NO_INPUT_STREAM_ERROR";
+ public static final String SET_RESPONSE_HEADERS_INFO = "SET_RESPONSE_HEADERS_INFO";
+ public static final String BUILD_RESOURCE_INFO = "BUILD_RESOURCE_INFO";
+ public static final String NO_RESOURCE_REGISTERED_ERROR = "NO_RESOURCE_REGISTERED_ERROR";
+ public static final String NO_RESOURCE_REGISTERED_ERROR_2 = "NO_RESOURCE_REGISTERED_ERROR_2";
+ public static final String NO_RESOURCE_EXISTS_ERROR = "NO_RESOURCE_EXISTS_ERROR";
+ public static final String INSTANTIATE_RESOURCE_ERROR = "INSTANTIATE_RESOURCE_ERROR";
+ public static final String INSTANTIATE_CLASS_ERROR = "INSTANTIATE_CLASS_ERROR";
+ public static final String STATIC_RESOURCE_NOT_FOUND_ERROR = "STATIC_RESOURCE_NOT_FOUND_ERROR";
+ public static final String PARSING_IF_MODIFIED_SINCE_WARNING = "PARSING_IF_MODIFIED_SINCE_WARNING";
+ public static final String GET_CONTENT_FROM_CACHE_INFO = "GET_CONTENT_FROM_CACHE_INFO";
+ public static final String CONTENT_NOT_FOUND_ERROR = "CONTENT_NOT_FOUND_ERROR";
+ public static final String SEND_RESOURCE_ERROR = "SEND_RESOURCE_ERROR";
+ public static final String SEND_RESOURCE_ERROR_2 = "SEND_RESOURCE_ERROR_2";
+ public static final String READING_PROPERTIES_ERROR = "READING_PROPERTIES_ERROR";
+ public static final String SEND_IMAGE_ERROR = "SEND_IMAGE_ERROR";
+ public static final String SEND_IMAGE_ERROR_2 = "SEND_IMAGE_ERROR_2";
+ public static final String SKIP_ENCODE_BEGIN_HTML_INFO_2 = "SKIP_ENCODE_BEGIN_HTML_INFO_2";
+ public static final String MARK_AS_RENDERED_INFO = "MARK_AS_RENDERED_INFO";
+ public static final String SKIP_ENCODE_END_HTML_INFO_2 = "SKIP_ENCODE_END_HTML_INFO_2";
+ public static final String VARIABLE_SUBSTITUTION_ERROR = "VARIABLE_SUBSTITUTION_ERROR";
+ public static final String SET_SKIN_FACTORY_INFO = "SET_SKIN_FACTORY_INFO";
+ public static final String CREATING_SKIN_FACTORY_ERROR = "CREATING_SKIN_FACTORY_ERROR";
+ public static final String NULL_SKIN_NAME_ERROR = "NULL_SKIN_NAME_ERROR";
+ public static final String CREATE_SKIN_INFO = "CREATE_SKIN_INFO";
+ public static final String DEFAULT_PROPERTIES_NOT_FOUND_ERROR = "DEFAULT_PROPERTIES_NOT_FOUND_ERROR";
+ public static final String SKIN_PROPERTIES_IO_ERROR = "SKIN_PROPERTIES_IO_ERROR";
+ public static final String SKIN_NOT_FOUND_ERROR = "SKIN_NOT_FOUND_ERROR";
+ public static final String ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR = "ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR";
+ public static final String ACESSING_SKIN_PROPERTY_ERROR = "ACESSING_SKIN_PROPERTY_ERROR";
+ public static final String SKIN_PROPERTIES_READ_ONLY_ERROR = "SKIN_PROPERTIES_READ_ONLY_ERROR";
+ public static final String NO_DATA_ADAPTOR = "NO_DATA_ADAPTOR";
+ public static final String NO_VALUE_HOLDER_ERROR = "NO_VALUE_HOLDER_ERROR";
+ public static final String NO_EDITABLE_VALUE_HOLDER_ERROR = "NO_EDITABLE_VALUE_HOLDER_ERROR";
+ public static final String INVALID_VALIDATION_EXPRESSION = "INVALID_VALIDATION_EXPRESSION";
+ public static final String NO_ACTION_SOURCE_ERROR = "NO_ACTION_SOURCE_ERROR";
+ public static final String NO_ACTION_SOURCE2_ERROR = "NO_ACTION_SOURCE2_ERROR";
+ public static final String INVALID_ACTION_LISTENER = "INVALID_ACTION_LISTENER";
+ public static final String INVALID_VALUE_CHANGE_LISTENER = "INVALID_VALUE_CHANGE_LISTENER";
+ public static final String NO_VALUE_REFERENCE_ERROR = "NO_VALUE_REFERENCE_ERROR";
+ public static final String NO_BYTE_ARRAY_ERROR = "NO_BYTE_ARRAY_ERROR";
+ public static final String BUFFER_TYPE_ERROR = "BUFFER_TYPE_ERROR";
+ public static final String IMAGE_ERROR = "IMAGE_ERROR";
+ public static final String CANNOT_WRITE_RASTERS = "CANNOT_WRITE_RASTERS";
+ public static final String NULL_OUTPUT_ERROR = "NULL_OUTPUT_ERROR";
+ public static final String IMAGE_NOT_BUFFERED_ERROR = "IMAGE_NOT_BUFFERED_ERROR";
+ public static final String NOT_DATA_OUTPUT_ERROR = "NOT_DATA_OUTPUT_ERROR";
+ public static final String NULL_COLOR_PARAMETER_ERROR = "NULL_COLOR_PARAMETER_ERROR";
+ public static final String DECODE_COLOR_PARAMETER_ERROR = "DECODE_COLOR_PARAMETER_ERROR";
+ public static final String NULL_COLOR_PARAMETER_ERROR_2 = "NULL_COLOR_PARAMETER_ERROR_2";
+ public static final String DECODE_PARAMETER_ERROR = "DECODE_PARAMETER_ERROR";
+ public static final String IMAGE_GENERATOR_CLASS_NOT_FOUND = "IMAGE_GENERATOR_CLASS_NOT_FOUND";
+ public static final String CREATING_IMAGE_GENERATOR_ERROR = "CREATING_IMAGE_GENERATOR_ERROR";
+ public static final String INVALID_COMMENT_INDEX = "INVALID_COMMENT_INDEX";
+ public static final String LOADING_IMAGE_ERROR = "LOADING_IMAGE_ERROR";
+ public static final String NOT_INDEXED_IMAGE_ERROR = "NOT_INDEXED_IMAGE_ERROR";
+ public static final String INVALID_RADIUS = "INVALID_RADIUS";
+ public static final String INVALID_ATTRIBUTE_VALUE = "INVALID_ATTRIBUTE_VALUE";
+ public static final String VALUE_BINDING_TYPE_ERROR = "VALUE_BINDING_TYPE_ERROR";
+ public static final String NO_CONVERTER_FOUND_ERROR = "NO_CONVERTER_FOUND_ERROR";
+ public static final String GRABBER_ERROR = "GRABBER_ERROR";
+ public static final String TOOMANY_COLORS_ERROR = "TOOMANY_COLORS_ERROR";
+ public static final String GET_RESOURCE_AS_STREAM_ERROR = "GET_RESOURCE_AS_STREAM_ERROR";
+ public static final String PARSING_WEB_XML_IO_ERROR = "PARSING_WEB_XML_IO_ERROR";
+ public static final String PARSING_WEB_XML_SAX_ERROR = "PARSING_WEB_XML_SAX_ERROR";
+ public static final String NULL_FILTER_NAME_WARNING = "NULL_FILTER_NAME_WARNING";
+ public static final String FILTER_NOT_FOUND_ERROR = "FILTER_NOT_FOUND_ERROR";
+ public static final String FILTER_NOT_CONFIGURED_ERROR = "FILTER_NOT_CONFIGURED_ERROR";
+ public static final String NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR = "NO_PREFIX_OR_SUFFIX_IN_FILTER_MAPPING_ERROR";
+ public static final String CONFIG_INITIALIZATION_ERROR = "CONFIG_INITIALIZATION_ERROR";
+ public static final String FIELD_READING_ERROR = "FIELD_READING_ERROR";
+ public static final String CONFIG_INITIALIZATION_ERROR_2 = "CONFIG_INITIALIZATION_ERROR_2";
+ public static final String DOM_METHOD_NOT_SUPPORTED = "DOM_METHOD_NOT_SUPPORTED";
+ public static final String METHOD_NOT_SUPPORTED = "METHOD_NOT_SUPPORTED";
+ public static final String NAMED_ITEM_NOT_FOUND_ERROR = "NAMED_ITEM_NOT_FOUND_ERROR";
+ public static final String AJAX_SUPPORT_REQUEST_PARAMETER_INFO = "AJAX_SUPPORT_REQUEST_PARAMETER_INFO";
+ public static final String COMMAND_LINK_SUBMIT_INFO = "COMMAND_LINK_SUBMIT_INFO";
+ public static final String COMMAND_LINK_NOT_IN_FORM_WARNING = "COMMAND_LINK_NOT_IN_FORM_WARNING";
+ public static final String MUST_BE_EXPRESSION_ERROR = "MUST_BE_EXPRESSION_ERROR";
+ public static final String NOT_PARENT_AJAX_CONTAINER_ERROR = "NOT_PARENT_AJAX_CONTAINER_ERROR";
+ public static final String MUST_BE_LITERAL_ERROR = "MUST_BE_LITERAL_ERROR";
+ public static final String FACET_TAG_MANY_CHILDREN_ERROR = "FACET_TAG_MANY_CHILDREN_ERROR";
+ public static final String NO_UI_COMPONENT_TAG_ANCESTOR_ERROR = "NO_UI_COMPONENT_TAG_ANCESTOR_ERROR";
+ public static final String NO_VALUE_REFERENCE_ERROR_2 = "NO_VALUE_REFERENCE_ERROR_2";
+ public static final String NULL_TYPE_ATTRIBUTE_ERROR = "NULL_TYPE_ATTRIBUTE_ERROR";
+ public static final String NULL_ATTRIBUTE_ERROR = "NULL_ATTRIBUTE_ERROR";
+ public static final String AJAX_VIEW_EXPIRED = "AJAX_VIEW_EXPIRED";
+ public static final String SKIN_CYCLIC_REFERENCE = "SKIN_CYCLIC_REFERENCE";
+ public static final String SKIN_ILLEGAL_REFERENCE = "SKIN_ILLEGAL_REFERENCE";
+ public static final String NAME_MUST_BE_LITERAL = "NAME_MUST_BE_LITERAL";
+ public static final String INSTANTIATE_LISTENER_ERROR = "INSTANTIATE_LISTENER_ERROR";
+ public static final String NOT_AJAX_CONTAINER_ERROR = "NOT_AJAX_CONTAINER_ERROR";
+ public static final String INVALID_EXPRESSION = "INVALID_EXPRESSION";
+ public static final String NOT_INSTANCE_OF_ERROR = "NOT_INSTANCE_OF_ERROR";
+ public static final String UNSUPPORTED_ENCODING_ERROR = "UNSUPPORTED_ENCODING_ERROR";
+ public static final String UNSUPPORTED_INPUT_SOURCE_ERROR = "UNSUPPORTED_INPUT_SOURCE_ERROR";
+ public static final String STRING_CONVERSION_ERROR = "STRING_CONVERSION_ERROR";
+ public static final String UTF_CONVERSION_ERROR = "UTF_CONVERSION_ERROR";
+ public static final String READ_ONLY_NODE_ERROR = "READ_ONLY_NODE_ERROR";
+ public static final String NOT_PARENT_AJAX_COMPONENT_ERROR = "NOT_PARENT_AJAX_COMPONENT_ERROR";
+ public static final String INVALID_VALUE = "INVALID_VALUE";
+ public static final String DATASCROLLER_PAGE_MISSING = "DATASCROLLER_PAGE_MISSING";
+
+ public static void main(String[] args) {
+ String m = getMessage(INVALID_ATTRIBUTE_VALUE, "A", "B");
+ System.out.println(m);
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodBindingToMethodExpression.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodBindingToMethodExpression.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodBindingToMethodExpression.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,344 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.seam.ui.util.cdk;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.MethodNotFoundException;
+import javax.el.PropertyNotFoundException;
+import javax.faces.FacesException;
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+
+/**
+ * Converts a MethodBinding to a MethodExpression
+ *
+ *
+ * @author Stan Silvert
+ * @author Pete Muir
+ */
+ at SuppressWarnings("deprecation")
+public class MethodBindingToMethodExpression extends MethodExpression implements StateHolder
+{
+ private static final Class[] EXPECTED_TYPES = new Class[] { MethodBinding.class, StateHolder.class };
+
+ private MethodBinding methodBinding;
+
+ private boolean _transientFlag;
+
+ private transient MethodInfo methodInfo;
+
+ /**
+ * No-arg constructor used during restoreState
+ */
+ protected MethodBindingToMethodExpression()
+ {
+ }
+
+ /** Creates a new instance of MethodBindingToMethodExpression */
+ public MethodBindingToMethodExpression(MethodBinding methodBinding)
+ {
+ checkNullArgument(methodBinding, "methodBinding");
+ this.methodBinding = methodBinding;
+ }
+
+ /**
+ * Return the wrapped MethodBinding.
+ */
+ public MethodBinding getMethodBinding()
+ {
+ return methodBinding;
+ }
+
+ void setMethodBinding(MethodBinding methodBinding)
+ {
+ this.methodBinding = methodBinding;
+ }
+
+ /**
+ * Note: MethodInfo.getParamTypes() may incorrectly return an empty class array if invoke() has not been called.
+ *
+ * @throws IllegalStateException
+ * if expected params types have not been determined.
+ */
+ @Override
+ public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException,
+ ELException
+ {
+ checkNullArgument(context, "elcontext");
+ checkNullState(methodBinding, "methodBinding");
+
+ if (methodInfo == null)
+ {
+ final FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+ if (facesContext != null)
+ {
+ methodInfo = invoke(new Invoker<MethodInfo>()
+ {
+ public MethodInfo invoke()
+ {
+ return new MethodInfo(null, methodBinding.getType(facesContext), null);
+ }
+ });
+ }
+ }
+ return methodInfo;
+ }
+
+ @Override
+ public Object invoke(ELContext context, final Object[] params) throws PropertyNotFoundException,
+ MethodNotFoundException, ELException
+ {
+ checkNullArgument(context, "elcontext");
+ checkNullState(methodBinding, "methodBinding");
+ final FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+ if (facesContext != null)
+ {
+ return invoke(new Invoker<Object>()
+ {
+ public Object invoke()
+ {
+ return methodBinding.invoke(facesContext, params);
+ }
+ });
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isLiteralText()
+ {
+ if (methodBinding == null)
+ throw new IllegalStateException("methodBinding is null");
+ String expr = methodBinding.getExpressionString();
+ return !(expr.startsWith("#{") && expr.endsWith("}"));
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return methodBinding.getExpressionString();
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ if (!isTransient())
+ {
+ if (methodBinding instanceof StateHolder)
+ {
+ Object[] state = new Object[2];
+ state[0] = methodBinding.getClass().getName();
+ state[1] = ((StateHolder) methodBinding).saveState(context);
+ return state;
+ }
+ else
+ {
+ return methodBinding;
+ }
+ }
+ return null;
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ if (state instanceof MethodBinding)
+ {
+ methodBinding = (MethodBinding) state;
+ methodInfo = null;
+ }
+ else if (state != null)
+ {
+ Object[] values = (Object[]) state;
+ methodBinding = (MethodBinding) newInstance(values[0].toString(), EXPECTED_TYPES);
+ ((StateHolder) methodBinding).restoreState(context, values[1]);
+ methodInfo = null;
+ }
+ }
+
+ public void setTransient(boolean transientFlag)
+ {
+ _transientFlag = transientFlag;
+ }
+
+ public boolean isTransient()
+ {
+ return _transientFlag;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((methodBinding == null) ? 0 : methodBinding.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MethodBindingToMethodExpression other = (MethodBindingToMethodExpression) obj;
+ if (methodBinding == null)
+ {
+ if (other.methodBinding != null)
+ return false;
+ }
+ else if (!methodBinding.equals(other.methodBinding))
+ return false;
+ return true;
+ }
+
+ private void checkNullState(Object notNullInstance, String instanceName)
+ {
+ if (notNullInstance == null)
+ throw new IllegalStateException(instanceName + " is null");
+ }
+
+ private void checkNullArgument(Object notNullInstance, String instanceName)
+ {
+ if (notNullInstance == null)
+ throw new IllegalArgumentException(instanceName + " is null");
+ }
+
+ private <T> T invoke(Invoker<T> invoker)
+ {
+ try
+ {
+ return invoker.invoke();
+ }
+ catch (javax.faces.el.MethodNotFoundException e)
+ {
+ throw new MethodNotFoundException(e.getMessage(), e);
+ }
+ catch (EvaluationException e)
+ {
+ throw new ELException(e.getMessage(), e);
+ }
+ }
+
+ private interface Invoker<T>
+ {
+ T invoke();
+ }
+
+ private static Object newInstance(String type, Class[] expectedTypes)
+ {
+ if (type == null)
+ return null;
+
+ Class clazzForName = simpleClassForName(type);
+
+ if(expectedTypes != null)
+ {
+ for (int i = 0, size = expectedTypes.length; i < size; i++)
+ {
+ if (!expectedTypes[i].isAssignableFrom(clazzForName))
+ {
+ throw new FacesException("'" + type + "' does not implement expected type '" + expectedTypes[i]
+ + "'");
+ }
+ }
+ }
+
+ return newInstance(clazzForName);
+ }
+
+ private static Object newInstance(Class clazz)
+ throws FacesException
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch(NoClassDefFoundError e)
+ {
+ throw new FacesException(e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new FacesException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new FacesException(e);
+ }
+ }
+
+ /**
+ * Tries a Class.loadClass with the context class loader of the current thread first and
+ * automatically falls back to the ClassUtils class loader (i.e. the loader of the
+ * myfaces.jar lib) if necessary.
+ *
+ * @param type fully qualified name of a non-primitive non-array class
+ * @return the corresponding Class
+ * @throws NullPointerException if type is null
+ * @throws ClassNotFoundException
+ */
+ private static Class classForName(String type)
+ throws ClassNotFoundException
+ {
+ if (type == null) throw new NullPointerException("type");
+ try
+ {
+ // Try WebApp ClassLoader first
+ return Class.forName(type,
+ false, // do not initialize for faster startup
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
+ return Class.forName(type,
+ false, // do not initialize for faster startup
+ MethodBindingToMethodExpression.class.getClassLoader());
+ }
+ }
+
+
+ /**
+ * Same as {@link #classForName(String)}, but throws a RuntimeException
+ * (FacesException) instead of a ClassNotFoundException.
+ *
+ * @return the corresponding Class
+ * @throws NullPointerException if type is null
+ * @throws FacesException if class not found
+ */
+ private static Class simpleClassForName(String type)
+ {
+ try
+ {
+ return classForName(type);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new FacesException(e);
+ }
+ }
+
+
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodExpressionToMethodBinding.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodExpressionToMethodBinding.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/MethodExpressionToMethodBinding.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.seam.ui.util.cdk;
+
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
+
+/**
+ * Converts a MethodExpression to a MethodBinding.
+ * See JSF 1.2 spec section 5.8.4
+ *
+ * @author Stan Silvert
+ * @author Pete Muir
+ */
+ at Deprecated
+public class MethodExpressionToMethodBinding extends MethodBinding implements StateHolder {
+
+ private MethodExpression methodExpression;
+
+ private boolean isTransient = false;
+
+ public MethodExpressionToMethodBinding() {
+ methodExpression = null;
+ }
+
+ /** Creates a new instance of MethodExpressionToMethodBinding */
+ public MethodExpressionToMethodBinding(MethodExpression methodExpression) {
+ this.methodExpression = methodExpression;
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return methodExpression.getExpressionString();
+ }
+
+ @Override
+ public Class getType(FacesContext facesContext)
+ throws MethodNotFoundException {
+
+ try {
+ return methodExpression.getMethodInfo(facesContext.getELContext()).getReturnType();
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new javax.faces.el.MethodNotFoundException(e);
+ } catch (ELException e) {
+ throw new EvaluationException(e);
+ }
+ }
+
+ @Override
+ public Object invoke(FacesContext facesContext, Object[] params)
+ throws EvaluationException, MethodNotFoundException {
+
+ try {
+ return methodExpression.invoke(facesContext.getELContext(), params);
+ } catch (javax.el.MethodNotFoundException e) {
+ throw new javax.faces.el.MethodNotFoundException(e);
+ } catch (ELException e) {
+ throw new EvaluationException(e);
+ }
+ }
+
+// -------- StateHolder methods -------------------------------------------
+
+ public void restoreState(FacesContext context, Object state) {
+ if(state != null)
+ methodExpression = (MethodExpression)state;
+ }
+
+ public Object saveState(FacesContext context) {
+ if(!isTransient)
+ return methodExpression;
+ return null;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,198 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.util.cdk;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.Renderer;
+
+
+/**
+ * Mangled version of Ajax4Jsf's RendererBase without supporting classes
+ *
+ * Base Renderer for all chameleon Skin's and components.
+ * At most, make all common procedures and realise concrete work in "template" methods.
+ * @author asmirnov at exadel.com (latest modification by $Author: gavin $)
+ * @version $Revision: 5308 $ $Date: 2007-06-20 04:46:17 +0200 (St, 20 VI 2007) $
+ *
+ */
+public abstract class RendererBase extends Renderer {
+
+ /**
+ * logger for common cases.
+ */
+ protected static final String JAVASCRIPT_NAMESPACE = "JBossSeam";
+ private static final RendererUtils utils = new RendererUtils();
+
+ @Override
+ public void decode(FacesContext context, UIComponent component) {
+ // Test for correct parameters.
+ if (context == null) throw new NullPointerException("Context must not be null");
+ if (component == null) throw new NullPointerException("Component must not be null");
+ if (! getComponentClass().isInstance(component)) throw new IllegalArgumentException("Component must be of type " + getComponentClass().getName());
+ preDecode(context,component);
+ // TODO - create set od common decoders ( UIInput, ActionSource etc. ) for process decoding.
+ if (component.isRendered()) {
+ doDecode(context, component);
+ }
+ }
+
+ protected void preDecode(FacesContext context, UIComponent component) {
+ }
+
+ protected void preEncodeBegin(FacesContext context, UIComponent component) throws IOException {
+
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
+ // Test for correct parameters.
+ if (context == null) throw new NullPointerException("Context must not be null");
+ if (component == null) throw new NullPointerException("Component must not be null");
+ if (! getComponentClass().isInstance(component)) throw new IllegalArgumentException("Component must be of type " + getComponentClass().getName());
+ preEncodeBegin(context,component);
+ if (component.isRendered()) {
+ ResponseWriter writer = context.getResponseWriter();
+ doEncodeBegin(writer, context, component);
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ // Test for correct parameters.
+ if (context == null) throw new NullPointerException("Context must not be null");
+ if (component == null) throw new NullPointerException("Component must not be null");
+ if (! getComponentClass().isInstance(component)) throw new IllegalArgumentException("Component must be of type " + getComponentClass().getName());
+ preEncodeBegin(context,component);
+ if (component.isRendered()) {
+ ResponseWriter writer = context.getResponseWriter();
+ doEncodeChildren(writer, context, component);
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ // Test for correct parameters.
+ if (context == null) throw new NullPointerException("Context must not be null");
+ if (component == null) throw new NullPointerException("Component must not be null");
+ if (! getComponentClass().isInstance(component)) throw new IllegalArgumentException("Component must be of type " + getComponentClass().getName());
+ if (component.isRendered()) {
+ ResponseWriter writer = context.getResponseWriter();
+ doEncodeEnd(writer, context, component);
+ }
+ }
+
+ /**
+ * Get base component slass , targetted for this renderer. Used for check arguments in decode/encode.
+ */
+ protected abstract Class getComponentClass();
+
+
+ /**
+ * Template method for custom decoding of concrete renderer.
+ * All parameters checking if performed in original decode() method.
+ * @param context
+ * @param component
+ */
+ protected void doDecode(FacesContext context, UIComponent component) {
+
+ }
+
+ /**
+ * Template method for custom start encoding of concrete renderer.
+ * All parameters checking and writer is performed in original encodeBegin() method.
+ * @param writer
+ * @param context
+ * @param component
+ */
+ protected void doEncodeBegin(ResponseWriter writer,FacesContext context, UIComponent component) throws IOException {
+
+ }
+ /**
+ * @param writer
+ * @param context
+ * @param component
+ */
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ // Hook method, must be overriden in renderers with special children processing
+ }
+
+ /**
+ * Template method for custom finish encoding of concrete renderer.
+ * All parameters checking and writer is performed in original encodeEnd() method.
+ * @param writer
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+
+ }
+
+ /**
+ * Render all children for given component.
+ * @param facesContext
+ * @param component
+ * @throws IOException
+ */
+ public void renderChildren(FacesContext facesContext,
+ UIComponent component) throws IOException {
+ if (component.getChildCount() > 0) {
+ for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
+ UIComponent child = (UIComponent) it.next();
+ renderChild(facesContext, child);
+ }
+ }
+ }
+
+
+ /**
+ * Render one component and it childrens
+ * @param facesContext
+ * @param child
+ * @throws IOException
+ */
+ public void renderChild(FacesContext facesContext, UIComponent child)
+ throws IOException {
+ if (!child.isRendered()) {
+ return;
+ }
+
+ child.encodeBegin(facesContext);
+ if (child.getRendersChildren()) {
+ child.encodeChildren(facesContext);
+ } else {
+ renderChildren(facesContext, child);
+ }
+ child.encodeEnd(facesContext);
+ }
+
+ public static RendererUtils getUtils()
+ {
+ return utils;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererUtils.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererUtils.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/RendererUtils.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,79 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.jboss.seam.ui.util.cdk;
+
+import static org.jboss.seam.util.Reflections.isInstanceOf;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlCommandButton;
+
+
+public class RendererUtils
+{
+
+ private static final String TRINIDAD_FORM_FAMILY = "org.apache.myfaces.trinidad.Form";
+ private static final String TRINIDAD_COMMANDBUTTON_CLASS = "org.apache.myfaces.trinidad.component.core.nav.CoreCommandButton";
+ private static final String RICHFACES_COMMANDBUTTON_CLASS = "org.ajax4jsf.component.UIAjaxCommandButton";
+
+ /**
+ * Since Trinidad, and possibly other JSF implementations don't always subclass
+ * from {@link javax.faces.component.UIForm} we can't cast to UIForm.
+ */
+ public UIComponent getForm(UIComponent component)
+ {
+ while (component != null)
+ {
+ if (isForm(component))
+ {
+ break;
+ }
+ component = component.getParent();
+ }
+ return component;
+ }
+
+ public boolean isCommandButton(UIComponent cmp)
+ {
+ if ( cmp instanceof HtmlCommandButton || isInstanceOf(cmp.getClass(), TRINIDAD_COMMANDBUTTON_CLASS) || isInstanceOf(cmp.getClass(), RICHFACES_COMMANDBUTTON_CLASS) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public boolean isForm(UIComponent cmp)
+ {
+ if ( cmp instanceof UIForm || TRINIDAD_FORM_FAMILY.equals(cmp.getFamily()) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/SimpleActionMethodBinding.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/SimpleActionMethodBinding.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/SimpleActionMethodBinding.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,98 @@
+package org.jboss.seam.ui.util.cdk;
+
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
+
+/**
+ * Simple method binding for constant action outcome.
+ * @author asmirnov at exadel.com (latest modification by $Author: pmuir $)
+ *
+ */
+ at Deprecated
+public class SimpleActionMethodBinding extends MethodBinding implements StateHolder {
+ // private static final Log log =
+ // LogFactory.getLog(SimpleActionMethodBinding.class);
+
+ private String _outcome;
+
+ public SimpleActionMethodBinding(String outcome) {
+ _outcome = outcome;
+ }
+
+ @Override
+ public Object invoke(FacesContext facescontext, Object aobj[])
+ throws EvaluationException, MethodNotFoundException {
+ return _outcome;
+ }
+
+ @Override
+ public Class getType(FacesContext facescontext)
+ throws MethodNotFoundException {
+ return String.class;
+ }
+
+ // ~ StateHolder support
+ // ----------------------------------------------------------------------------
+
+ private boolean _transient = false;
+
+ /**
+ * Empty constructor, so that new instances can be created when restoring
+ * state.
+ */
+ public SimpleActionMethodBinding() {
+ _outcome = null;
+ }
+
+ public Object saveState(FacesContext facescontext) {
+ return _outcome;
+ }
+
+ public void restoreState(FacesContext facescontext, Object obj) {
+ _outcome = (String) obj;
+ }
+
+ public boolean isTransient() {
+ return _transient;
+ }
+
+ public void setTransient(boolean flag) {
+ _transient = flag;
+ }
+
+ @Override
+ public String toString() {
+ return _outcome;
+ }
+
+ @Override
+ public String getExpressionString()
+ {
+ return _outcome;
+ }
+}
+
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentELTagBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentELTagBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentELTagBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,87 @@
+package org.jboss.seam.ui.util.cdk;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.ActionSource2;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.MethodExpressionActionListener;
+import javax.faces.event.MethodExpressionValueChangeListener;
+import javax.faces.validator.MethodExpressionValidator;
+import javax.faces.webapp.UIComponentELTag;
+
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class UIComponentELTagBase extends UIComponentELTag {
+
+ private static final LogProvider log = Logging.getLogProvider(UIComponentELTagBase.class);
+
+ protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener) {
+ if (actionListener != null) {
+ if (component instanceof ActionSource2) {
+ ActionSource2 actionSource2 = (ActionSource2) component;
+ actionSource2.addActionListener(new MethodExpressionActionListener(actionListener));
+ } else {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
+ }
+ }
+ }
+
+ protected void setActionProperty(UIComponent component, MethodExpression action) {
+ if (action != null) {
+ if (component instanceof ActionSource2) {
+ ActionSource2 actionSource2 = (ActionSource2) component;
+ actionSource2.setActionExpression(action);
+ } else {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
+ }
+ }
+ }
+
+ protected void setConverterProperty(UIComponent component, ValueExpression converter) {
+ if (converter != null) {
+ if (component instanceof ValueHolder) {
+ ValueHolder output = (ValueHolder) component;
+ if (!converter.isLiteralText()) {
+ component.setValueExpression("converter", converter);
+ } else {
+ Converter conv = FacesContext.getCurrentInstance().getApplication().createConverter(converter.getExpressionString());
+ output.setConverter(conv);
+ }
+ } else {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_HOLDER_ERROR, component.getClass().getName()));
+ }
+ }
+ }
+
+ protected void setValidatorProperty(UIComponent component, MethodExpression validator) {
+
+ if (validator != null) {
+ if (component instanceof EditableValueHolder) {
+ EditableValueHolder input = (EditableValueHolder) component;
+ input.addValidator(new MethodExpressionValidator(validator));
+ } else {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_EDITABLE_VALUE_HOLDER_ERROR, component.getId()));
+ }
+ }
+ }
+
+ protected void setValueChangeListenerProperty(UIComponent component, MethodExpression valueChangeListener) {
+ if (valueChangeListener != null) {
+ if (component instanceof EditableValueHolder) {
+ EditableValueHolder input = (EditableValueHolder) component;
+ input.addValueChangeListener(new MethodExpressionValueChangeListener(valueChangeListener));
+ } else {
+ throw new IllegalArgumentException(Messages.getMessage(Messages.NO_EDITABLE_VALUE_HOLDER_ERROR, component.getId()));
+ }
+ }
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/util/cdk/UIComponentTagBase.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,167 @@
+/**
+ *
+ */
+package org.jboss.seam.ui.util.cdk;
+
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIGraphic;
+import javax.faces.component.UIParameter;
+import javax.faces.component.UISelectBoolean;
+import javax.faces.component.ValueHolder;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class UIComponentTagBase extends UIComponentELTagBase {
+
+ protected ExpressionFactory getExpressionFactory() {
+ return getFacesContext().getApplication().getExpressionFactory();
+ }
+
+ protected void setProperty(UIComponent component, String propName, ValueExpression valueExpression) {
+ if (valueExpression != null) {
+ if (valueExpression.isLiteralText()) {
+ component.getAttributes().put(propName,valueExpression.getValue(getELContext()));
+ } else {
+ component.setValueExpression(propName, valueExpression);
+ }
+ }
+ }
+
+ protected void setProperty(UIComponent component, Class<?> type,
+ String propName, String value) {
+ if (value != null) {
+ ValueExpression valueExpression = getExpressionFactory()
+ .createValueExpression(getELContext(), value, type);
+ setProperty(component, propName, valueExpression);
+ }
+ }
+
+ protected void setIntegerProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setLongProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setFloatProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setDoubleProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setStringProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setBooleanProperty(UIComponent component, String propName,
+ ValueExpression value) {
+ setProperty(component, propName, value);
+ }
+
+ protected void setIntegerProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, Integer.class, propName, value);
+ }
+
+ protected void setLongProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, Long.class, propName, value);
+ }
+
+ protected void setFloatProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, Float.class, propName, value);
+ }
+
+ protected void setDoubleProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, Double.class, propName, value);
+ }
+
+ protected void setStringProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, String.class, propName, value);
+ }
+
+ protected void setBooleanProperty(UIComponent component, String propName,
+ String value) {
+ setProperty(component, Boolean.class, propName, value);
+ }
+ protected void setValueProperty(UIComponent component, String value) {
+ if (value != null) {
+ ValueExpression expression = getExpressionFactory()
+ .createValueExpression(getELContext(), value, Object.class);
+
+ setValueProperty(component, expression);
+ }
+ }
+ protected void setValueProperty(UIComponent component, ValueExpression expression) {
+ if (expression != null) {
+ String value = expression.getExpressionString();
+ if (!expression.isLiteralText()) {
+ component.setValueExpression("value", expression);
+ } else if (component instanceof UICommand) {
+ ((UICommand) component).setValue(value);
+ } else if (component instanceof UIParameter) {
+ ((UIParameter) component).setValue(value);
+ } else if (component instanceof UISelectBoolean) {
+ ((UISelectBoolean) component).setValue(Boolean.valueOf(value));
+ } else if (component instanceof UIGraphic) {
+ ((UIGraphic) component).setValue(value);
+ }
+ // Since many input components are ValueHolders the special
+ // components
+ // must come first, ValueHolder is the last resort.
+ else if (component instanceof ValueHolder) {
+ ((ValueHolder) component).setValue(value);
+ } else {
+ component.getAttributes().put("value", value);
+ }
+ }
+ }
+
+ public boolean isValueReference(String s) {
+ return !getExpressionFactory().createValueExpression(s, Object.class).isLiteralText();
+ }
+
+ protected void setActionProperty(UIComponent component, String action) {
+ if (action != null) {
+ MethodExpression expression =
+ getExpressionFactory().createMethodExpression(getELContext(), action, String.class, new Class[] {});
+ setActionProperty(component, expression);
+ }
+ }
+
+ protected void setActionListenerProperty(UIComponent component, String actionListener){
+ if (actionListener != null) {
+ MethodExpression expression =
+ getExpressionFactory().createMethodExpression(getELContext(), actionListener, String.class, new Class[] {ActionEvent.class});
+ setActionListenerProperty(component, expression);
+ }
+ }
+
+ protected void setValueChangedListenerProperty(UIComponent component, String valueChangedListener) {
+ if (valueChangedListener != null) {
+ MethodExpression expression =
+ getExpressionFactory().createMethodExpression(getELContext(), valueChangedListener, String.class, new Class[] {ValueChangeEvent.class});
+ setValueChangeListenerProperty(component, expression);
+ }
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/EqualityValidator.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/EqualityValidator.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/EqualityValidator.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,444 @@
+package org.jboss.seam.ui.validator;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.ui.component.UIDecorate;
+
+/**
+ * Validate two fields are equal
+ *
+ * @author pmuir
+ * @author Daniel Roth
+ *
+ */
+public class EqualityValidator implements Validator, StateHolder
+{
+
+ private static LogProvider log = Logging.getLogProvider(EqualityValidator.class);
+
+ public static final String MESSAGE_ID = "org.jboss.seam.ui.validator.NOT_EQUAL";
+
+ public static final String VALIDATOR_ID = "org.jboss.seam.ui.validator.Equality";
+
+ private enum ValidOperation
+ {
+ EQUAL, NOT_EQUAL, GREATER, GREATER_OR_EQUAL, LESS, LESS_OR_EQUAL;
+ }
+
+ private String forId;
+ private String message;
+ private String messageId;
+ private ValidOperation operator = ValidOperation.EQUAL; // Default
+
+ public EqualityValidator()
+ {
+ this.message = "Value does not equal that in '#0'";
+ this.messageId = MESSAGE_ID;
+ }
+
+ public EqualityValidator(String forId)
+ {
+ this();
+ setFor(forId);
+ }
+
+ public EqualityValidator(String forId, String message, String messageId, String operator)
+ {
+ this(forId);
+ if (message != null)
+ {
+ setMessage(message);
+ }
+ if (messageId != null)
+ {
+ setMessageId(messageId);
+ }
+ if (operator != null && !"".equals(operator))
+ {
+ if (ValidOperation.valueOf(operator.toUpperCase()) != null)
+ setOperator(ValidOperation.valueOf(operator.toUpperCase()));
+ else
+ throw new IllegalStateException("Illegal operator. " + "Supported are: " + validOperatorsAsString());
+ }
+
+ }
+
+ private String validOperatorsAsString()
+ {
+ StringBuffer buff = new StringBuffer();
+ for (ValidOperation op : ValidOperation.values())
+ {
+ buff.append(op.name()).append(" ");
+ }
+ return buff.toString();
+ }
+
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
+ {
+ if (getFor() == null)
+ {
+ throw new FacesException("Must specify a component to validate equality against");
+ }
+ UIComponent otherComponent = findOtherComponent(component);
+
+ Object other = new OtherComponent(context, otherComponent).getValue();
+ if (value == null && other == null)
+ {
+ // Thats fine
+ }
+ else if (value != null)
+ {
+ switch (operator)
+ {
+ case EQUAL:
+ if (!value.equals(other))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ case NOT_EQUAL:
+ if (value.equals(other))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ case GREATER:
+ if (!(compare(value, other) > 0))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ case GREATER_OR_EQUAL:
+ if (!(compare(value, other) >= 0))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ case LESS:
+ if (!(compare(value, other) < 0))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ case LESS_OR_EQUAL:
+ if (!(compare(value, other) <= 0))
+ {
+ throwValidationException(value, otherComponent, other);
+ }
+ break;
+ }
+ }
+ }
+
+ private UIComponent findOtherComponent(UIComponent component)
+ {
+ UIComponent otherComponent = component.findComponent(getFor());
+
+ /**
+ * If s:decorate is used, otherComponent will be null We have to look it
+ * up ourselves
+ */
+ if (otherComponent == null)
+ {
+ UIComponent decorateParent = null;
+ UIComponent parent = component.getParent();
+ while (decorateParent == null && parent != null)
+ {
+ if (parent instanceof NamingContainer && !(parent instanceof UIDecorate))
+ {
+ decorateParent = parent;
+ }
+ parent = parent.getParent();
+ }
+ if (decorateParent != null)
+ otherComponent = findChildComponent(decorateParent);
+
+ }
+ return otherComponent;
+ }
+
+ private UIComponent findChildComponent(UIComponent parent)
+ {
+ UIComponent ret = null;
+ for (UIComponent child : parent.getChildren())
+ {
+ if (child.getId().equals(getFor()))
+ ret = child;
+ else
+ ret = findChildComponent(child);
+ if (ret != null)
+ break;
+ }
+ return ret;
+
+ }
+
+ private int compare(Object value, Object other) throws IllegalArgumentException
+ {
+ try
+ {
+ Comparable c1 = (Comparable) value;
+ return c1.compareTo(other);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Values are not comparable", e);
+ }
+
+ }
+
+ private void throwValidationException(Object value, UIComponent otherComponent, Object other)
+ {
+ throw new ValidatorException(FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, getMessageId(), getMessage(), otherComponent.getId(), value, other));
+ }
+
+ public String getFor()
+ {
+ return forId;
+ }
+
+ public void setFor(String forId)
+ {
+ this.forId = forId;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getMessageId()
+ {
+ return messageId;
+ }
+
+ public void setMessageId(String messageId)
+ {
+ this.messageId = messageId;
+ }
+
+ public boolean isTransient()
+ {
+ return false;
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object[] fields = (Object[]) state;
+ forId = (String) fields[0];
+ message = (String) fields[1];
+ messageId = (String) fields[2];
+ operator = ValidOperation.valueOf((String) fields[3]);
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ Object[] state = new Object[4];
+ state[0] = forId;
+ state[1] = message;
+ state[2] = messageId;
+ state[3] = operator.toString();
+ return state;
+ }
+
+ public void setTransient(boolean newTransientValue)
+ {
+ // No-op
+ }
+
+ /**
+ * Simple data structure to hold info on the "other" component
+ *
+ * @author pmuir
+ *
+ */
+ private class OtherComponent
+ {
+
+ private FacesContext context;
+ private UIComponent component;
+ private EditableValueHolder editableValueHolder;
+
+ private Renderer renderer;
+ private Converter converter;
+
+ public OtherComponent(FacesContext facesContext, UIComponent component)
+ {
+ this.component = component;
+ this.context = facesContext;
+ if (!(component instanceof EditableValueHolder))
+ {
+ throw new IllegalStateException("forId must reference an EditableValueHolder (\"input\") component");
+ }
+ editableValueHolder = (EditableValueHolder) component;
+ initRenderer();
+ initConverter();
+ }
+
+ private void initRenderer()
+ {
+ if (renderer == null)
+ {
+ String rendererType = component.getRendererType();
+ if (rendererType != null)
+ {
+ renderer = context.getRenderKit().getRenderer(component.getFamily(), rendererType);
+ if (null == renderer)
+ {
+ log.trace("Can't get Renderer for type " + rendererType);
+ }
+ }
+ else
+ {
+ if (log.isTraceEnabled())
+ {
+ String id = component.getId();
+ id = (null != id) ? id : component.getClass().getName();
+ log.trace("No renderer-type for component " + id);
+ }
+ }
+ }
+ }
+
+ private void initConverter()
+ {
+ converter = editableValueHolder.getConverter();
+ if (converter != null)
+ {
+ return;
+ }
+
+ ValueExpression valueExpression = component.getValueExpression("value");
+ if (valueExpression == null)
+ {
+ return;
+ }
+
+ Class converterType;
+ try
+ {
+ converterType = valueExpression.getType(context.getELContext());
+ }
+ catch (ELException e)
+ {
+ throw new FacesException(e);
+ }
+
+ // if converterType is null, String, or Object, assume
+ // no conversion is needed
+ if (converterType == null || converterType == String.class || converterType == Object.class)
+ {
+ return;
+ }
+
+ // if getType returns a type for which we support a default
+ // conversion, acquire an appropriate converter instance.
+ try
+ {
+ Application application = context.getApplication();
+ converter = application.createConverter(converterType);
+ }
+ catch (Exception e)
+ {
+ throw new FacesException(e);
+ }
+ }
+
+ private Object getConvertedValue(Object newSubmittedValue) throws ConverterException
+ {
+
+ Object newValue;
+
+ if (renderer != null)
+ {
+ newValue = renderer.getConvertedValue(context, component, newSubmittedValue);
+ }
+ else if (newSubmittedValue instanceof String)
+ {
+ // If there's no Renderer, and we've got a String, run it
+ // through
+ // the Converter (if any)
+ if (converter != null)
+ {
+ newValue = converter.getAsObject(context, component, (String) newSubmittedValue);
+ }
+ else
+ {
+ newValue = newSubmittedValue;
+ }
+ }
+ else
+ {
+ newValue = newSubmittedValue;
+ }
+ return newValue;
+ }
+
+ public Object getValue()
+ {
+ /**
+ * If conversion already is done, return value
+ */
+ if (editableValueHolder.isLocalValueSet())
+ {
+ return editableValueHolder.getValue();
+ }
+
+ /**
+ * Convert submittet value
+ */
+ Object submittedValue = editableValueHolder.getLocalValue();
+ if (submittedValue == null)
+ {
+ return null;
+ }
+
+ Object newValue = null;
+
+ try
+ {
+ newValue = getConvertedValue(submittedValue);
+ }
+ catch (ConverterException ce)
+ {
+ // Any errors will be attached by JSF
+ return null;
+ }
+
+ return newValue;
+ }
+
+ }
+
+ public ValidOperation getOperator()
+ {
+ return operator;
+ }
+
+ public void setOperator(ValidOperation operator)
+ {
+ this.operator = operator;
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/FormattedTextValidator.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,216 @@
+package org.jboss.seam.ui.validator;
+
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.StringReader;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+import org.jboss.seam.text.SeamTextLexer;
+import org.jboss.seam.text.SeamTextParser;
+
+import antlr.*;
+
+/**
+ * Formatted Text validator
+ *
+ * Use as a JSF validator on an input control that allows entering Seam Text
+ * markup.
+ * <p>
+ * The Seam Text parser has a disabled default error handler, catch exceptions
+ * as appropriate if you display Seam Text (see <a
+ * href="http://www.doc.ic.ac.uk/lab/secondyear/Antlr/err.html">http://www.doc.ic.ac.uk/lab/secondyear/Antlr/err.html</a>)
+ * and call the static convenience method
+ * <tt>FormattedTextValidator.getErrorMessage(originalText, recognitionException)</tt>
+ * if you want to display or log a nice error message.
+ * </p>
+ * <p>
+ * Uses an instance of <tt>SeamTextParser</tt> by default, override if you require
+ * validation with your customized instance of <tt>SeamTextParser</tt>.
+ * </p>
+ *
+ * @author matthew.drees
+ * @author Christian Bauer
+ */
+public class FormattedTextValidator implements javax.faces.validator.Validator, Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private static final int NUMBER_OF_CONTEXT_CHARS_AFTER = 10;
+ private static final int NUMBER_OF_CONTEXT_CHARS_BEFORE = 10;
+ private static final String END_OF_TEXT = "END OF TEXT";
+ String firstError;
+ String firstErrorDetail;
+
+ /**
+ * Validate the given value as well-formed Seam Text. If there are parse
+ * errors, throw a ValidatorException including the first parse error.
+ */
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ firstError = null;
+ firstErrorDetail = null;
+ if (value == null) {
+ return;
+ }
+
+ if (!(value instanceof String)) {
+ throw new IllegalArgumentException("Value is not a string: "
+ + value);
+ }
+ String text = (String) value;
+ SeamTextParser parser = getSeamTextParser(text);
+ try {
+ parser.startRule();
+ }
+ // Error handling for ANTLR lexer/parser errors, see
+ // http://www.doc.ic.ac.uk/lab/secondyear/Antlr/err.html
+ catch (TokenStreamException tse) {
+ // Problem with the token input stream
+ throw new RuntimeException(tse);
+ } catch (RecognitionException re) {
+ // A parser error
+ if (firstError == null) {
+ firstError = getParserErrorMessage(text, re);
+ firstErrorDetail = re.getMessage().replace("\uFFFF",END_OF_TEXT);
+ }
+ }
+
+ if (firstError != null) {
+ throw new ValidatorException(new FacesMessage(firstError, firstErrorDetail));
+ }
+ }
+
+ /**
+ * Override to instantiate a custom <tt>SeamTextLexer</tt> and <tt>SeamTextParser</tt>.
+ *
+ * @param text the raw markup text
+ * @return an instance of <tt>SeamTextParser</tt>
+ */
+ public SeamTextParser getSeamTextParser(String text) {
+ Reader r = new StringReader(text);
+ SeamTextLexer lexer = new SeamTextLexer(r);
+ return new SeamTextParser(lexer);
+ }
+
+ public String getParserErrorMessage(String originalText, RecognitionException re) {
+ String parserErrorMsg;
+ if (NoViableAltException.class.isAssignableFrom(re.getClass())) {
+ parserErrorMsg = getNoViableAltErrorMessage(
+ re.getMessage(),
+ getErrorLocation(originalText, re, getNumberOfCharsBeforeErrorLocation(), getNumberOfCharsAfterErrorLocation())
+ );
+ } else if (MismatchedTokenException.class.isAssignableFrom(re.getClass())) {
+ parserErrorMsg = getMismatchedTokenErrorMessage(
+ re.getMessage(),
+ getErrorLocation(originalText, re, getNumberOfCharsBeforeErrorLocation(), getNumberOfCharsAfterErrorLocation())
+ );
+ } else if (SemanticException.class.isAssignableFrom(re.getClass())) {
+ parserErrorMsg = getSemanticErrorMessage(re.getMessage());
+ } else {
+ parserErrorMsg = re.getMessage();
+ }
+ return parserErrorMsg;
+ }
+
+ public int getNumberOfCharsBeforeErrorLocation() {
+ return NUMBER_OF_CONTEXT_CHARS_BEFORE;
+ }
+
+ public int getNumberOfCharsAfterErrorLocation() {
+ return NUMBER_OF_CONTEXT_CHARS_AFTER;
+ }
+
+ /**
+ * Override (e.g. for i18n) ANTLR parser error messages.
+ *
+ * @param originalMessage the ANTLR parser error message of the RecognitionException
+ * @param location a snippet that indicates the location in the original markup, might be null
+ * @return a message that is thrown by this validator
+ */
+ public String getNoViableAltErrorMessage(String originalMessage, String location) {
+ return location != null
+ ? "Text parsing error at '..." + location.trim() + "...'"
+ : "Text parsing error, " + originalMessage.replace("\uFFFF",END_OF_TEXT);
+ }
+
+ /**
+ * Override (e.g. for i18n) ANTLR parser error messages.
+ *
+ * @param originalMessage the ANTLR parser error message of the RecognitionException
+ * @param location a snippet that indicates the location in the original markup, might be null
+ * @return a message that is thrown by this validator
+ */
+ public String getMismatchedTokenErrorMessage(String originalMessage, String location) {
+ return location != null
+ ? "Text parsing error at '..." + location.trim() + "...'"
+ : "Text parsing error, " + originalMessage.replace("\uFFFF",END_OF_TEXT);
+ }
+
+ /**
+ * Override (e.g. for i18n) ANTLR parser error messages.
+ *
+ * @param originalMessage the ANTLR parser error message of the RecognitionException
+ * @return a message that is thrown by this validator
+ */
+ public String getSemanticErrorMessage(String originalMessage) {
+ return "Text parsing error, " + originalMessage.replace("\uFFFF",END_OF_TEXT);
+ }
+
+ /**
+ * Extracts the error from the <tt>RecognitionException</tt> and generates
+ * a location of the error by extracting the original text at the exceptions
+ * line and column.
+ *
+ * @param originalText
+ * the original Seam Text markup as fed into the parser
+ * @param re
+ * an ANTLR <tt>RecognitionException</tt> thrown by the parser
+ * @param charsBefore
+ * characters before error location included in message
+ * @param charsAfter
+ * characters after error location included in message
+ * @return an error message with some helpful context about where the error
+ * occured
+ */
+ public static String getErrorLocation(String originalText, RecognitionException re, int charsBefore, int charsAfter) {
+
+ int beginIndex = Math.max(re.getColumn() - 1 - charsBefore, 0);
+ int endIndex = Math.min(re.getColumn() + charsAfter, originalText.length());
+
+ String location = null;
+
+ // Avoid IOOBE even if what we show is wrong, we need to figure out why the indexes are off sometimes
+ if (beginIndex > 0 && beginIndex < endIndex && endIndex > 0 && endIndex < originalText.length())
+ location = originalText.substring(beginIndex, endIndex);
+
+ if (location == null) return location;
+
+ // Filter some dangerous characters we do not want in error messages
+ return location.replace("\n", " ").replace("\r", " ").replace("#{", "# {");
+ }
+
+ /**
+ * Extracts the error from the <tt>RecognitionException</tt> and generates
+ * a message including the location of the error.
+ *
+ * @param originalText
+ * the original Seam Text markup as fed into the parser
+ * @param re
+ * an ANTLR <tt>RecognitionException</tt> thrown by the parser
+ * @return an error message with some helpful context about where the error
+ * occured
+ */
+ public static String getErrorMessage(String originalText, RecognitionException re) {
+ return re.getMessage().replace("\uFFFF",END_OF_TEXT)
+ + " at '"
+ + getErrorLocation(
+ originalText, re,
+ NUMBER_OF_CONTEXT_CHARS_BEFORE, NUMBER_OF_CONTEXT_CHARS_AFTER
+ )
+ + "'";
+
+ }
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/ModelValidator.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/ModelValidator.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/java/org/jboss/seam/ui/validator/ModelValidator.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,74 @@
+package org.jboss.seam.ui.validator;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.hibernate.validator.InvalidValue;
+import org.jboss.seam.core.Validators;
+import org.jboss.seam.faces.FacesMessages;
+
+/**
+ * Validates using Hibernate Validator model-based annotations.
+ *
+ * @author Gavin King
+ * @author Jacob Hookom
+ *
+ */
+public class ModelValidator implements Validator
+{
+
+ public void validate(FacesContext facesContext, UIComponent component, Object value)
+ throws ValidatorException
+ {
+ ValueExpression valueExpression = component.getValueExpression("value");
+ if (valueExpression != null)
+ {
+ //TODO: note that this code is duplicated to Param.getValueFromRequest()!!
+ InvalidValue[] invalidValues;
+ try
+ {
+ invalidValues = Validators.instance().validate( valueExpression, facesContext.getELContext(), value );
+ }
+ catch (ELException ele)
+ {
+ Throwable cause = ele.getCause();
+ if (cause==null) cause = ele;
+ throw new ValidatorException(createMessage(cause), cause);
+ }
+
+ if ( invalidValues!=null && invalidValues.length>0 )
+ {
+ throw new ValidatorException(createMessage(invalidValues, resolveLabel(facesContext, component)));
+ }
+ }
+ }
+
+ private FacesMessage createMessage(InvalidValue[] invalidValues, Object label)
+ {
+ return FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, invalidValues[0].getMessage(), label);
+ }
+
+ private FacesMessage createMessage(Throwable cause)
+ {
+ return new FacesMessage(FacesMessage.SEVERITY_ERROR, "model validation failed:" + cause.getMessage(), null);
+ }
+
+ private Object resolveLabel(FacesContext facesContext, UIComponent component) {
+ Object lbl = component.getAttributes().get("label");
+ if (lbl == null || (lbl instanceof String && ((String) lbl).length() == 0))
+ {
+ lbl = component.getValueExpression("label");
+ }
+ if (lbl == null)
+ {
+ lbl = component.getClientId(facesContext);
+ }
+ return lbl;
+ }
+
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/javadoc/jdstyle.css
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/javadoc/jdstyle.css (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/javadoc/jdstyle.css 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,117 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body { font-family: Arial;
+ background-color: white;
+ font-size: 10pt;
+ }
+td { font-family: Arial;
+ font-size: 10pt;
+ }
+/* Table colors */
+.TableHeadingColor { background: #F4F4F4 }
+.TableSubHeadingColor { background: #F4F4F4 }
+.TableRowColor { background: #FFFFFF }
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: normal; font-family: Arial }
+.FrameHeadingFont { font-size: normal; font-family: Arial }
+.FrameItemFont { font-size: normal; font-family: Arial }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#F4F4F4;}
+.NavBarCell1Rev { background-color:silver;}
+
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+
+A {
+ color: #003399;
+}
+
+A:active {
+ color: #003399;
+}
+
+A:visited {
+ color: #888888;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+
+/*H1, H2, H3, H4, H5, H6 {
+ color: #000000;
+ font-weight:500;
+ margin-top:10px;
+ padding-top:15px;
+}
+
+H1 { font-size: 150%; }
+H2 { font-size: 140%; }
+H3 { font-size: 110%; font-weight: bold; }
+H4 { font-size: 110%; font-weight: bold;}
+H5 { font-size: 100%; font-style: italic; }
+H6 { font-size: 100%; font-style: italic; }*/
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+PRE {
+font-size: 90%;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+}
+
+UL, OL, LI {
+ list-style: disc;
+}
+
+HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+}
+
+.variablelist {
+ padding-top: 10;
+ padding-bottom:10;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+}
+
+.term {
+ font-weight:bold;
+}
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/META-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/META-INF/components.xml (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/resources/META-INF/components.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd">
+
+</components>
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/templates/README
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/templates/README (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/main/templates/README 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1 @@
+CDK's declarative (template based) renderer should not currently be used as it introduces runtime dependencies on ajax4jsf.
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicBooleanConverterTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicBooleanConverterTest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicBooleanConverterTest.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,57 @@
+package org.jboss.seam.ui.test;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.ui.converter.AtomicBooleanConverter;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicBooleanConverterTest
+{
+
+ @Test
+ public void testGetAsObject()
+ {
+ Converter converter = new AtomicBooleanConverter();
+ assertNull(converter.getAsObject(null, null, null));
+ assertNull(converter.getAsObject(null, null, ""));
+ assertNull(converter.getAsObject(null, null, " "));
+ assertTrue(((AtomicBoolean) converter.getAsObject(null, null, "true")).get());
+ assertTrue(((AtomicBoolean) converter.getAsObject(null, null, "true ")).get());
+ assertTrue(((AtomicBoolean) converter.getAsObject(null, null, " true")).get());
+ assertFalse(((AtomicBoolean) converter.getAsObject(null, null, "false")).get());
+ assertFalse(((AtomicBoolean) converter.getAsObject(null, null, "false ")).get());
+ assertFalse(((AtomicBoolean) converter.getAsObject(null, null, " false")).get());
+ assertFalse(((AtomicBoolean) converter.getAsObject(null, null, " boom ")).get());
+
+ }
+
+ @Test
+ public void testGetAsString()
+ {
+ Converter converter = new AtomicBooleanConverter();
+ assertEquals("", converter.getAsString(null, null, null));
+ assertEquals("", converter.getAsString(null, null, ""));
+ assertEquals("true", converter.getAsString(null, null, new AtomicBoolean(true)));
+ assertEquals("false", converter.getAsString(null, null, new AtomicBoolean(false)));
+ try
+ {
+ converter.getAsString(null, null, new Boolean(true));
+ fail();
+ }
+ catch (ConverterException c) {}
+
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicIntegerConverterTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicIntegerConverterTest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicIntegerConverterTest.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,61 @@
+package org.jboss.seam.ui.test;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.ui.converter.AtomicIntegerConverter;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicIntegerConverterTest
+{
+
+ @Test
+ public void testGetAsObject()
+ {
+ Converter converter = new AtomicIntegerConverter();
+ assertNull(converter.getAsObject(null, null, null));
+ assertNull(converter.getAsObject(null, null, ""));
+ assertNull(converter.getAsObject(null, null, " "));
+ assertTrue(8 == ((AtomicInteger) converter.getAsObject(null, null, " 8")).intValue());
+ assertTrue(8 == ((AtomicInteger) converter.getAsObject(null, null, "8 ")).intValue());
+ assertTrue(8 == ((AtomicInteger) converter.getAsObject(null, null, "8")).intValue());
+ int over = Integer.MAX_VALUE + 1;
+ assertTrue(over == ((AtomicInteger) converter.getAsObject(null, null, over + "")).intValue());
+ int under = Integer.MIN_VALUE - 1;
+ assertTrue(under == ((AtomicInteger) converter.getAsObject(null, null, under + "")).intValue());
+
+ try
+ {
+ converter.getAsObject(null, null, "NaN");
+ fail("should only take numbers");
+ }
+ catch (ConverterException c) { }
+ }
+
+ @Test
+ public void testGetAsString()
+ {
+ Converter converter = new AtomicIntegerConverter();
+ assertEquals("", converter.getAsString(null, null, null));
+ assertEquals("", converter.getAsString(null, null, ""));
+ assertEquals(" ", converter.getAsString(null, null, " "));
+ assertEquals("-1", converter.getAsString(null, null, new AtomicInteger(-1)));
+ try
+ {
+ converter.getAsString(null, null, new Integer(0));
+ fail("should only take atomic ints");
+ }
+ catch (ConverterException c) { }
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicLongConverterTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicLongConverterTest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/AtomicLongConverterTest.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,61 @@
+package org.jboss.seam.ui.test;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.ui.converter.AtomicLongConverter;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+/**
+ * @author Dennis Byrne
+ */
+
+public class AtomicLongConverterTest
+{
+
+ @Test
+ public void testGetAsObject()
+ {
+ Converter converter = new AtomicLongConverter();
+ assertNull(converter.getAsObject(null, null, null));
+ assertNull(converter.getAsObject(null, null, ""));
+ assertNull(converter.getAsObject(null, null, " "));
+ assertTrue(8 == ((AtomicLong) converter.getAsObject(null, null, " 8")).longValue());
+ assertTrue(8 == ((AtomicLong) converter.getAsObject(null, null, "8 ")).longValue());
+ assertTrue(8 == ((AtomicLong) converter.getAsObject(null, null, "8")).longValue());
+ long over = Long.MAX_VALUE + 1;
+ assertTrue(over == ((AtomicLong) converter.getAsObject(null, null, over + "")).longValue());
+ long under = Long.MIN_VALUE - 1;
+ assertTrue(under == ((AtomicLong) converter.getAsObject(null, null, under + "")).longValue());
+ try
+ {
+ converter.getAsObject(null, null, "NaN");
+ fail("should only take numbers");
+ }
+ catch (ConverterException c) { }
+
+ }
+
+ @Test
+ public void testGetAsString()
+ {
+ Converter converter = new AtomicLongConverter();
+ assertEquals("", converter.getAsString(null, null, null));
+ assertEquals("", converter.getAsString(null, null, ""));
+ assertEquals(" ", converter.getAsString(null, null, " "));
+ assertEquals("-1", converter.getAsString(null, null, new AtomicLong(-1)));
+ try
+ {
+ converter.getAsString(null, null, new Long(0));
+ fail("should only take atomic ints");
+ }
+ catch (ConverterException c) { }
+ }
+
+}
\ No newline at end of file
Added: branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java (rev 0)
+++ branches/community/Seam_2_3/jboss-seam-ui-jsf2/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java 2011-10-19 21:34:20 UTC (rev 14236)
@@ -0,0 +1,32 @@
+package org.jboss.seam.ui.test;
+
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.seam.ui.util.UrlBuilder;
+import org.testng.annotations.Test;
+
+public class UrlBuilderTest
+{
+ @Test
+ public void testBaseUrlAlreadyHasParams() throws UnsupportedEncodingException
+ {
+ UrlBuilder url = new UrlBuilder("/someurl?arg1=a", "", "UTF8");
+ url.addParameter("foo", "bar");
+
+ String encodedUrl = url.getEncodedUrl();
+
+ assert "/someurl?arg1=a&foo=bar".equals(encodedUrl);
+ }
+
+ @Test
+ public void testParameterOrdering() throws UnsupportedEncodingException
+ {
+ UrlBuilder url = new UrlBuilder("/Hotel.seam", "", "UTF-8");
+ url.addParameter("hotelId", "5");
+ url.addParameter("cid", "10");
+ url.addParameter("z", "z");
+ url.addParameter("a", "a");
+ String encodedUrl = url.getEncodedUrl();
+ assert "/Hotel.seam?hotelId=5&cid=10&z=z&a=a".equals(encodedUrl) : "Parameters not properly ordered";
+ }
+}
Modified: branches/community/Seam_2_3/seam-integration-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests/pom.xml 2011-10-19 21:31:37 UTC (rev 14235)
+++ branches/community/Seam_2_3/seam-integration-tests/pom.xml 2011-10-19 21:34:20 UTC (rev 14236)
@@ -124,10 +124,6 @@
<artifactId>jboss-seam</artifactId>
<type>ejb</type>
</dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
@@ -208,5 +204,60 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jsf12</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_12</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2_12</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf2</id>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.1.3_01</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.1.3_01</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui-jsf2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
More information about the seam-commits
mailing list