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.binder;
17
18 import org.eclipse.jface.viewers.TreeViewer;
19 import org.seasar.framework.beans.PropertyDesc;
20 import org.seasar.uruma.binding.value.ValueBinder;
21 import org.seasar.uruma.component.UIComponent;
22 import org.seasar.uruma.viewer.UrumaTreeViewer;
23
24 /**
25 * {@link TreeViewer} のための {@link ValueBinder} です。<br />
26 *
27 * @author y-komori
28 */
29 public class TreeViewerValueBinder extends AbstractValueBinder<UrumaTreeViewer> {
30
31 /**
32 * {@link TreeViewerValueBinder} を構築します。<br />
33 */
34 public TreeViewerValueBinder() {
35 super(UrumaTreeViewer.class);
36 }
37
38 /*
39 * @see org.seasar.uruma.binding.value.binder.AbstractValueBinder#doExportValue(java.lang.Object,
40 * java.lang.Object, org.seasar.framework.beans.PropertyDesc)
41 */
42 @Override
43 public void doExportValue(final UrumaTreeViewer widget,
44 final Object formObj, final PropertyDesc propDesc,
45 final UIComponent uiComp) {
46 if (widget.getContentProvider() != null) {
47 Object value = propDesc.getValue(formObj);
48 if (value != null) {
49 Object oldValue = widget.getInput();
50 if (oldValue != value) {
51 logBinding(EXPORT_VALUE, formObj, propDesc, widget, null,
52 value);
53 widget.setInput(value);
54 }
55 }
56 }
57 }
58 }