Wicket
  1. Wicket
  2. WICKET-5411

Improve AutoLabels by updating their CSS classes automatically during Ajax requests

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.13.0, 7.0.0-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

      This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.

      disabled by default in 6.13 (to enable override WebApplication#getUpdateAutoLabelsOnAjaxRequests() ), always enabled in 7.0

        Activity

        Igor Vaynberg created issue -
        Igor Vaynberg made changes -
        Field Original Value New Value
        Fix Version/s 6.13.0 [ 12325564 ]
        Igor Vaynberg made changes -
        Description The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

        This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.
        Igor Vaynberg made changes -
        Description The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

        This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.
        The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

        This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.

        disabled by default in 6.13, always enabled in 7.0
        Igor Vaynberg made changes -
        Summary Improve AutoLabels to update their CSS dynamically Improve AutoLabels by updating their CSS classes automatically during Ajax requests
        Igor Vaynberg made changes -
        Description The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

        This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.

        disabled by default in 6.13, always enabled in 7.0
        The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

        This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.

        disabled by default in 6.13 (to enable override WebApplication#getUpdateAutoLabelsOnAjaxRequests() ), always enabled in 7.0
        Hide
        Martin Grigorov added a comment -

        I've added Wicket.DOM.toggleClass() method that delegates to jQuery.toggleClass, so there is no direct usage of jQuery APIs in the Java code.
        Please test it that it still works as expected.

        Is there something else to be done for this ticket or it can be closed ?

        Show
        Martin Grigorov added a comment - I've added Wicket.DOM.toggleClass() method that delegates to jQuery.toggleClass, so there is no direct usage of jQuery APIs in the Java code. Please test it that it still works as expected. Is there something else to be done for this ticket or it can be closed ?
        Hide
        Igor Vaynberg added a comment -

        i wasnt going to close it until i tested it in our app to make sure it works for complex usecases...

        Show
        Igor Vaynberg added a comment - i wasnt going to close it until i tested it in our app to make sure it works for complex usecases...
        Igor Vaynberg made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Martin Grigorov added a comment -

        tag.put("id", getLabelIdFor(component)); at
        https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AutoLabelResolver.java?source=cc#L302
        causes a lot of
        WARN - ComponentTag - Please use component.setMarkupId(String) to change the tag's 'id' attribute.
        when executing the JS UI tests (start wicket examples and go to http://localhost:8080/js-test/all.html)

        Show
        Martin Grigorov added a comment - tag.put("id", getLabelIdFor(component)); at https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AutoLabelResolver.java?source=cc#L302 causes a lot of WARN - ComponentTag - Please use component.setMarkupId(String) to change the tag's 'id' attribute. when executing the JS UI tests (start wicket examples and go to http://localhost:8080/js-test/all.html )
        Hide
        Martin Grigorov added a comment -

        Reopening to improve the problem with tag.put("id", ...) before 6.13

        Show
        Martin Grigorov added a comment - Reopening to improve the problem with tag.put("id", ...) before 6.13
        Martin Grigorov made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Igor Vaynberg made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        3d 13h 24m 1 Igor Vaynberg 12/Nov/13 19:57
        Resolved Resolved Reopened Reopened
        13d 14h 22m 1 Martin Grigorov 26/Nov/13 10:19
        Reopened Reopened Resolved Resolved
        5h 45m 1 Igor Vaynberg 26/Nov/13 16:04

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Igor Vaynberg
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development