Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Image |
|
| 1.3333333333333333;1.333 |
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 | |
24 | * flow. Image layout is done within the context of normal text layout. | |
25 | * | |
26 | * @author David Solis | |
27 | * @since 3.0 | |
28 | */ | |
29 | ||
30 | 0 | public abstract class Image extends AbstractComponent |
31 | { | |
32 | ||
33 | /** | |
34 | * @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter, | |
35 | * org.apache.tapestry.IRequestCycle) | |
36 | */ | |
37 | ||
38 | protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) | |
39 | { | |
40 | 0 | boolean render = !cycle.isRewinding(); |
41 | ||
42 | 0 | if (render) |
43 | { | |
44 | 0 | writer.beginEmpty("img"); |
45 | ||
46 | 0 | writer.attribute("src", getImage().buildURL()); |
47 | ||
48 | 0 | writer.attribute("alt", getAlt()); |
49 | ||
50 | 0 | renderInformalParameters(writer, cycle); |
51 | ||
52 | 0 | writer.closeTag(); |
53 | } | |
54 | 0 | } |
55 | ||
56 | public abstract IAsset getImage(); | |
57 | ||
58 | public abstract String getAlt(); | |
59 | } |