Coverage Report - org.seasar.uruma.component.factory.handler.LayoutDataTagHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
LayoutDataTagHandler
100%
10/10
75%
3/4
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.component.factory.handler;
 17  
 
 18  
 import org.seasar.framework.xml.TagHandlerContext;
 19  
 import org.seasar.uruma.component.LayoutDataInfo;
 20  
 import org.seasar.uruma.component.LayoutInfo;
 21  
 import org.seasar.uruma.component.UIControlComponent;
 22  
 import org.seasar.uruma.component.UIElement;
 23  
 
 24  
 /**
 25  
  * <code>rowData</code>、<code>gridData</code> 要素に対するタグハンドラです。<br />
 26  
  * 
 27  
  * @author y-komori
 28  
  */
 29  
 public class LayoutDataTagHandler extends GenericTagHandler {
 30  
 
 31  
     private static final long serialVersionUID = -3959745141934226850L;
 32  
 
 33  
     /**
 34  
      * {@link LayoutDataTagHandler} を構築します。<br />
 35  
      * 
 36  
      * @param layoutDataInfoClass
 37  
      *            {@link LayoutDataInfo} クラスオブジェクト
 38  
      */
 39  
     public LayoutDataTagHandler(
 40  
             final Class<? extends LayoutDataInfo> layoutDataInfoClass) {
 41  232
         super(layoutDataInfoClass);
 42  232
     }
 43  
 
 44  
     @Override
 45  
     @SuppressWarnings("unchecked")
 46  
     protected void setParent(final UIElement uiElement,
 47  
             final TagHandlerContext context) {
 48  324
         Object parent = context.peek();
 49  324
         if (parent instanceof UIControlComponent) {
 50  176
             UIControlComponent uiControl = (UIControlComponent) parent;
 51  176
             uiControl.setLayoutDataInfo((LayoutDataInfo) uiElement);
 52  176
         } else if (parent instanceof LayoutInfo) {
 53  148
             LayoutInfo<LayoutDataInfo> layoutInfo = LayoutInfo.class
 54  
                     .cast(parent);
 55  148
             layoutInfo.setCommonLayoutDataInfo((LayoutDataInfo) uiElement);
 56  
         }
 57  324
     }
 58  
 }