Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To solve this I had to extend a handful of classes. In particular, I needed to override the behavior of org.apache.wicket.markup.html.link.AbstractLink.disableLink(final ComponentTag tag)</p> <p>It's in the disableLink function of AbstractLink that the "a" tag is changed to "span" and the href and onclick attributes are stripped out. I first backtracked to PagingNavigator and extended this as follows:</p> <pre><code>public class DreamPagingNavigator extends PagingNavigator { public DreamPagingNavigator(String id, IPageable pageable) { super(id, pageable); } public DreamPagingNavigator(String id, IPageable pageable, IPagingLabelProvider labelProvider) { super(id, pageable, labelProvider); } @Override protected PagingNavigation newNavigation(final String id, final IPageable pageable, final IPagingLabelProvider labelProvider) { return new DreamPagingNavigation(id, pageable, labelProvider); } @Override protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { return new DreamPagingNavigationIncrementLink&lt;Void&gt;(id, pageable, increment); } @Override protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { return new DreamPagingNavigationLink&lt;Void&gt;(id, pageable, pageNumber); } } </code></pre> <p>For my "Dream" theme, this allowed me to override the newPagingNavigationLink, newPagingNavigationIncrementLink, etc. My implementation for PagingNavigationLink (et. al) then modified the disable behavior, like this:</p> <pre><code>public class DreamPagingNavigationLink&lt;T&gt; extends PagingNavigationLink&lt;T&gt; { public DreamPagingNavigationLink(String id, IPageable pageable, long pageNumber) { super(id, pageable, pageNumber); } @Override protected void disableLink(final ComponentTag tag) { // if the tag is an anchor proper if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase("link") || tag.getName().equalsIgnoreCase("area")) { // Remove any href from the old link tag.remove("href"); tag.remove("onclick"); } // if the tag is a button or input else if ("button".equalsIgnoreCase(tag.getName()) || "input".equalsIgnoreCase(tag.getName())) { tag.put("disabled", "disabled"); } } } </code></pre> <p>Rather than change the "a" tag to a "span", I just strip out the href and onclick attributes.</p> <p>Now I get an anchor tag rendered without an href.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload