1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.contrib.table.model.common; |
16 |
| |
17 |
| import org.apache.tapestry.IRender; |
18 |
| import org.apache.tapestry.IRequestCycle; |
19 |
| import org.apache.tapestry.components.Block; |
20 |
| import org.apache.tapestry.components.BlockRenderer; |
21 |
| import org.apache.tapestry.contrib.table.model.ITableColumn; |
22 |
| import org.apache.tapestry.contrib.table.model.ITableModelSource; |
23 |
| import org.apache.tapestry.contrib.table.model.ITableRendererListener; |
24 |
| import org.apache.tapestry.contrib.table.model.ITableRendererSource; |
25 |
| import org.apache.tapestry.util.ComponentAddress; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| public class BlockTableRendererSource implements ITableRendererSource |
33 |
| { |
34 |
| private static final long serialVersionUID = 1L; |
35 |
| |
36 |
| private ComponentAddress m_objBlockAddress; |
37 |
| private ComponentAddress m_objListenerAddress; |
38 |
| |
39 |
0
| public BlockTableRendererSource(Block objBlock)
|
40 |
| { |
41 |
0
| this(new ComponentAddress(objBlock));
|
42 |
| } |
43 |
| |
44 |
0
| public BlockTableRendererSource(
|
45 |
| Block objBlock, |
46 |
| ITableRendererListener objListener) |
47 |
| { |
48 |
0
| this(new ComponentAddress(objBlock), new ComponentAddress(objListener));
|
49 |
| } |
50 |
| |
51 |
0
| public BlockTableRendererSource(ComponentAddress objBlockAddress)
|
52 |
| { |
53 |
0
| this(objBlockAddress, null);
|
54 |
| } |
55 |
| |
56 |
0
| public BlockTableRendererSource(
|
57 |
| ComponentAddress objBlockAddress, |
58 |
| ComponentAddress objListenerAddress) |
59 |
| { |
60 |
0
| setBlockAddress(objBlockAddress);
|
61 |
0
| setListenerAddress(objListenerAddress);
|
62 |
| } |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
0
| public IRender getRenderer(
|
68 |
| IRequestCycle objCycle, |
69 |
| ITableModelSource objSource, |
70 |
| ITableColumn objColumn, |
71 |
| Object objRow) |
72 |
| { |
73 |
0
| ComponentAddress objListenerAddress = getListenerAddress();
|
74 |
0
| if (objListenerAddress != null)
|
75 |
| { |
76 |
0
| ITableRendererListener objListener =
|
77 |
| (ITableRendererListener) objListenerAddress.findComponent( |
78 |
| objCycle); |
79 |
0
| objListener.initializeRenderer(
|
80 |
| objCycle, |
81 |
| objSource, |
82 |
| objColumn, |
83 |
| objRow); |
84 |
| } |
85 |
| |
86 |
0
| Block objBlock = (Block) getBlockAddress().findComponent(objCycle);
|
87 |
0
| return new BlockRenderer(objBlock);
|
88 |
| } |
89 |
| |
90 |
| |
91 |
| |
92 |
| |
93 |
| |
94 |
0
| public ComponentAddress getBlockAddress()
|
95 |
| { |
96 |
0
| return m_objBlockAddress;
|
97 |
| } |
98 |
| |
99 |
| |
100 |
| |
101 |
| |
102 |
| |
103 |
0
| public void setBlockAddress(ComponentAddress blockAddress)
|
104 |
| { |
105 |
0
| m_objBlockAddress = blockAddress;
|
106 |
| } |
107 |
| |
108 |
| |
109 |
| |
110 |
| |
111 |
| |
112 |
0
| public ComponentAddress getListenerAddress()
|
113 |
| { |
114 |
0
| return m_objListenerAddress;
|
115 |
| } |
116 |
| |
117 |
| |
118 |
| |
119 |
| |
120 |
| |
121 |
0
| public void setListenerAddress(ComponentAddress listenerAddress)
|
122 |
| { |
123 |
0
| m_objListenerAddress = listenerAddress;
|
124 |
| } |
125 |
| |
126 |
| } |