All Implemented Interfaces:
IBootstrapButton<BootstrapLink<T>>, Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IGenericComponent<T,Link<T>>, IMetadataContext<Serializable,Component>, IRequestListener, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public abstract class BootstrapLink<T> extends Link<T> implements IBootstrapButton<BootstrapLink<T>>
Default Link which is styled by bootstrap.

You can use a link like:

 add(new BootstrapLink("myLink")
 {
     public void onClick()
     {
         // do something here...
     }
 );
 

and in your HTML file:

  <a href="#" wicket:id="myLink">click here</a>
 

The following snippet shows how to pass a parameter from the Page creating the Page to the Page responded by the Link.

 add(new BootstrapLink<MyObject>("link", listItem.getModel(), Type.Primary )
 {
     public void onClick()
     {
         MyObject obj = getModelObject();
         setResponsePage(new MyPage(obj));
     }
 
Author:
miha
See Also:
  • Constructor Details

    • BootstrapLink

      public BootstrapLink(String id, IModel<T> model)
      Construct.
      Parameters:
      id - the components id
      model - mandatory parameter
    • BootstrapLink

      public BootstrapLink(String id, Buttons.Type type)
      Construct.
      Parameters:
      id - the components id
      type - the type of the button
    • BootstrapLink

      public BootstrapLink(String id, IModel<T> model, Buttons.Type type)
      Construct.
      Parameters:
      id - The component id
      model - mandatory parameter
      type - the type of the button
  • Method Details

    • onInitialize

      protected void onInitialize()
      Overrides:
      onInitialize in class MarkupContainer
    • newIcon

      protected Icon newIcon(String markupId)
      creates a new icon component
      Parameters:
      markupId - the component id of the icon
      Returns:
      new icon component
    • newLabel

      protected Component newLabel(String markupId)
      creates a new label component
      Parameters:
      markupId - the component id of the label
      Returns:
      new label component
    • newSplitter

      protected Component newSplitter(String markupId)
      creates a new splitter component. The splitter is visible only if icon is visible and useSplitter is true.
      Parameters:
      markupId - the component id of the splitter
      Returns:
      new splitter component
    • newMarkupSourcingStrategy

      protected final IMarkupSourcingStrategy newMarkupSourcingStrategy()
      Overrides:
      newMarkupSourcingStrategy in class Component
    • onConfigure

      protected void onConfigure()
      Overrides:
      onConfigure in class Component
    • setLabel

      public BootstrapLink<T> setLabel(IModel<?> label)
      sets the label of the button.
      Parameters:
      label - the new button label
      Returns:
      reference to the current instance
    • setIconType

      public BootstrapLink<T> setIconType(IconType iconType)
      sets the button's icon which will be rendered in front of the label.
      Parameters:
      iconType - the new button icon type
      Returns:
      reference to the current instance
    • setSize

      public BootstrapLink<T> setSize(Buttons.Size size)
      sets the size of the button
      Specified by:
      setSize in interface IBootstrapButton<T>
      Parameters:
      size - The button size
      Returns:
      this instance for chaining
    • setType

      public BootstrapLink<T> setType(Buttons.Type type)
      Sets the type of the button
      Specified by:
      setType in interface IBootstrapButton<T>
      Parameters:
      type - The type of the button
      Returns:
      this instance for chaining
    • useSplitter

      public BootstrapLink<T> useSplitter(boolean value)
      Parameters:
      value - whether to use splitter between the icon and the label or not
      Returns:
      this instance for chaining