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.jface;
17  
18  import java.util.ArrayList;
19  import java.util.Collections;
20  import java.util.List;
21  
22  import org.eclipse.swt.widgets.TableItem;
23  import org.seasar.uruma.annotation.ComponentAttribute;
24  import org.seasar.uruma.annotation.ComponentElement;
25  import org.seasar.uruma.annotation.FieldDescription;
26  import org.seasar.uruma.annotation.RenderingPolicy;
27  import org.seasar.uruma.annotation.RenderingPolicy.ConversionType;
28  import org.seasar.uruma.annotation.RenderingPolicy.TargetType;
29  import org.seasar.uruma.component.base.AbstractItemComponent;
30  
31  /**
32   * {@link TableItem} を表すコンポーネントです。<br />
33   * 
34   * @author bskuroneko
35   */
36  @ComponentElement
37  public class TableItemComponent extends AbstractItemComponent {
38  
39      private List<TableCellComponent> tableCells = new ArrayList<TableCellComponent>();
40  
41      @RenderingPolicy(conversionType = ConversionType.COLOR)
42      @ComponentAttribute
43      @FieldDescription("背景色")
44      public String background;
45  
46      @RenderingPolicy(conversionType = ConversionType.BOOLEAN)
47      @ComponentAttribute
48      @FieldDescription("チェック状態")
49      public String checked;
50  
51      @RenderingPolicy(targetType = TargetType.NONE)
52      @ComponentAttribute
53      @FieldDescription("フォント高さ")
54      public String fontHeight;
55  
56      @RenderingPolicy(targetType = TargetType.NONE)
57      @ComponentAttribute
58      @FieldDescription("フォント名称")
59      public String fontName;
60  
61      @RenderingPolicy(targetType = TargetType.NONE)
62      @ComponentAttribute
63      @FieldDescription("フォントスタイル")
64      public String fontStyle;
65  
66      @RenderingPolicy(conversionType = ConversionType.COLOR)
67      @ComponentAttribute
68      @FieldDescription("前景色")
69      public String foreground;
70  
71      @RenderingPolicy(conversionType = ConversionType.BOOLEAN)
72      @ComponentAttribute
73      @FieldDescription("グレーアウト状態")
74      public String grayed;
75  
76      @RenderingPolicy(targetType = TargetType.NONE)
77      @ComponentAttribute
78      @FieldDescription("イメージパス")
79      public String image;
80  
81      @RenderingPolicy(targetType = TargetType.NONE)
82      @ComponentAttribute
83      @FieldDescription("テキスト")
84      public String text;
85  
86      /**
87       * テーブルセルを追加します。<br />
88       * 
89       * @param cell
90       *            {@link TableCellComponent} オブジェクト
91       */
92      public void addTableCell(final TableCellComponent cell) {
93          this.tableCells.add(cell);
94      }
95  
96      /**
97       * テーブルセルのリストを取得します。<br />
98       * 
99       * @return テーブルセルのリスト
100      */
101     public List<TableCellComponent> getTableCells() {
102         return Collections.unmodifiableList(tableCells);
103     }
104 }