Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1499

AjaxEditableMultiLineLabel + race condition /

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.3
    • 1.3.4, 1.4-M1
    • wicket-extensions
    • None

    Description

      There are two issues concerning AjaxEditableMultiLineLabel:

      a) Race condition cancel editing

      Using 'Esc' to cancel editing might lead to two events to be fired: first onKeypress is executed - which leads to bluring the component in Opera. This results in the onblur-event firing and the input is submitted!

      Changing the code in onComponentTag to

      protected void onComponentTag(ComponentTag tag)
      {
      super.onComponentTag(tag);
      final String saveCall = "

      {wicketAjaxGet('" + getCallbackUrl() + "&save=true&'+this.name+'='+wicketEncode(this.value)); return false;}

      ";

      final String cancelCall = "

      {wicketAjaxGet('" + getCallbackUrl() + "&save=false'); this.onblur=''; return false;}

      ";

      final String keypress = "var kc=wicketKeyCode(event); if (kc==27) " + cancelCall +
      "; ";

      tag.put("onblur", saveCall);
      tag.put("onkeypress", keypress);
      }

      stops onblur being fired.

      This might also apply for AjaxEditableLabel - though I haven't seen this happening there yet.

      b) Displaying defaultNullLabel on empty String Model:

      Should behave like AjaxEditableLabel, i.e.:

      protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
      {
      Object modelObject = getModelObject();
      if (modelObject == null || "".equals(modelObject))

      { replaceComponentTagBody(markupStream, openTag, defaultNullLabel()); }

      else

      { super.onComponentTagBody(markupStream, openTag); }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jkriesten Jan Kriesten
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: