Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
ILinkComponent |
|
| 1.0;1 |
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.IComponent; |
|
18 | import org.apache.tapestry.IMarkupWriter; |
|
19 | import org.apache.tapestry.IRequestCycle; |
|
20 | import org.apache.tapestry.engine.ILink; |
|
21 | ||
22 | /** |
|
23 | * A component that renders an HTML <a> element. It exposes some |
|
24 | * properties to the components it wraps. This is basically to facilitate the |
|
25 | * {@link org.apache.tapestry.html.Rollover} component. |
|
26 | * |
|
27 | * @author Howard Lewis Ship |
|
28 | */ |
|
29 | ||
30 | public interface ILinkComponent extends IComponent |
|
31 | { |
|
32 | ||
33 | /** |
|
34 | * Returns the desired scheme (i.e., "http" or "https") for the link, or |
|
35 | * null to not output a specific scheme (in which case the URL will fall |
|
36 | * under the incoming request's scheme). |
|
37 | * |
|
38 | * @since 4.0 |
|
39 | */ |
|
40 | ||
41 | String getScheme(); |
|
42 | ||
43 | /** |
|
44 | * Returns the desired port (i.e., "80" or "443") for the link, or null to |
|
45 | * not output a specific port (in which case the URL will fall under the |
|
46 | * incoming request's port). |
|
47 | * |
|
48 | * @since 4.1 |
|
49 | */ |
|
50 | ||
51 | Integer getPort(); |
|
52 | ||
53 | /** |
|
54 | * Returns whether this service link component is enabled or disabled. |
|
55 | * |
|
56 | * @since 0.2.9 |
|
57 | */ |
|
58 | ||
59 | boolean isDisabled(); |
|
60 | ||
61 | /** |
|
62 | * Returns the anchor defined for this link, or null for no anchor. |
|
63 | * |
|
64 | * @since 3.0 |
|
65 | */ |
|
66 | ||
67 | String getAnchor(); |
|
68 | ||
69 | /** |
|
70 | * Returns the name of the target window or frame for this link, or null if |
|
71 | * current window or frame is to be used. |
|
72 | * |
|
73 | * @since 4.0 |
|
74 | */ |
|
75 | String getTarget(); |
|
76 | ||
77 | /** |
|
78 | * Adds a new event handler. When the event occurs, the JavaScript function |
|
79 | * specified is executed. Multiple functions can be specified, in which case |
|
80 | * all of them are executed. |
|
81 | * <p> |
|
82 | * This was created for use by {@link org.apache.tapestry.html.Rollover} to |
|
83 | * set mouse over and mouse out handlers on the {@link ILinkComponent} that |
|
84 | * wraps it, but can be used for many other things as well. |
|
85 | * |
|
86 | * @since 0.2.9 |
|
87 | */ |
|
88 | ||
89 | void addEventHandler(LinkEventType type, String functionName); |
|
90 | ||
91 | /** |
|
92 | * Invoked by the {@link org.apache.tapestry.link.ILinkRenderer} (if the |
|
93 | * link is not disabled) to provide a |
|
94 | * {@link org.apache.tapestry.engine.EngineServiceLink} that the renderer |
|
95 | * can convert into a URL. |
|
96 | */ |
|
97 | ||
98 | ILink getLink(IRequestCycle cycle); |
|
99 | ||
100 | /** |
|
101 | * Invoked (by the {@link org.apache.tapestry.link.ILinkRenderer}) to make |
|
102 | * the link render any additional attributes. These are informal parameters, |
|
103 | * plus any attributes related to events. This is only invoked for |
|
104 | * non-disabled links. |
|
105 | * |
|
106 | * @since 3.0 |
|
107 | */ |
|
108 | ||
109 | void renderAdditionalAttributes(IMarkupWriter writer, |
|
110 | IRequestCycle cycle); |
|
111 | } |