1 /*
2 * Copyright 2004-2008 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.uruma.binding.value.command;
17
18 import java.lang.reflect.Field;
19 import java.util.List;
20
21 import org.seasar.framework.beans.PropertyDesc;
22 import org.seasar.uruma.annotation.ImportSelection;
23 import org.seasar.uruma.binding.value.BindingCommand;
24 import org.seasar.uruma.binding.value.ValueBinder;
25 import org.seasar.uruma.component.UIComponent;
26 import org.seasar.uruma.desc.FormDesc;
27
28 /**
29 * {@link ImportSelection} アノテーションに対応した処理を行うための、{@link BindingCommand} です。<br />
30 *
31 * @author y-komori
32 */
33 public class ImportSelectionCommand extends
34 AbstractBindingCommand<ImportSelection> {
35
36 /*
37 * @see org.seasar.uruma.binding.value.BindingCommand#getTargetPropertyDescs(org.seasar.uruma.desc.FormDesc)
38 */
39 public List<PropertyDesc> getTargetPropertyDescs(final FormDesc desc) {
40 return desc.getImportSelectionProperties();
41 }
42
43 /*
44 * @see org.seasar.uruma.binding.value.command.AbstractBindingCommand#doBind(org.seasar.uruma.binding.value.ValueBinder,
45 * java.lang.Object, java.lang.Object,
46 * org.seasar.framework.beans.PropertyDesc)
47 */
48 @Override
49 protected void doBind(final ValueBinder binder, final Object widget,
50 final Object formObj, final PropertyDesc propDesc,
51 final UIComponent uiComp) {
52 binder.importSelection(widget, formObj, propDesc, uiComp);
53 }
54
55 /*
56 * @see org.seasar.uruma.binding.value.command.AbstractBindingCommand#getAnnotation(Field)
57 */
58 @Override
59 protected ImportSelection getAnnotation(final Field field) {
60 return field.getAnnotation(ImportSelection.class);
61 }
62
63 /*
64 * @see org.seasar.uruma.binding.value.command.AbstractBindingCommand#getId(ANNOTATION_CLASS)
65 */
66 @Override
67 protected String getId(final ImportSelection annotation) {
68 return annotation.id();
69 }
70 }