| org.apache.wicket.markup.html.link.AbstractLink org.apache.wicket.markup.html.link.Link
All known Subclasses: org.apache.wicket.extensions.breadcrumb.BreadCrumbLink, org.apache.wicket.markup.html.ScopedLink, org.apache.wicket.markup.html.navigation.paging.PagingNavigationIncrementLink, org.apache.wicket.ajax.markup.html.AjaxFallbackLink, org.apache.wicket.markup.html.link.PageLink, org.apache.wicket.markup.html.link.DownloadLink, org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByLink, org.apache.wicket.markup.html.navigation.paging.PagingNavigationLink, org.apache.wicket.markup.html.link.ResourceLink, org.apache.wicket.markup.html.link.PopupCloseLink, org.apache.wicket.markup.html.link.StatelessLink, org.apache.wicket.markup.html.link.BookmarkablePageLink,
Link | abstract public class Link extends AbstractLink implements ILinkListener(Code) | | Implementation of a hyperlink component. A link can be used with an anchor
(<a href...) element or any element that supports the onclick javascript
event handler (such as buttons, td elements, etc). When used with an anchor,
a href attribute will be generated. When used with any other element, an
onclick javascript event handler attribute will be generated.
You can use a link like:
add(new Link("myLink")
{
public void onClick(RequestCycle cycle)
{
// do something here...
}
);
and in your HTML file:
<a href="#" wicket:id="myLink">click here</a>
or:
<td wicket:id="myLink">my clickable column</td>
The following snippet shows how to pass a parameter from the Page creating
the Page to the Page responded by the Link.
add(new Link("link", listItem.getModel())
{
public void onClick()
{
MyObject obj = (MyObject)getModelObject();
setResponsePage(new MyPage(obj.getId(), ... ));
}
author: Jonathan Locke author: Eelco Hillenius |
appendAnchor | protected CharSequence appendAnchor(ComponentTag tag, CharSequence url)(Code) | | Appends any anchor to the url if the url is not null and the url does not
already contain an anchor (url.indexOf('#') != -1). This implementation
looks whether an anchor component was set, and if so, it will append the
markup id of that component. That markup id is gotten by either calling
Component.getMarkupId if
Component.getOutputMarkupId returns true, or if the anchor component does not output it's id, this
method will try to retrieve the id from the markup directly. If neither
is found, an
WicketRuntimeException excpeption is thrown. If no
anchor component was set, but the link component is attached to a <a
element, this method will append what is in the href attribute if
there is one, starts with a '#' and has more than one character.
You can override this method, but it means that you have to take care of
whatever is done with any set anchor component yourself. You also have to
manually append the '#' at the right place.
Parameters: tag - The component tag Parameters: url - The url to start with The url, possibly with an anchor appended |
getAnchor | public Component getAnchor()(Code) | | Gets any anchor component.
Any anchor component to jump to, might be null |
getAutoEnable | final public boolean getAutoEnable()(Code) | | Gets whether link should automatically enable/disable based on current
page.
Whether this link should automatically enable/disable based oncurrent page. |
getOnClickScript | protected CharSequence getOnClickScript(CharSequence url)(Code) | | Parameters: url - The url for the link Any onClick JavaScript that should be used |
getPopupSettings | public PopupSettings getPopupSettings()(Code) | | Gets the popup specification. If not-null, a javascript on-click event
handler will be generated that opens a new window using the popup
properties.
the popup specification. |
getStatelessHint | protected boolean getStatelessHint()(Code) | | |
getURL | protected CharSequence getURL()(Code) | | Gets the url to use for this link.
The URL that this link links to |
linksTo | protected boolean linksTo(Page page)(Code) | | Whether this link refers to the given page.
Parameters: page - A page True if this link goes to the given page |
onClick | abstract public void onClick()(Code) | | Called when a link is clicked.
|
onLinkClicked | final public void onLinkClicked()(Code) | | THIS METHOD IS NOT PART OF THE WICKET API. DO NOT ATTEMPT TO OVERRIDE OR
CALL IT.
Called when a link is clicked. The implementation of this method is
currently to simply call onClick(), but this may be augmented in the
future.
See Also: ILinkListener |
setAnchor | public Link setAnchor(Component anchor)(Code) | | Sets an anchor component. An anchor (form
'http://server/app/etc#someAnchor') will be appended to the link so that
after this link executes, it will jump to the provided anchor component's
position. The provided anchor must either have the
Component.getOutputMarkupId flag true, or it must be attached
to a <a tag with a href attribute of more than one character starting
with '#' ('<a href="#someAnchor" ... ').
Parameters: anchor - The anchor this |
setAutoEnable | final public Link setAutoEnable(boolean autoEnable)(Code) | | Sets whether this link should automatically enable/disable based on
current page.
Parameters: autoEnable - whether this link should automatically enable/disable based oncurrent page. This |
setPopupSettings | final public Link setPopupSettings(PopupSettings popupSettings)(Code) | | Sets the popup specification. If not-null, a javascript on-click event
handler will be generated that opens a new window using the popup
properties.
Parameters: popupSettings - the popup specification. This |
|
|