1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.uruma.renderer.impl; |
17 | |
|
18 | |
import java.util.List; |
19 | |
|
20 | |
import org.eclipse.swt.widgets.Control; |
21 | |
import org.eclipse.swt.widgets.CoolItem; |
22 | |
import org.seasar.uruma.component.UIComponent; |
23 | |
import org.seasar.uruma.component.UIElement; |
24 | |
import org.seasar.uruma.component.jface.CoolItemComponent; |
25 | |
import org.seasar.uruma.context.PartContext; |
26 | |
import org.seasar.uruma.context.WidgetHandle; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 52 | public class CoolItemRenderer extends |
34 | |
AbstractWidgetRenderer<CoolItemComponent, CoolItem> { |
35 | |
|
36 | |
@Override |
37 | |
protected void doRender(final CoolItemComponent coolItemComponent, |
38 | |
final CoolItem control) { |
39 | 24 | } |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Override |
48 | |
protected void doRenderAfter(final CoolItem widget, |
49 | |
final CoolItemComponent uiComponent, final WidgetHandle parent, |
50 | |
final PartContext context) { |
51 | 24 | setControl(widget, uiComponent); |
52 | 24 | } |
53 | |
|
54 | |
private void setControl(final CoolItem coolItem, |
55 | |
final CoolItemComponent coolItemComponent) { |
56 | 24 | List<UIElement> children = coolItemComponent.getChildren(); |
57 | |
|
58 | 24 | for (UIElement child : children) { |
59 | 24 | if (child instanceof UIComponent) { |
60 | 24 | String id = ((UIComponent) child).getId(); |
61 | 24 | WidgetHandle handle = getContext().getWidgetHandle(id); |
62 | 24 | coolItem.setControl((Control) handle.getWidget()); |
63 | |
|
64 | 24 | break; |
65 | |
} |
66 | |
} |
67 | 24 | } |
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
@Override |
73 | |
protected Class<CoolItem> getWidgetType() { |
74 | 72 | return CoolItem.class; |
75 | |
} |
76 | |
} |