Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
Timer |
|
| 1.6666666666666667;1.667 |
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.hivemind.HiveMind; |
|
18 | import org.apache.tapestry.AbstractComponent; |
|
19 | import org.apache.tapestry.IMarkupWriter; |
|
20 | import org.apache.tapestry.IRequestCycle; |
|
21 | ||
22 | /** |
|
23 | * The Timer element declares a card timer, which exposes a means of processing |
|
24 | * inactivity or idle time. The timer is initialised and started at card entry |
|
25 | * and is stopped when the card is exited. |
|
26 | * |
|
27 | * @author David Solis |
|
28 | * @since 3.0 |
|
29 | */ |
|
30 | ||
31 | 0 | public abstract class Timer extends AbstractComponent |
32 | { |
|
33 | ||
34 | /** |
|
35 | * @see AbstractComponent#renderComponent(IMarkupWriter, 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("timer"); |
45 | ||
46 | 0 | writer.attribute("name", getName()); |
47 | ||
48 | 0 | String value = getValue(); |
49 | 0 | if (HiveMind.isNonBlank(value)) |
50 | 0 | writer.attribute("value", value); |
51 | 0 | else writer.attribute("value", "0"); |
52 | ||
53 | 0 | renderInformalParameters(writer, cycle); |
54 | ||
55 | 0 | writer.closeTag(); |
56 | } |
|
57 | 0 | } |
58 | ||
59 | public abstract String getName(); |
|
60 | ||
61 | /** @since 4.0 */ |
|
62 | ||
63 | public abstract String getValue(); |
|
64 | } |