001 /*
002 * Copyright 2002-2004 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016 package org.springframework.richclient.form.binding;
017
018 import org.springframework.binding.form.FormModel;
019
020 /**
021 * Strategy interface that encapsulates the selection of a <code>Binder</code>
022 * for the provided form model, property name and optionally control type.
023 *
024 * @author Oliver Hutchison
025 */
026 public interface BinderSelectionStrategy {
027
028 /**
029 * Returns a binder for the provided form model and property name.
030 * @param formModel the form model which contains the property to be bound
031 * @param propertyName the name of the property to be bound
032 * @return the <code>Binder</code> (never null). This binder must be capable of
033 * generating it's own control to bind to.
034 * @throws BinderNotFoundException if there is no suitable binder
035 */
036 Binder selectBinder(FormModel formModel, String propertyName);
037
038 /**
039 * Returns a binder that is capable of binding the provided control type to
040 * the provided form model and property name.
041 * @param controlType the type of the control to be bound
042 * @param formModel the form model which contains the property to be bound
043 * @param propertyName the name of the property to be bound
044 * @return the <code>Binder</code> (never null). This binder must be capable of
045 * binding to a pre-created control that is of the specified <code>controlType</code>.
046 * @throws BinderNotFoundException if there is no suitable binder
047 */
048 Binder selectBinder(Class controlType, FormModel formModel, String propertyName);
049 }