Coverage Report - org.seasar.uruma.binding.value.binder.BrowserValueBinder
 
Classes in this File Line Coverage Branch Coverage Complexity
BrowserValueBinder
13%
2/15
0%
0/6
0
 
 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.swt.browser.Browser;
 19  
 import org.seasar.framework.beans.PropertyDesc;
 20  
 import org.seasar.uruma.binding.value.ValueBinder;
 21  
 import org.seasar.uruma.component.UIComponent;
 22  
 
 23  
 /**
 24  
  * {@link Browser} のための {@link ValueBinder} です。<br />
 25  
  * 
 26  
  * @author y.sugigami
 27  
  */
 28  0
 public class BrowserValueBinder extends AbstractValueBinder<Browser> {
 29  
 
 30  
     /**
 31  
      * {@link BrowserValueBinder} を構築します。<br />
 32  
      * 
 33  
      */
 34  
     public BrowserValueBinder() {
 35  4
         super(Browser.class);
 36  4
     }
 37  
 
 38  
     /*
 39  
      * @see org.seasar.uruma.binding.value.binder.AbstractValueBinder#doImportValue(java.lang.Object,
 40  
      *      java.lang.Object, org.seasar.framework.beans.PropertyDesc)
 41  
      */
 42  
     @Override
 43  
     public void doImportValue(final Browser widget, final Object formObj,
 44  
             final PropertyDesc propDesc, final UIComponent uiComp) {
 45  0
         Object value = propDesc.getValue(widget);
 46  
 
 47  
         // 空文字列の入力は null として扱う
 48  0
         if (value instanceof String && ((String) value).length() == 0) {
 49  0
             value = null;
 50  
         }
 51  
 
 52  0
         logBinding(IMPORT_VALUE, widget, propDesc, formObj, propDesc, value);
 53  
 
 54  0
         propDesc.setValue(formObj, value);
 55  0
     }
 56  
 
 57  
     /*
 58  
      * @see org.seasar.uruma.binding.value.binder.AbstractValueBinder#doExportValue(java.lang.Object,
 59  
      *      java.lang.Object, org.seasar.framework.beans.PropertyDesc)
 60  
      */
 61  
     @Override
 62  
     protected void doExportValue(final Browser widget, final Object formObj,
 63  
             final PropertyDesc propDesc, final UIComponent uiComp) {
 64  
 
 65  0
         Object value = propDesc.getValue(formObj);
 66  
 
 67  0
         if (value == null) {
 68  0
             value = "";
 69  
         }
 70  
 
 71  0
         logBinding(EXPORT_VALUE, formObj, propDesc, widget, propDesc, value);
 72  
 
 73  0
         widget.setText((String) value);
 74  
 
 75  0
     }
 76  
 }