|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
BlockTableRendererSource.java | 0% | 0% | 0% | 0% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
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 |
* @author mindbridge
|
|
30 |
* @since 2.3
|
|
31 |
*/
|
|
32 |
public class BlockTableRendererSource implements ITableRendererSource |
|
33 |
{ |
|
34 |
private ComponentAddress m_objBlockAddress;
|
|
35 |
private ComponentAddress m_objListenerAddress;
|
|
36 |
|
|
37 | 0 |
public BlockTableRendererSource(Block objBlock)
|
38 |
{ |
|
39 | 0 |
this(new ComponentAddress(objBlock)); |
40 |
} |
|
41 |
|
|
42 | 0 |
public BlockTableRendererSource(
|
43 |
Block objBlock, |
|
44 |
ITableRendererListener objListener) |
|
45 |
{ |
|
46 | 0 |
this(new ComponentAddress(objBlock), new ComponentAddress(objListener)); |
47 |
} |
|
48 |
|
|
49 | 0 |
public BlockTableRendererSource(ComponentAddress objBlockAddress)
|
50 |
{ |
|
51 | 0 |
this(objBlockAddress, null); |
52 |
} |
|
53 |
|
|
54 | 0 |
public BlockTableRendererSource(
|
55 |
ComponentAddress objBlockAddress, |
|
56 |
ComponentAddress objListenerAddress) |
|
57 |
{ |
|
58 | 0 |
setBlockAddress(objBlockAddress); |
59 | 0 |
setListenerAddress(objListenerAddress); |
60 |
} |
|
61 |
|
|
62 |
/**
|
|
63 |
* @see org.apache.tapestry.contrib.table.model.ITableRendererSource#getRenderer(IRequestCycle, ITableModelSource, ITableColumn, Object)
|
|
64 |
*/
|
|
65 | 0 |
public IRender getRenderer(
|
66 |
IRequestCycle objCycle, |
|
67 |
ITableModelSource objSource, |
|
68 |
ITableColumn objColumn, |
|
69 |
Object objRow) |
|
70 |
{ |
|
71 | 0 |
ComponentAddress objListenerAddress = getListenerAddress(); |
72 | 0 |
if (objListenerAddress != null) |
73 |
{ |
|
74 | 0 |
ITableRendererListener objListener = |
75 |
(ITableRendererListener) objListenerAddress.findComponent( |
|
76 |
objCycle); |
|
77 | 0 |
objListener.initializeRenderer( |
78 |
objCycle, |
|
79 |
objSource, |
|
80 |
objColumn, |
|
81 |
objRow); |
|
82 |
} |
|
83 |
|
|
84 | 0 |
Block objBlock = (Block) getBlockAddress().findComponent(objCycle); |
85 | 0 |
return new BlockRenderer(objBlock); |
86 |
} |
|
87 |
|
|
88 |
/**
|
|
89 |
* Returns the blockAddress.
|
|
90 |
* @return ComponentAddress
|
|
91 |
*/
|
|
92 | 0 |
public ComponentAddress getBlockAddress()
|
93 |
{ |
|
94 | 0 |
return m_objBlockAddress;
|
95 |
} |
|
96 |
|
|
97 |
/**
|
|
98 |
* Sets the blockAddress.
|
|
99 |
* @param blockAddress The blockAddress to set
|
|
100 |
*/
|
|
101 | 0 |
public void setBlockAddress(ComponentAddress blockAddress) |
102 |
{ |
|
103 | 0 |
m_objBlockAddress = blockAddress; |
104 |
} |
|
105 |
|
|
106 |
/**
|
|
107 |
* Returns the listenerAddress.
|
|
108 |
* @return ComponentAddress
|
|
109 |
*/
|
|
110 | 0 |
public ComponentAddress getListenerAddress()
|
111 |
{ |
|
112 | 0 |
return m_objListenerAddress;
|
113 |
} |
|
114 |
|
|
115 |
/**
|
|
116 |
* Sets the listenerAddress.
|
|
117 |
* @param listenerAddress The listenerAddress to set
|
|
118 |
*/
|
|
119 | 0 |
public void setListenerAddress(ComponentAddress listenerAddress) |
120 |
{ |
|
121 | 0 |
m_objListenerAddress = listenerAddress; |
122 |
} |
|
123 |
|
|
124 |
} |
|
125 |
|
|