|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ActionLink.java | 50% | 66.7% | 100% | 70% |
|
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.link; | |
16 | ||
17 | import org.apache.tapestry.IAction; | |
18 | import org.apache.tapestry.IActionListener; | |
19 | import org.apache.tapestry.IRequestCycle; | |
20 | import org.apache.tapestry.RenderRewoundException; | |
21 | import org.apache.tapestry.Tapestry; | |
22 | import org.apache.tapestry.engine.ActionServiceParameter; | |
23 | import org.apache.tapestry.engine.ILink; | |
24 | import org.apache.tapestry.listener.ListenerInvoker; | |
25 | ||
26 | /** | |
27 | * A component for creating a link that is handled using the action service. [ <a | |
28 | * href="../../../../../ComponentReference/ActionLink.html">Component Reference </a>] | |
29 | * | |
30 | * @author Howard Lewis Ship | |
31 | * @deprecated To be removed in 4.1 | |
32 | */ | |
33 | ||
34 | public abstract class ActionLink extends AbstractLinkComponent implements IAction | |
35 | { | |
36 | public abstract boolean isStateful(); | |
37 | ||
38 | /** | |
39 | * Returns true if the stateful parameter is bound to a true value. If stateful is not bound, | |
40 | * also returns the default, true. | |
41 | * <p> | |
42 | * Note that this method can be called when the component is not rendering, therefore it must | |
43 | * directly access the {@link IBinding}for the stateful parameter. | |
44 | */ | |
45 | ||
46 | 2 | public boolean getRequiresSession() |
47 | { | |
48 | 2 | return isStateful(); |
49 | } | |
50 | ||
51 | 2 | public ILink getLink(IRequestCycle cycle) |
52 | { | |
53 | 2 | String actionId = cycle.getNextActionId(); |
54 | ||
55 | 2 | if (cycle.isRewound(this)) |
56 | { | |
57 | 0 | getListenerInvoker().invokeListener(getListener(), this, cycle); |
58 | ||
59 | 0 | throw new RenderRewoundException(this); |
60 | } | |
61 | ||
62 | 2 | return getLink(cycle, Tapestry.ACTION_SERVICE, new ActionServiceParameter(this, actionId)); |
63 | } | |
64 | ||
65 | public abstract IActionListener getListener(); | |
66 | ||
67 | public abstract ListenerInvoker getListenerInvoker(); | |
68 | } |
|