001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.form.validator;
016    
017    import org.apache.tapestry.IMarkupWriter;
018    import org.apache.tapestry.IRequestCycle;
019    import org.apache.tapestry.form.FormComponentContributorContext;
020    import org.apache.tapestry.form.IFormComponent;
021    import org.apache.tapestry.form.ValidationMessages;
022    import org.apache.tapestry.valid.ValidatorException;
023    
024    /**
025     * Used by {@link org.apache.tapestry.form.validator.TestValidatorFactory}.
026     * 
027     * @author Howard Lewis Ship
028     * @since 4.0
029     */
030    public class ValidatorFixture implements Validator
031    {
032        private String _value;
033    
034        private String _message;
035    
036        public void validate(IFormComponent field, ValidationMessages messages, Object object)
037                throws ValidatorException
038        {
039        }
040    
041        public boolean getAcceptsNull()
042        {
043            return false;
044        }
045    
046        public void renderContribution(IMarkupWriter writer, IRequestCycle cycle,
047                FormComponentContributorContext context, IFormComponent field)
048        {
049        }
050    
051        public String getMessage()
052        {
053            return _message;
054        }
055    
056        public void setMessage(String message)
057        {
058            _message = message;
059        }
060    
061        public String getValue()
062        {
063            return _value;
064        }
065    
066        public void setValue(String value)
067        {
068            _value = value;
069        }
070    
071        public boolean isRequired()
072        {
073            return false;
074        }
075    }