View Javadoc

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.base;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.seasar.uruma.component.UIElement;
22  import org.seasar.uruma.component.UIElementContainer;
23  import org.seasar.uruma.component.UIElementVisitor;
24  import org.seasar.uruma.util.AssertionUtil;
25  
26  /**
27   * {@link UIElementContainer} のための基底クラスです。<br />
28   * 
29   * @author y-komori
30   */
31  public class AbstractUIElementContainer extends AbstractUIElement implements
32          UIElementContainer {
33      private List<UIElement> children = new ArrayList<UIElement>();
34  
35      /*
36       * @see org.seasar.uruma.component.UIElementContainer#addChild(org.seasar.uruma.component.UIElement)
37       */
38      public void addChild(final UIElement child) {
39          AssertionUtil.assertNotNull("child", child);
40          this.children.add(child);
41      }
42  
43      /*
44       * @see org.seasar.uruma.component.UIElementContainer#getChildren()
45       */
46      public List<UIElement> getChildren() {
47          return children;
48      }
49  
50      /*
51       * @see org.seasar.uruma.component.base.AbstractUIElement#accept(org.seasar.uruma.component.UIElementVisitor)
52       */
53      @Override
54      public void accept(final UIElementVisitor visitor) {
55          visitor.visit(this);
56      }
57  }