1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.uruma.renderer.layout; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.eclipse.swt.layout.FillLayout; |
22 | |
import org.eclipse.swt.layout.GridData; |
23 | |
import org.eclipse.swt.layout.GridLayout; |
24 | |
import org.eclipse.swt.layout.RowData; |
25 | |
import org.eclipse.swt.layout.RowLayout; |
26 | |
import org.seasar.uruma.component.LayoutInfo; |
27 | |
import org.seasar.uruma.component.jface.FillLayoutInfo; |
28 | |
import org.seasar.uruma.component.jface.GridLayoutInfo; |
29 | |
import org.seasar.uruma.component.jface.RowLayoutInfo; |
30 | |
import org.seasar.uruma.renderer.layout.impl.GenericLayoutSupport; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class LayoutSupportFactory { |
38 | 4 | private static final Map<Class<? extends LayoutInfo<?>>, LayoutSupport> LAYOUT_SUPPORT_MAP = new HashMap<Class<? extends LayoutInfo<?>>, LayoutSupport>(); |
39 | |
|
40 | |
static { |
41 | 4 | addLayoutSupport(FillLayoutInfo.class, new GenericLayoutSupport( |
42 | |
FillLayout.class, null)); |
43 | 4 | addLayoutSupport(RowLayoutInfo.class, new GenericLayoutSupport( |
44 | |
RowLayout.class, RowData.class)); |
45 | 4 | addLayoutSupport(GridLayoutInfo.class, new GenericLayoutSupport( |
46 | |
GridLayout.class, GridData.class)); |
47 | 4 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public static LayoutSupport getLayoutSupport( |
57 | |
final Class<? extends LayoutInfo<?>> layoutInfo) { |
58 | 1456 | return LAYOUT_SUPPORT_MAP.get(layoutInfo); |
59 | |
} |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
public static void addLayoutSupport( |
68 | |
final Class<? extends LayoutInfo<?>> layoutInfo, |
69 | |
final LayoutSupport layoutSupport) { |
70 | 12 | LAYOUT_SUPPORT_MAP.put(layoutInfo, layoutSupport); |
71 | 12 | } |
72 | |
} |