net.sf.click.control
Class PageLink

java.lang.Object
  extended bynet.sf.click.control.AbstractControl
      extended bynet.sf.click.control.AbstractLink
          extended bynet.sf.click.control.PageLink
All Implemented Interfaces:
Control, Serializable

public class PageLink
extends AbstractLink

Provides a Page Link control:   <a href="" ></a>.

Page Link
The PageLink control is used to create links to other pages in your application. See also the W3C HTML reference: A Links

Author:
Malcolm Edgar
See Also:
AbstractLink, ActionLink, Serialized Form

Field Summary
protected  Class pageClass
          The target page class.
 
Fields inherited from class net.sf.click.control.AbstractLink
disabled, imageSrc, label, parameters, tabindex, title
 
Fields inherited from class net.sf.click.control.AbstractControl
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface net.sf.click.Control
CONTROL_MESSAGES
 
Constructor Summary
PageLink()
          Create an PageLink with no name defined.
PageLink(Class targetPage)
          Create an PageLink for the given target Page class.
PageLink(String name)
          Create an PageLink for the given name.
PageLink(String name, Class targetPage)
          Create an PageLink for the given name and target Page class.
PageLink(String name, String label, Class targetPage)
          Create an PageLink for the given name, label and target Page class.
 
Method Summary
 String getHref()
          Return the PageLink anchor <a> tag href attribute.
 Class getPageClass()
          Return the target Page class.
 boolean onProcess()
          This method will return true.
 void setListener(Object listener, String method)
          This method does nothing.
 void setPageClass(Class targetPage)
          Set the target Page class.
 
Methods inherited from class net.sf.click.control.AbstractLink
getHtmlImports, getId, getImageSrc, getLabel, getParameter, getParameters, getTabIndex, getTag, getTitle, hasParameters, isDisabled, render, setDisabled, setImageSrc, setLabel, setParameter, setTabIndex, setTitle
 
Methods inherited from class net.sf.click.control.AbstractControl
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getControlSizeEst, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, onInit, onRender, registerActionEvent, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setName, setParent, setStyle, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pageClass

protected Class pageClass
The target page class.

Constructor Detail

PageLink

public PageLink(String name)
Create an PageLink for the given name.

Parameters:
name - the page link name
Throws:
IllegalArgumentException - if the name is null

PageLink

public PageLink(String name,
                Class targetPage)
Create an PageLink for the given name and target Page class.

Parameters:
name - the page link name
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageLink

public PageLink(String name,
                String label,
                Class targetPage)
Create an PageLink for the given name, label and target Page class.

Parameters:
name - the page link name
label - the page link label
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageLink

public PageLink(Class targetPage)
Create an PageLink for the given target Page class.

Parameters:
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageLink

public PageLink()
Create an PageLink with no name defined.

Please note the control's name and target pageClass must be defined before it is valid.

Method Detail

getHref

public String getHref()
Return the PageLink anchor <a> tag href attribute. This method will encode the URL with the session ID if required using HttpServletResponse.encodeURL().

Specified by:
getHref in class AbstractLink
Returns:
the PageLink HTML href attribute

setListener

public void setListener(Object listener,
                        String method)
This method does nothing.

Specified by:
setListener in interface Control
Overrides:
setListener in class AbstractControl
Parameters:
listener - the listener object with the named method to invoke
method - the name of the method to invoke
See Also:
Control.setListener(Object, String)

getPageClass

public Class getPageClass()
Return the target Page class.

Returns:
the target Page class

setPageClass

public void setPageClass(Class targetPage)
Set the target Page class. The page link href URL attribute will be to the path of the target page.

Parameters:
targetPage - the target Page class

onProcess

public boolean onProcess()
This method will return true.

Specified by:
onProcess in interface Control
Overrides:
onProcess in class AbstractControl
Returns:
true
See Also:
Control.onProcess()