Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TabItemRenderer |
|
| 0.0;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.renderer.impl; | |
17 | ||
18 | import org.eclipse.swt.widgets.Control; | |
19 | import org.eclipse.swt.widgets.TabItem; | |
20 | import org.seasar.uruma.component.UIComponent; | |
21 | import org.seasar.uruma.component.UIElement; | |
22 | import org.seasar.uruma.component.jface.TabItemComponent; | |
23 | import org.seasar.uruma.context.PartContext; | |
24 | import org.seasar.uruma.context.WidgetHandle; | |
25 | ||
26 | /** | |
27 | * {@link TabItem} のレンダリングを行うクラスです。<br /> | |
28 | * | |
29 | * @author bskuroneko | |
30 | */ | |
31 | 44 | public class TabItemRenderer extends |
32 | AbstractWidgetRenderer<TabItemComponent, TabItem> { | |
33 | ||
34 | /* | |
35 | * @see org.seasar.uruma.renderer.impl.AbstractWidgetRenderer#doRender(org.seasar.uruma.component.UIComponent, | |
36 | * org.eclipse.swt.widgets.Widget) | |
37 | */ | |
38 | @Override | |
39 | protected void doRender(final TabItemComponent controlComponent, | |
40 | final TabItem control) { | |
41 | // Do nothing. | |
42 | 20 | } |
43 | ||
44 | /* | |
45 | * @see org.seasar.uruma.renderer.impl.AbstractWidgetRenderer#doRenderAfter(org.eclipse.swt.widgets.Widget, | |
46 | * org.seasar.uruma.component.UIComponent, | |
47 | * org.seasar.uruma.context.WidgetHandle, | |
48 | * org.seasar.uruma.context.PartContext) | |
49 | */ | |
50 | @Override | |
51 | protected void doRenderAfter(final TabItem widget, | |
52 | final TabItemComponent uiComponent, final WidgetHandle parent, | |
53 | final PartContext context) { | |
54 | 20 | setControl(widget, uiComponent); |
55 | 20 | } |
56 | ||
57 | private void setControl(final TabItem tabItem, | |
58 | final TabItemComponent tabItemComponent) { | |
59 | 20 | UIElement content = tabItemComponent.getChild(); |
60 | 20 | if ((content != null) && (content instanceof UIComponent)) { |
61 | 4 | String id = ((UIComponent) content).getId(); |
62 | 4 | WidgetHandle handle = getContext().getWidgetHandle(id); |
63 | 4 | if (handle.instanceOf(Control.class)) { |
64 | 4 | Control control = handle.<Control> getCastWidget(); |
65 | 4 | tabItem.setControl(control); |
66 | } | |
67 | } | |
68 | 20 | } |
69 | ||
70 | /* | |
71 | * @see org.seasar.uruma.renderer.impl.AbstractWidgetRenderer#getWidgetType() | |
72 | */ | |
73 | @Override | |
74 | protected Class<TabItem> getWidgetType() { | |
75 | 60 | return TabItem.class; |
76 | } | |
77 | } |