|
|||||||||||||||||||
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 | |||||||||||||||
Block.java | - | 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.components;
|
|
16 |
|
|
17 |
import org.apache.tapestry.AbstractComponent;
|
|
18 |
import org.apache.tapestry.IComponent;
|
|
19 |
import org.apache.tapestry.IMarkupWriter;
|
|
20 |
import org.apache.tapestry.IRequestCycle;
|
|
21 |
|
|
22 |
/**
|
|
23 |
* Prevents its contents from being rendered until triggered by
|
|
24 |
* an {@link RenderBlock} component.
|
|
25 |
*
|
|
26 |
* [<a href="../../../../../ComponentReference/Block.html">Component Reference</a>]
|
|
27 |
*
|
|
28 |
* <p>Block and {@link RenderBlock} are used to build a certain class
|
|
29 |
* of complicated component that can't be assembled using the normal
|
|
30 |
* wrapping containment. Such a super component would have two or more
|
|
31 |
* sections that need to be supplied by the containing page (or component).
|
|
32 |
*
|
|
33 |
* <p>Using Blocks, the blocks can be provided as parameters to the super
|
|
34 |
* component.
|
|
35 |
*
|
|
36 |
* <p>The inserter property gives the components inside the block access to
|
|
37 |
* the component (typically an {@link RenderBlock}) that inserted the block,
|
|
38 |
* including access to its informal bindings which allows components contained
|
|
39 |
* by the Block to be passed parameters. Note - it is the responsibility of the
|
|
40 |
* inserting component to set itself as the Block's inserter.
|
|
41 |
*
|
|
42 |
* @author Howard Lewis Ship
|
|
43 |
* @since 0.2.9
|
|
44 |
*
|
|
45 |
**/
|
|
46 |
|
|
47 |
public abstract class Block extends AbstractComponent |
|
48 |
{ |
|
49 |
private IComponent _inserter;
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Does nothing; the idea of a Block is to defer the rendering of
|
|
53 |
* the body of the block until an {@link RenderBlock} forces it
|
|
54 |
* out.
|
|
55 |
*
|
|
56 |
**/
|
|
57 |
|
|
58 | 0 |
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) |
59 |
{ |
|
60 |
// Nothing!
|
|
61 |
} |
|
62 |
|
|
63 | 0 |
public IComponent getInserter()
|
64 |
{ |
|
65 | 0 |
return _inserter;
|
66 |
} |
|
67 |
|
|
68 | 0 |
public void setInserter(IComponent value) |
69 |
{ |
|
70 | 0 |
_inserter = value; |
71 |
} |
|
72 |
} |
|