You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/03/15 23:41:58 UTC
svn commit: r923484 [2/2] - in
/myfaces/extensions/validator/branches/branch_for_jsf_2_0:
component-support/ component-support/generic-support/src/main/config/
component-support/trinidad-support/ component-support/trinidad-support/src/
component-suppor...
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+import org.apache.myfaces.extensions.validator.core.validation.exception.RequiredValidatorException;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(300)
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+ private static final String TRINIDAD_CORE_INPUT_TEXT
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputText";
+ private static final String TRINIDAD_CORE_INPUT_DATE
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputDate";
+
+ public boolean afterThrowing(UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException,
+ ValidationStrategy validatorExceptionSource)
+ {
+ if(processComponent(uiComponent))
+ {
+ tryToRefreshComponent(uiComponent);
+ tryToPlaceLabelInFacesMessage(uiComponent, metaDataEntry, validatorException);
+ }
+ return true;
+ }
+
+ private void tryToPlaceLabelInFacesMessage(
+ UIComponent uiComponent, MetaDataEntry metaDataEntry, ValidatorException validatorException)
+ {
+ tryToHandleRequiredValidatorException(uiComponent, validatorException);
+
+ String label = detectLabelText(metaDataEntry, uiComponent);
+
+ processLabel(validatorException.getFacesMessage(), label);
+ }
+
+ private String detectLabelText(MetaDataEntry metaDataEntry, UIComponent uiComponent)
+ {
+ String label = getLabel(uiComponent);
+
+ label = getClientIdAsFallbackIfNeeded(uiComponent, label);
+
+ label = tryToOverrideLabelIfProvidedManually(metaDataEntry, label);
+ return label;
+ }
+
+ private void processLabel(FacesMessage facesMessage, String label)
+ {
+ if(facesMessage instanceof LabeledMessage)
+ {
+ ((LabeledMessage)facesMessage).setLabelText(label);
+ }
+ //if someone uses a normal faces message
+ else
+ {
+ for(int i = 0; i < 3; i++)
+ {
+ ExtValUtils.tryToPlaceLabel(facesMessage, label, i);
+ }
+ }
+ }
+
+ private String tryToOverrideLabelIfProvidedManually(MetaDataEntry metaDataEntry, String label)
+ {
+ if(metaDataEntry != null && metaDataEntry.getProperty(PropertyInformationKeys.LABEL) != null)
+ {
+ return metaDataEntry.getProperty(PropertyInformationKeys.LABEL, String.class);
+ }
+ return label;
+ }
+
+ private String getClientIdAsFallbackIfNeeded(UIComponent uiComponent, String label)
+ {
+ if(label == null)
+ {
+ return uiComponent.getClientId(FacesContext.getCurrentInstance());
+ }
+ return label;
+ }
+
+ private void tryToHandleRequiredValidatorException(UIComponent uiComponent, ValidatorException validatorException)
+ {
+ if(validatorException instanceof RequiredValidatorException)
+ {
+ FacesMessage facesMessage = validatorException.getFacesMessage();
+ String inlineMessage = getInlineRequiredMessage(uiComponent);
+
+ if(inlineMessage != null)
+ {
+ facesMessage.setSummary(inlineMessage);
+ facesMessage.setDetail(inlineMessage);
+ }
+ }
+ }
+
+ private void tryToRefreshComponent(UIComponent uiComponent)
+ {
+ if(RequestContext.getCurrentInstance().isPartialRequest(FacesContext.getCurrentInstance()))
+ {
+ RequestContext.getCurrentInstance().addPartialTarget(uiComponent);
+ }
+ }
+
+ protected boolean processComponent(UIComponent uiComponent)
+ {
+ return uiComponent != null &&
+ (TRINIDAD_CORE_INPUT_TEXT.equals(uiComponent.getClass().getName()) ||
+ TRINIDAD_CORE_INPUT_DATE.equals(uiComponent.getClass().getName()));
+ }
+
+ private String getLabel(UIComponent uiComponent)
+ {
+ return (String)ReflectionUtils.tryToInvokeMethod(uiComponent,
+ ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getLabel"));
+ }
+
+ private String getInlineRequiredMessage(UIComponent uiComponent)
+ {
+ return (String)ReflectionUtils.tryToInvokeMethod(uiComponent,
+ ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getRequiredMessageDetail"));
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.trinidadinternal.renderkit.RenderKitDecorator;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
+
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import javax.faces.render.ResponseStateManager;
+import javax.faces.context.ResponseWriter;
+import javax.faces.context.ResponseStream;
+import java.io.Writer;
+import java.io.OutputStream;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValTrinidadRenderKit extends RenderKitDecorator
+{
+ protected ExtValRenderKit extValRenderKit;
+
+ public static final String ID = "EXTVAL_TRINIDAD_RENDERKIT";
+
+ public ExtValTrinidadRenderKit(RenderKit wrapped)
+ {
+ this.extValRenderKit = new ExtValRenderKit(wrapped);
+ }
+
+ @Override
+ public void addRenderer(String family, String rendererType, Renderer renderer)
+ {
+ this.extValRenderKit.addRenderer(family, rendererType, renderer);
+ }
+
+ @Override
+ public Renderer getRenderer(String family, String rendererType)
+ {
+ return this.extValRenderKit.getRenderer(family, rendererType);
+ }
+
+ @Override
+ public ResponseStateManager getResponseStateManager()
+ {
+ return this.extValRenderKit.getResponseStateManager();
+ }
+
+ @Override
+ public ResponseWriter createResponseWriter(Writer writer, String s, String s1)
+ {
+ return this.extValRenderKit.createResponseWriter(writer, s, s1);
+ }
+
+ @Override
+ public ResponseStream createResponseStream(OutputStream outputStream)
+ {
+ return this.extValRenderKit.createResponseStream(outputStream);
+ }
+
+ protected String getDecoratedRenderKitId()
+ {
+ return CoreRenderKit.BASE_RENDER_KIT_ID;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.render.Renderer;
+import javax.faces.context.FacesContext;
+
+/**
+ * solution for trinidad table renderer issue (in connection with double call prevention proxies)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class ExtValTrinidadRendererProxy extends ExtValRendererProxy
+{
+ public ExtValTrinidadRendererProxy(Renderer renderer)
+ {
+ super(renderer);
+ }
+
+ @Override
+ protected String getOptionalKey(FacesContext facesContext, UIComponent uiComponent)
+ {
+ if(TableRenderingContext.getCurrentInstance() != null)
+ {
+ return "|" + TableRenderingContext.getCurrentInstance().getRenderStage().getStage();
+ }
+
+ return "";
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.startup;
+
+import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManagerHolder;
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.trinidad.initializer.component.TrinidadComponentInitializer;
+import org.apache.myfaces.extensions.validator.trinidad.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.trinidad.storage.TrinidadClientValidatorStorage;
+import org.apache.myfaces.extensions.validator.trinidad.storage.DefaultClientValidatorStorageManager;
+import org.apache.myfaces.extensions.validator.trinidad.validation.message.TrinidadFacesMessageFactory;
+import org.apache.myfaces.extensions.validator.trinidad.renderkit.ExtValTrinidadRendererProxy;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadRendererInterceptor;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadMetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * alternative approach for ExtValRenderKitFactory
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadModuleStartupListener extends AbstractStartupListener
+{
+ private static final long serialVersionUID = -8034089244903966999L;
+
+ protected void init()
+ {
+ deactivateDefaultExtValRenderKitWrapperFactory();
+
+ initClientSideValidationSupport();
+
+ initLabelInitializationSupport();
+
+ initValidationExceptionInterception();
+
+ replaceDefaultProxyWithTrinidadRendererProxy();
+
+ initTrinidadFacesMessageFactory();
+ /*
+ * if there are further incompatible renderers use the following quick-fix:
+ * ExtValContext.getContext()
+ .addGlobalProperty(ExtValRendererProxy.KEY, null);
+ attention: it causes direct delegation without a check of double invocations
+ */
+
+ initTrinidadMetaDataExtractionInterceptor();
+
+ initTrinidadClientValidatorStorage();
+
+ initRequiredInitialization();
+ }
+
+ private void deactivateDefaultExtValRenderKitWrapperFactory()
+ {
+ ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY, AbstractRenderKitWrapperFactory.class).deactivate();
+ }
+
+ private void initClientSideValidationSupport()
+ {
+ if(isClientSideValidationSupportEnabled(WebXmlParameter.DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION))
+ {
+ ExtValContext.getContext().addComponentInitializer(new TrinidadComponentInitializer());
+ }
+ }
+
+ private void initLabelInitializationSupport()
+ {
+ if(isLabelInitializationEnabled(WebXmlParameter.DEACTIVATE_TRINIDAD_CORE_OUTPUT_LABEL_INITIALIZATION))
+ {
+ ExtValContext.getContext().registerRendererInterceptor(new TrinidadRendererInterceptor());
+ }
+ }
+
+ private void initValidationExceptionInterception()
+ {
+ if(useValidationExceptionInterception(WebXmlParameter.DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR))
+ {
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TrinidadValidationExceptionInterceptor());
+ }
+ }
+
+ private void replaceDefaultProxyWithTrinidadRendererProxy()
+ {
+ ExtValContext.getContext()
+ .addGlobalProperty(ExtValRendererProxy.KEY, ExtValTrinidadRendererProxy.class.getName());
+ }
+
+ private void initTrinidadFacesMessageFactory()
+ {
+ ExtValContext.getContext()
+ .addGlobalProperty(
+ FactoryNames.FACES_MESSAGE_FACTORY.name(),
+ TrinidadFacesMessageFactory.class.getName());
+ }
+
+ private void initTrinidadMetaDataExtractionInterceptor()
+ {
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TrinidadMetaDataExtractionInterceptor());
+ }
+
+ private void initTrinidadClientValidatorStorage()
+ {
+ ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.STORAGE_MANAGER_FACTORY, StorageManagerHolder.class)
+ .setStorageManager(TrinidadClientValidatorStorage.class,
+ new DefaultClientValidatorStorageManager(), false);
+ }
+
+ private boolean isLabelInitializationEnabled(String deactivateInitCoreOutputLabel)
+ {
+ return deactivateInitCoreOutputLabel == null || !deactivateInitCoreOutputLabel.equalsIgnoreCase("true");
+ }
+
+ private boolean isClientSideValidationSupportEnabled(String deactivateClientSideValidation)
+ {
+ return deactivateClientSideValidation == null || !deactivateClientSideValidation.equalsIgnoreCase("true");
+ }
+
+ private boolean useValidationExceptionInterception(String deactivateTrinidadValidationExceptionInterceptor)
+ {
+ return deactivateTrinidadValidationExceptionInterceptor == null ||
+ !deactivateTrinidadValidationExceptionInterceptor.equalsIgnoreCase("true");
+ }
+
+ protected void initRequiredInitialization()
+ {
+ if(!isRequiredInitializationDeactivated())
+ {
+ ExtValContext.getContext().addGlobalProperty("mode:init:required", Boolean.TRUE, true);
+
+ //there is no support for client-side severity aware validation -> don't reset the value
+ ExtValContext.getContext().addGlobalProperty("mode:reset:required", Boolean.FALSE, false);
+ }
+ }
+
+ private boolean isRequiredInitializationDeactivated()
+ {
+ return "false".equalsIgnoreCase(
+ org.apache.myfaces.extensions.validator.core.WebXmlParameter.ACTIVATE_REQUIRED_INITIALIZATION);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorage.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorage.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.storage;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadClientValidatorWrapper;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.Validator;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultClientValidatorStorage implements TrinidadClientValidatorStorage
+{
+ private List<UIComponent> componentList = new ArrayList<UIComponent>();
+
+ public void addComponent(UIComponent trinidadComponent)
+ {
+ if(!this.componentList.contains(trinidadComponent))
+ {
+ this.componentList.add(trinidadComponent);
+ }
+ }
+
+ public void rollback()
+ {
+ for (UIComponent component : this.componentList)
+ {
+ removeTrinidadValidatorWrapper(component);
+ }
+ this.componentList.clear();
+ }
+
+ private void removeTrinidadValidatorWrapper(UIComponent uiComponent)
+ {
+ if (uiComponent instanceof EditableValueHolder)
+ {
+ removeWrapperFromComponent(uiComponent);
+ }
+ else
+ {
+ //to keep the source in sync with older versions
+ for (Object child : uiComponent.getChildren())
+ {
+ removeTrinidadValidatorWrapper((UIComponent)child);
+ }
+ }
+ }
+
+ private void removeWrapperFromComponent(UIComponent uiComponent)
+ {
+ for (Validator validator : ((EditableValueHolder) uiComponent).getValidators())
+ {
+ if (validator instanceof ExtValTrinidadClientValidatorWrapper)
+ {
+ ((EditableValueHolder) uiComponent).removeValidator(validator);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorageManager.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorageManager.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/DefaultClientValidatorStorageManager.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.storage;
+
+import org.apache.myfaces.extensions.validator.core.storage.AbstractRequestScopeAwareStorageManager;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
+import org.apache.myfaces.extensions.validator.trinidad.storage.mapper.DefaultClientValidatorStorageNameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * default storage-manager for component entries
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultClientValidatorStorageManager
+ extends AbstractRequestScopeAwareStorageManager<TrinidadClientValidatorStorage>
+{
+ public DefaultClientValidatorStorageManager()
+ {
+ register(new DefaultClientValidatorStorageNameMapper());
+ }
+
+ public String getStorageManagerKey()
+ {
+ return StorageManager.class.getName() + "_FOR_TRINIDAD_CLIENT_VALIDATOR:KEY";
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/TrinidadClientValidatorStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/TrinidadClientValidatorStorage.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/TrinidadClientValidatorStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/TrinidadClientValidatorStorage.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.storage;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * extval injects client-validators into trinidad components based on meta-data.
+ * so client-side validation is supported. some app-servers show a different behaviour.
+ * that's the reason for storing these components and remove the injected validators after the rendering phase.
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface TrinidadClientValidatorStorage
+{
+ void addComponent(UIComponent trinidadComponent);
+ void rollback();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/mapper/DefaultClientValidatorStorageNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/mapper/DefaultClientValidatorStorageNameMapper.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/mapper/DefaultClientValidatorStorageNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/storage/mapper/DefaultClientValidatorStorageNameMapper.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.storage.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.trinidad.storage.TrinidadClientValidatorStorage;
+import org.apache.myfaces.extensions.validator.trinidad.storage.DefaultClientValidatorStorage;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * use a public class to allow optional deregistration
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@InvocationOrder(300)
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultClientValidatorStorageNameMapper implements NameMapper<String>
+{
+ public String createName(String source)
+ {
+ return (TrinidadClientValidatorStorage.class.getName().equals(source)) ?
+ DefaultClientValidatorStorage.class.getName() : null;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+@ToDo(value = Priority.MEDIUM, description = "check subform")
+public class TrinidadUtils
+{
+ protected static final Log LOG = LogFactory.getLog(TrinidadUtils.class);
+
+ public static UIComponent findLabeledEditableComponent(CoreOutputLabel coreOutputLabel)
+ {
+ //TODO
+ if(isLabelTargetAvailable(coreOutputLabel))
+ {
+ return null;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent result = resolveLabelTarget(facesContext, coreOutputLabel);
+
+ if(result instanceof EditableValueHolder)
+ {
+ return result;
+ }
+
+ if(LOG.isTraceEnabled())
+ {
+ LOG.trace(coreOutputLabel.getClientId(facesContext) + " doesn't reference an editable component");
+ }
+
+ return null;
+ }
+
+ private static UIComponent resolveLabelTarget(FacesContext facesContext, CoreOutputLabel coreOutputLabel)
+ {
+ return facesContext.getViewRoot().findComponent(coreOutputLabel.getFor());
+ }
+
+ private static boolean isLabelTargetAvailable(CoreOutputLabel coreOutputLabel)
+ {
+ return coreOutputLabel.getFor() == null;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.validation.message;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.DefaultFacesMessageFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadFacesMessageFactory extends DefaultFacesMessageFactory
+{
+ @Override
+ protected boolean isLabeledFacesMessage(FacesMessage facesMessage)
+ {
+ return facesMessage instanceof TrinidadViolationMessage;
+ }
+
+ @Override
+ public FacesMessage create(FacesMessage.Severity severity, String summary, String detail)
+ {
+ return new TrinidadViolationMessage(severity, summary, detail);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java Mon Mar 15 22:41:57 2010
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.validation.message;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.trinidad.util.LabeledFacesMessage;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class TrinidadViolationMessage extends LabeledFacesMessage implements LabeledMessage
+{
+ private static final long serialVersionUID = 6356800689961505154L;
+ public static final String MISSING_RESOURCE_MARKER = "???";
+
+ public TrinidadViolationMessage(Severity severity, String summary, String detail)
+ {
+ super(severity, summary, detail);
+ }
+
+ public String getLabelText()
+ {
+ return super.getLabelAsString(FacesContext.getCurrentInstance());
+ }
+
+ @Override
+ public String getSummary()
+ {
+ FacesMessage result = tryToPlaceLabel(super.getSummary());
+
+ if (result != null)
+ {
+ super.setSummary(result.getSummary());
+ return result.getSummary();
+ }
+
+ return super.getSummary();
+ }
+
+ @Override
+ public String getDetail()
+ {
+ FacesMessage result = tryToPlaceLabel(super.getDetail());
+
+ if (result != null)
+ {
+ super.setDetail(result.getDetail());
+ return result.getDetail();
+ }
+
+ return super.getDetail();
+ }
+
+ private FacesMessage tryToPlaceLabel(String originalMessage)
+ {
+ if (isValidMessage(originalMessage))
+ {
+ FacesMessage newFacesMessage = createOriginalFacesMessage();
+ tryToPlaceLabelIn(newFacesMessage);
+ return newFacesMessage;
+ }
+
+ return null;
+ }
+
+ private FacesMessage createOriginalFacesMessage()
+ {
+ return new FacesMessage(super.getSeverity(), super.getSummary(), super.getDetail());
+ }
+
+ private void tryToPlaceLabelIn(FacesMessage newFacesMessage)
+ {
+ String label = getLabelText();
+
+ if(label != null)
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ ExtValUtils.tryToPlaceLabel(newFacesMessage, label, i);
+ }
+ }
+ }
+
+ private boolean isValidMessage(String originalMessage)
+ {
+ return !(originalMessage != null &&
+ originalMessage.startsWith(MISSING_RESOURCE_MARKER) &&
+ originalMessage.endsWith(MISSING_RESOURCE_MARKER));
+ }
+
+ public void setLabelText(String label)
+ {
+ super.setLabel(label);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/LICENSE.txt?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/LICENSE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/LICENSE.txt Mon Mar 15 22:41:57 2010
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/NOTICE.txt?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/NOTICE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/main/resources/NOTICE.txt Mon Mar 15 22:41:57 2010
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/site/apt/index.apt?rev=923484&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/site/apt/index.apt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/trinidad-support/src/site/apt/index.apt Mon Mar 15 22:41:57 2010
@@ -0,0 +1,10 @@
+ ------
+Apache MyFaces Extensions Validator Trinidad Support Module
+ ------
+
+Apache MyFaces Extensions Validator Trinidad Support Module Overview
+
+ MyFaces Extensions Validator Trinidad Support Module provides special Trinidad Support for MyFaces Extensions Validator.
+ Furthermore, it allows to join the client-side validation mechanism of Trinidad. Sample use-case: annotate your model with JPA 1.0 annotations, bind properties to JSF Input components and get automatic client-side validation just by adding 3 JAR files (MyFaces Extensions Validator Core, Property Validation and Trinidad Support).
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml?rev=923484&r1=923483&r2=923484&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml Mon Mar 15 22:41:57 2010
@@ -19,7 +19,7 @@
<faces-config 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"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<factory>
<render-kit-factory>org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKitFactory</render-kit-factory>
Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/examples/pom.xml?rev=923484&r1=923483&r2=923484&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/examples/pom.xml (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/examples/pom.xml Mon Mar 15 22:41:57 2010
@@ -89,7 +89,7 @@
</profiles>
<properties>
- <trinidad.version>1.2.9</trinidad.version>
+ <trinidad.version>2.0.0-alpha-2</trinidad.version>
</properties>
</project>
Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/bean-validation/src/main/config/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/bean-validation/src/main/config/faces-config.xml?rev=923484&r1=923483&r2=923484&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/bean-validation/src/main/config/faces-config.xml (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/bean-validation/src/main/config/faces-config.xml Mon Mar 15 22:41:57 2010
@@ -18,7 +18,7 @@
-->
<faces-config 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"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<factory>
<application-factory>org.apache.myfaces.extensions.validator.beanval.factory.ExtValApplicationFactory</application-factory>
Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/property-validation/src/main/config/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/property-validation/src/main/config/faces-config.xml?rev=923484&r1=923483&r2=923484&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/property-validation/src/main/config/faces-config.xml (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/validation-modules/property-validation/src/main/config/faces-config.xml Mon Mar 15 22:41:57 2010
@@ -18,7 +18,7 @@
-->
<faces-config 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"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<lifecycle>
<phase-listener>org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener</phase-listener>