Coverage Report - org.apache.tapestry.components.ILinkComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
ILinkComponent
N/A
N/A
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  
      * @return The scheme portion of the url to be generated. 
 39  
      * @since 4.0
 40  
      */
 41  
 
 42  
     String getScheme();
 43  
 
 44  
     /**
 45  
      * Returns the desired port (i.e., "80" or "443") for the link, or null to
 46  
      * not output a specific port (in which case the URL will fall under the
 47  
      * incoming request's port).
 48  
      *
 49  
      * @return The http port to use.
 50  
      * @since 4.1
 51  
      */
 52  
 
 53  
     Integer getPort();
 54  
 
 55  
     /**
 56  
      * Returns whether this service link component is enabled or disabled.
 57  
      *
 58  
      * @return True if disabled, false otherwise.
 59  
      * @since 0.2.9
 60  
      */
 61  
 
 62  
     boolean isDisabled();
 63  
 
 64  
     /**
 65  
      * Returns the anchor defined for this link, or null for no anchor.
 66  
      *
 67  
      * @return The <code>#anchorid</code> portion of the url to be generated - if any.
 68  
      * @since 3.0
 69  
      */
 70  
 
 71  
     String getAnchor();
 72  
 
 73  
     /**
 74  
      * Returns the name of the target window or frame for this link, or null if
 75  
      * current window or frame is to be used.
 76  
      *
 77  
      * @return The <code>target="_this"</code> portion of the link to be generated - if any.
 78  
      * @since 4.0
 79  
      */
 80  
     String getTarget();
 81  
 
 82  
     /**
 83  
      * Adds a new event handler. When the event occurs, the JavaScript function
 84  
      * specified is executed. Multiple functions can be specified, in which case
 85  
      * all of them are executed.
 86  
      * <p>
 87  
      * This was created for use by {@link org.apache.tapestry.html.Rollover} to
 88  
      * set mouse over and mouse out handlers on the {@link ILinkComponent} that
 89  
      * wraps it, but can be used for many other things as well.
 90  
      *
 91  
      * @param type
 92  
      *          The type of event to add.
 93  
      * @param functionName
 94  
      *          The name of the client side javascript function to generate.
 95  
      *
 96  
      * @since 0.2.9
 97  
      * @deprecated To be removed in Tapestry 4.1.4. 
 98  
      */
 99  
 
 100  
     void addEventHandler(LinkEventType type, String functionName);
 101  
 
 102  
     /**
 103  
      * Invoked by the {@link org.apache.tapestry.link.ILinkRenderer} (if the
 104  
      * link is not disabled) to provide a
 105  
      * {@link org.apache.tapestry.engine.EngineServiceLink} that the renderer
 106  
      * can convert into a URL.
 107  
      *
 108  
      * @param cycle
 109  
      *          The current request.
 110  
      * @return A {@link ILink} instance representing the link information for this component.
 111  
      */
 112  
 
 113  
     ILink getLink(IRequestCycle cycle);
 114  
 
 115  
     /**
 116  
      * Invoked (by the {@link org.apache.tapestry.link.ILinkRenderer}) to make
 117  
      * the link render any additional attributes. These are informal parameters,
 118  
      * plus any attributes related to events. This is only invoked for
 119  
      * non-disabled links.
 120  
      *
 121  
      * @param writer
 122  
      *          Markup writer to write content to.
 123  
      * @param cycle
 124  
      *          The current request.
 125  
      * @since 3.0
 126  
      */
 127  
 
 128  
     void renderAdditionalAttributes(IMarkupWriter writer, IRequestCycle cycle);
 129  
 }