myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r711334 - in /myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval: ./ recorder/ referencing/strategy/ strategy/
Date Tue, 04 Nov 2008 18:07:36 GMT
Author: gpetracek
Date: Tue Nov  4 10:07:36 2008
New Revision: 711334

URL: http://svn.apache.org/viewvc?rev=711334&view=rev
Log:
support for cross-component validation error messages within complex components

Modified:
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
Tue Nov  4 10:07:36 2008
@@ -24,7 +24,6 @@
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
 import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
@@ -63,16 +62,7 @@
 
                     if (facesMessage != null && facesMessage.getSummary() != null
&& facesMessage.getDetail() != null)
                     {
-                        UIComponent component = entry.getComponent();
-                        String clientId = null;
-
-                        //TODO
-                        if (component != null)
-                        {
-                            clientId = component.getClientId(event.getFacesContext());
-                        }
-
-                        event.getFacesContext().addMessage(clientId, facesMessage);
+                        event.getFacesContext().addMessage(entry.getClientId(), facesMessage);
                     }
 
                     event.getFacesContext().renderResponse();

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
Tue Nov  4 10:07:36 2008
@@ -37,6 +37,8 @@
     private UIComponent component;
     private Object convertedObject;
     private CrossValidationStrategy validationStrategy;
+    //just for input components within complex components e.g. dataTable,...
+    private String clientId;
 
     public MetaDataEntry getMetaDataEntry()
     {
@@ -77,4 +79,14 @@
     {
         this.validationStrategy = validationStrategy;
     }
+
+    public String getClientId()
+    {
+        return clientId;
+    }
+
+    public void setClientId(String clientId)
+    {
+        this.clientId = clientId;
+    }
 }

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
Tue Nov  4 10:07:36 2008
@@ -40,6 +40,8 @@
     //the same key (here the el expression #{entry.property})
     //however, don't override the previous entry - they arn't the same;
     private List<ProcessedInformationEntry> furtherEntries;
+    //just for input components within complex components e.g. dataTable,...
+    private String clientId;
 
     /*
      * generated
@@ -74,6 +76,16 @@
         this.component = component;
     }
 
+    public String getClientId()
+    {
+        return clientId;
+    }
+
+    public void setClientId(String clientId)
+    {
+        this.clientId = clientId;
+    }
+
     public List<ProcessedInformationEntry> getFurtherEntries()
     {
         return furtherEntries;

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
Tue Nov  4 10:07:36 2008
@@ -28,6 +28,7 @@
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.EditableValueHolder;
+import javax.faces.context.FacesContext;
 import java.util.Map;
 import java.util.List;
 import java.util.ArrayList;
@@ -64,6 +65,7 @@
         entry.setBean(targetInformationEntry.getBaseObject());
         entry.setConvertedValue(value);
         entry.setComponent(uiComponent);
+        entry.setClientId(uiComponent.getClientId(FacesContext.getCurrentInstance()));
 
         String key = targetInformationEntry.getKey();
 

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
Tue Nov  4 10:07:36 2008
@@ -139,10 +139,12 @@
             if (compareStrategy.useTargetComponentToDisplayErrorMsg(crossValidationStorageEntry))
             {
                 tmpCrossValidationStorageEntry.setComponent(validationTargetEntry.getComponent());
+                tmpCrossValidationStorageEntry.setClientId(validationTargetEntry.getClientId());
             }
             else
             {
                 tmpCrossValidationStorageEntry.setComponent(crossValidationStorageEntry.getComponent());
+                tmpCrossValidationStorageEntry.setClientId(crossValidationStorageEntry.getClientId());
             }
             tmpCrossValidationStorageEntry.setConvertedObject(validationTargetEntry.getConvertedValue());
             tmpCrossValidationStorageEntry.setValidationStrategy(compareStrategy);

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
Tue Nov  4 10:07:36 2008
@@ -144,26 +144,25 @@
         FacesMessage message;
         if (entryOfTarget.getMetaDataEntry() != null)
         {
-            message = getTargetComponentErrorMessage(entryOfTarget
-                    .getMetaDataEntry().getValue(Annotation.class), summary, details);
+            message = getTargetComponentErrorMessage(
+                entryOfTarget.getMetaDataEntry().getValue(Annotation.class), summary, details);
         }
         else
         {
             //TODO document possible side effects
             //due to a missing target annotation (see: tryToValidateLocally)
-            message = getTargetComponentErrorMessage(entryOfSource
-                    .getMetaDataEntry().getValue(Annotation.class), summary, details);
+            message = getTargetComponentErrorMessage(
+                entryOfSource.getMetaDataEntry().getValue(Annotation.class), summary, details);
         }
 
         if (message.getSummary() != null || message.getDetail() != null)
         {
-            facesContext.addMessage(entryOfTarget.getComponent().getClientId(facesContext),
message);
+            facesContext.addMessage(entryOfTarget.getClientId(), message);
         }
     }
 
     //has to be public for custom referencing strategies!!!
-    public final void processSourceComponentAfterViolation(
-            CrossValidationStorageEntry entryOfSource)
+    public final void processSourceComponentAfterViolation(CrossValidationStorageEntry entryOfSource)
     {
         if (!handleSourceViolation(entryOfSource))
         {

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java?rev=711334&r1=711333&r2=711334&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
(original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
Tue Nov  4 10:07:36 2008
@@ -55,6 +55,7 @@
 
         entry.setMetaDataEntry(metaDataEntry);
         entry.setComponent(uiComponent);
+        entry.setClientId(uiComponent.getClientId(facesContext));
         entry.setConvertedObject(convertedObject);
         entry.setValidationStrategy(this);
 



Mime
View raw message