|
|||||||||||||||||||
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 | |||||||||||||||
Image.java | 100% | 100% | 100% | 100% |
|
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.wml;
|
|
16 |
|
|
17 |
import org.apache.tapestry.AbstractComponent;
|
|
18 |
import org.apache.tapestry.IAsset;
|
|
19 |
import org.apache.tapestry.IMarkupWriter;
|
|
20 |
import org.apache.tapestry.IRequestCycle;
|
|
21 |
|
|
22 |
/**
|
|
23 |
* The Image component indicates that an image is to be included in the text flow. Image layout is done within the
|
|
24 |
* context of normal text layout.
|
|
25 |
*
|
|
26 |
* @author David Solis
|
|
27 |
* @since 3.0
|
|
28 |
*
|
|
29 |
**/
|
|
30 |
|
|
31 |
public abstract class Image extends AbstractComponent |
|
32 |
{ |
|
33 |
/**
|
|
34 |
* @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
|
|
35 |
**/
|
|
36 |
|
|
37 | 2 |
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) |
38 |
{ |
|
39 | 2 |
boolean render = !cycle.isRewinding();
|
40 |
|
|
41 | 2 |
if (render)
|
42 |
{ |
|
43 | 1 |
writer.beginEmpty("img");
|
44 |
|
|
45 | 1 |
writer.attribute("src", getImage().buildURL(cycle));
|
46 |
|
|
47 | 1 |
writer.attribute("alt", getAlt());
|
48 |
|
|
49 | 1 |
renderInformalParameters(writer, cycle); |
50 |
|
|
51 | 1 |
writer.closeTag(); |
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
public abstract IAsset getImage();
|
|
56 |
|
|
57 |
public abstract String getAlt();
|
|
58 |
} |
|
59 |
|
|