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

Behavior.beforeRender(Component component) called after renderHead (both Component and Behavior)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • wicket
    • None
    • Wicket 9.7.0

    Description

      Hi,

      Not sure if it is a real issue. However here it goes:

      Behavior.beforeRender(Component) is called after renderHead of both Component and Behavior.

      KR,
      Helmut

      Code (using Wicket 9.7.0)

      Java

          public class CallOrderPage extends WebPage {
          
          public CallOrderPage() {
              Label l = (Label)new Label("compAddedInCon", Model.of("Constructor")) {
                  
                  @Override
                  protected void onConfigure() {
                      super.onConfigure();
                      System.out.println(getClass()  + ": onConfigure");
      }
                  
                  @Override
                  public void onBeforeRender() {
                      super.onBeforeRender();
                      System.out.println(getClass()  + ": onBeforeRender");
      }
                  
                  @Override
                  public void renderHead(IHeaderResponse response) {
                      super.renderHead(response);
                      System.out.println(getClass()  + ": renderHead");
                      response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
      }
                  
              }.add(new SysOutBehavior());
              add(l);
              
      }
          
          
          @Override
          protected void onConfigure() {
              super.onConfigure();
              System.out.println(getClass()  + ": onConfigure");
      }
          
          @Override
          public void onBeforeRender() {
              super.onBeforeRender();
              System.out.println(getClass()  + ": onBeforeRender");
      }
          
          @Override
          public void renderHead(IHeaderResponse response) {
              super.renderHead(response);
              System.out.println(getClass()  + ": renderHead");
              response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
           }
          
      }

      class SysOutBehavior extends Behavior {
          
          @Override
          public void onConfigure(Component component) {
              super.onConfigure(component);
              System.out.println(getClass()  + ": onConfigure");
       }
          
          @Override
          public void beforeRender(Component component) {
              super.beforeRender(component);
              System.out.println(getClass()  + ": beforeRender");
      }
          
          @Override
          public void renderHead(Component component, IHeaderResponse response) {
              super.renderHead(component, response);
              System.out.println(getClass()  + ": renderHead");
              response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
      }
          }

      class OwnODR extends OnDomReadyHeaderItem {
          
          private Class<?> cl;
          
          protected OwnODR(Class<?> cl, String script) {
              super(script);
              this.cl = cl;
           }
          
          @Override
          public CharSequence getJavaScript() {
              System.out.println("getJavaScript(): " + cl);
              return super.getJavaScript();
         }
          
      }
      HTML
      <!DOCTYPE html>
      <html xmlns:wicket="http://wicket.apache.org">
      <head>
      </head>
      <body>
          
          <div wicket:id="compAddedInCon"></div></body>
      </html>

      Output

      class CallOrderPage: onConfigure
      class CallOrderPage$1: onConfigure
      class SysOutBehavior: onConfigure
      class CallOrderPage$1: onBeforeRender
      class CallOrderPage: onBeforeRender
      class CallOrderPage$1: renderHead
      class SysOutBehavior: renderHead
      class CallOrderPage: renderHead
      getJaveScript: CallOrderPage$1
      getJaveScript: SysOutBehavior
      getJaveScript: CallOrderPage
      class SysOutBehavior: beforeRender

      Attachments

        Activity

          People

            Unassigned Unassigned
            helmut8080 Helmut Lerch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: