Author: ivaynberg
Date: Fri Jul  1 22:20:47 2011
New Revision: 1142107

URL: http://svn.apache.org/viewvc?rev=1142107&view=rev
Log:

Issue: WICKET-3857

Added:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java
   (with props)
Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?rev=1142107&r1=1142106&r2=1142107&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
 Fri Jul  1 22:20:47 2011
@@ -44,6 +44,7 @@ import org.apache.wicket.util.string.Str
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.string.interpolator.MapVariableInterpolator;
 import org.apache.wicket.validation.IErrorMessageSource;
+import org.apache.wicket.validation.IModelAwareValidatable;
 import org.apache.wicket.validation.INullAcceptingValidator;
 import org.apache.wicket.validation.IValidatable;
 import org.apache.wicket.validation.IValidationError;
@@ -325,7 +326,7 @@ public abstract class FormComponent<T> e
         * 
         * @author ivaynberg
         */
-       private class ValidatableAdapter implements IValidatable<T>
+       private class ValidatableAdapter implements IModelAwareValidatable<T>
        {
                /**
                 * @see 
org.apache.wicket.validation.IValidatable#error(org.apache.wicket.validation.IValidationError)
@@ -350,6 +351,11 @@ public abstract class FormComponent<T> e
                {
                        return FormComponent.this.isValid();
                }
+
+               public IModel<T> getModel()
+               {
+                       return FormComponent.this.getModel();
+               }
        }
 
        /**

Added: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java?rev=1142107&view=auto
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java
 (added)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java
 Fri Jul  1 22:20:47 2011
@@ -0,0 +1,38 @@
+/*
+ * 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.wicket.validation;
+
+import org.apache.wicket.model.IModel;
+
+/**
+ * Validatable extension that allows access to component's model. This 
extension is implemented by
+ * default but exists as a separate interface for backwards compatibility.
+ * 
+ * NOTE: in Wicket 1.5 {@link #getModel()} is implemented directly in {@link 
IValidatable}
+ * 
+ * @author igor
+ * @param <T>
+ */
+public interface IModelAwareValidatable<T> extends IValidatable<T>
+{
+       /**
+        * Gets the model of the component being validated
+        * 
+        * @return model of component
+        */
+       IModel<T> getModel();
+}

Propchange: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to