Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5 M1, 1.4.2
    • Fix Version/s: 1.5 M2
    • Component/s: extras
    • Labels:
      None

      Description

      Please include in Click the PageLinkButton Control discussed in this thread:
      http://www.nabble.com/-Control-Wishlist--LinkButton.-td17274531.html

      The advantages of this new Control(over the actual solution for the needed use cases) are mentioned in the posts of the above thread, and the proposed implementation seems to work with click 1.4.2

      Thank you,

      Demetrios.

      P.S. Proposed implementation of PageLinkButton.java:
      -----------------------------------
      package net.sf.click.extras.control;

      import net.sf.click.control.PageLink;
      import net.sf.click.util.HtmlStringBuffer;

      /**

      • PageLink rendered as push button.
        *
        */
        public class PageLinkButton extends PageLink {
        public PageLinkButton(String name) { super(name); }

      public PageLinkButton(String name, Class targetPage)

      { super(name, targetPage); }

      public PageLinkButton(String name, String label, Class targetPage)

      { super(name, label, targetPage); }

      public PageLinkButton(Class targetPage)

      { super(targetPage); }

      public PageLinkButton() {
      }

      /**

      • Return a HTML rendered Button string. Note the button label is rendered
      • as the HTML "value" attribute.
        *
      • @see Object#toString()
        *
      • @return a HTML rendered Button string
        */
        public String toString() {
        HtmlStringBuffer buffer = new HtmlStringBuffer(40);

      buffer.elementStart("input");

      buffer.appendAttribute("type", "button");
      buffer.appendAttribute("name", getName());
      buffer.appendAttribute("id", getId());
      buffer.appendAttribute("value", getLabel());
      buffer.appendAttribute("title", getTitle());
      if (getTabIndex() > 0)

      { buffer.appendAttribute("tabindex", getTabIndex()); }

      String onClickAction = " onclick=\"" + getOnClick() + "\"";
      buffer.append(onClickAction);

      appendAttributes(buffer);

      if (isDisabled())

      { buffer.appendAttributeDisabled(); }

      buffer.elementEnd();

      return buffer.toString();
      }
      /**

      • Return the Button anchor <a> tag href attribute value.
        *
      • @return the Button anchor <a> tag HTML href attribute value
        */
        public String getOnClick() { return "javascript:document.location.href='" + getHref() + "';"; }

        }
        -------------------------------

        Activity

        Hide
        amohombe Ahmed Mohombe added a comment -

        This new control is in SVN now (but only for click 1.5.2 because the 1.4.x is a bugfix only branch).

        Also I added to the javadocs the "advantages" of this control over other approaches (taken form the mentioned discussion thread).

        Show
        amohombe Ahmed Mohombe added a comment - This new control is in SVN now (but only for click 1.5.2 because the 1.4.x is a bugfix only branch). Also I added to the javadocs the "advantages" of this control over other approaches (taken form the mentioned discussion thread).

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            dkyriakis Demetrios Kyriakis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development