net.dontdrinkandroot.wicket.bootstrap.component.button

## Class ButtonLink<T>

- java.lang.Object
- - org.apache.wicket.Component
  - - org.apache.wicket.MarkupContainer
    - - org.apache.wicket.markup.html.WebMarkupContainer
      - - net.dontdrinkandroot.wicket.component.TypedWebMarkupContainer<T>
        - - net.dontdrinkandroot.wicket.bootstrap.component.button.AbstractButtonLink<T>
          - - net.dontdrinkandroot.wicket.bootstrap.component.button.ButtonLink<T>

All Implemented Interfaces:
  Serializable, Iterable<org.apache.wicket.Component>, IButton, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IConverterLocator, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.markup.html.link.ILinkListener, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, org.apache.wicket.util.io.IClusterable

    public abstract class ButtonLink<T>
    extends AbstractButtonLink<T>
    implements org.apache.wicket.markup.html.link.ILinkListener

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.wicket.Component

`ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER`

### Fields inherited from interface org.apache.wicket.markup.html.link.ILinkListener

`INTERFACE`

### Constructor Summary

Constructors
Constructor and Description
`ButtonLink(String id)`
`ButtonLink(String id, org.apache.wicket.model.IModel<T> model)`
`ButtonLink(String id, org.apache.wicket.model.IModel<T> model, org.apache.wicket.model.IModel<String> labelModel)`
`ButtonLink(String id, String label)`

### Method Summary

Methods
`protected CharSequence` `appendAnchor(org.apache.wicket.markup.ComponentTag tag, CharSequence url)` Appends any anchor to the url if the url is not null and the url does not already contain an anchor (url.indexOf('#') != -1).
`org.apache.wicket.Component` `getAnchor()` Gets any anchor component.
`boolean` `getAutoEnable()` Gets whether link should automatically enable/disable based on current page.
`protected CharSequence` `getOnClickScript(CharSequence url)`
`org.apache.wicket.markup.html.link.PopupSettings` `getPopupSettings()` Gets the popup specification.
`protected boolean` `getStatelessHint()`
`protected CharSequence` `getURL()` Gets the url to use for this link.
`boolean` `isEnabled()`
`protected boolean` `linksTo(org.apache.wicket.Page page)` Whether this link refers to the given page.
`abstract void` `onClick()` Called when a link is clicked.
`protected void` `onComponentTag(org.apache.wicket.markup.ComponentTag tag)` Handles this link's tag.
`void` `onLinkClicked()` THIS METHOD IS NOT PART OF THE WICKET API.
`ButtonLink<T>` `setAnchor(org.apache.wicket.Component anchor)` Sets an anchor component.
`ButtonLink<T>` `setAutoEnable(boolean autoEnable)` Sets whether this link should automatically enable/disable based on current page.
`ButtonLink<T>` `setPopupSettings(org.apache.wicket.markup.html.link.PopupSettings popupSettings)` Sets the popup specification.

### Methods inherited from class net.dontdrinkandroot.wicket.bootstrap.component.button.AbstractButtonLink

`disableLink, getButtonSize, getButtonSizeModel, getButtonStyle, getButtonStyleModel, isLinkEnabled, onComponentTagBody, onInitialize, setButtonSize, setButtonStyle, setLabelModel`

### Methods inherited from class net.dontdrinkandroot.wicket.component.TypedWebMarkupContainer

`getModel, getModelObject, setModel, setModelObject`

### Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer

`getWebPage, getWebRequest, getWebResponse, getWebSession`

### Methods inherited from class org.apache.wicket.MarkupContainer

`add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren`

### Methods inherited from class org.apache.wicket.Component

`add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onDetach, onEvent, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### ButtonLink

    public ButtonLink(String id)

#### ButtonLink

    public ButtonLink(String id,
              org.apache.wicket.model.IModel<T> model)

#### ButtonLink

    public ButtonLink(String id,
              String label)

#### ButtonLink

    public ButtonLink(String id,
              org.apache.wicket.model.IModel<T> model,
              org.apache.wicket.model.IModel<String> labelModel)

### Method Detail

#### getAnchor

    public org.apache.wicket.Component getAnchor()

Gets any anchor component.

Returns:
  Any anchor component to jump to, might be null

#### getAutoEnable

    public final boolean getAutoEnable()

Gets whether link should automatically enable/disable based on current page.

Returns:
  Whether this link should automatically enable/disable based on current page.

#### getPopupSettings

    public final org.apache.wicket.markup.html.link.PopupSettings getPopupSettings()

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.

Returns:
  the popup specification.

#### isEnabled

    public boolean isEnabled()

Overrides:
  `isEnabled` in class `org.apache.wicket.Component`
See Also:
  `Component.isEnabled()`

#### getStatelessHint

    protected boolean getStatelessHint()

Overrides:
  `getStatelessHint` in class `org.apache.wicket.Component`
See Also:
  `Component.getStatelessHint()`

#### onClick

    public abstract void onClick()

Called when a link is clicked.

#### onLinkClicked

    public final void onLinkClicked()

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.

Specified by:
  `onLinkClicked` in interface `org.apache.wicket.markup.html.link.ILinkListener`
See Also:
  `ILinkListener`

#### setAnchor

    public ButtonLink<T> setAnchor(org.apache.wicket.Component anchor)

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
Returns:
  this

#### setAutoEnable

    public final ButtonLink<T> setAutoEnable(boolean autoEnable)

Sets whether this link should automatically enable/disable based on current page.

Parameters:
  `autoEnable` - whether this link should automatically enable/disable based on current page.
Returns:
  This

#### setPopupSettings

    public final ButtonLink<T> setPopupSettings(org.apache.wicket.markup.html.link.PopupSettings popupSettings)

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.
Returns:
  This

#### appendAnchor

    protected CharSequence appendAnchor(org.apache.wicket.markup.ComponentTag tag,
                            CharSequence url)

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 `exception` 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
  `url` - The url to start with
Returns:
  The url, possibly with an anchor appended

#### getOnClickScript

    protected CharSequence getOnClickScript(CharSequence url)

Parameters:
  `url` - The url for the link
Returns:
  Any onClick JavaScript that should be used

#### getURL

    protected CharSequence getURL()

Gets the url to use for this link.

Returns:
  The URL that this link links to

#### linksTo

    protected boolean linksTo(org.apache.wicket.Page page)

Whether this link refers to the given page.

Parameters:
  `page` - A page
Returns:
  True if this link goes to the given page

#### onComponentTag

    protected void onComponentTag(org.apache.wicket.markup.ComponentTag tag)

Handles this link's tag. OVERRIDES MUST CALL SUPER.

Overrides:
  `onComponentTag` in class `AbstractButtonLink<T>`
Parameters:
  `tag` - the component tag
See Also:
  `Component.onComponentTag(ComponentTag)`