Wicket
  1. Wicket
  2. WICKET-4226

TreeColumn not displayed when there is only one "Alignment.MIDDLE" column

    Details

      Description

      When you create a TreeTable with only one column in the middle (Alignment.MIDDLE), the column is not display in the browser.

      When you look at the HTML code, the width is set to 00%:
      ...
      <div class="a_">
      <span class="b_" style="width:00%">
      <span class="c_">...
      </span>
      </div>
      ...

      The error comes from the MiddleColumnsView class where the number is formatted :

      /**

      • @see org.apache.wicket.MarkupContainer#onRender()
        */
        @Override
        protected void onRender()
        {
        Response response = RequestCycle.get().getResponse();
        double widths[] = computeColumnWidths();

      NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH);
      nf.setMaximumFractionDigits(0);
      nf.setMaximumIntegerDigits(2); // <--------- Should be nf.setMaximumIntegerDigits(3); to handle value > 99

      for (int i = 0; i < columns.size(); ++i)
      {
      Component component = components.get;
      IRenderable renderable = renderables.get;
      IColumn column = columns.get;

      // write the wrapping column markup
      response.write("<span class=\"b_\" style=\"width:" + nf.format(widths[i]) + "%\">");

      To reproduce you can use the TreeTablePage class from wicket example and keep only one "middle" column :
      ...
      IColumn columns[] = new IColumn[]

      { new PropertyTreeColumn<String>(new ColumnLocation(Alignment.MIDDLE, 8, Unit.PROPORTIONAL), "Tree Column (middle)", "userObject.property1"), new PropertyRenderableColumn<String>( new ColumnLocation(Alignment.RIGHT, 8, Unit.EM), "R1", "userObject.property6"), }

      ;
      ...

        Activity

        Martin Grigorov made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 1.5.4 [ 12319051 ]
        Fix Version/s 6.0.0 [ 12315431 ]
        Resolution Fixed [ 1 ]
        Martin Grigorov committed 1205900 (1 file)
        Reviews: none

        WICKET-4226
        TreeColumn not displayed when there is only one "Alignment.MIDDLE" column--This line, and those below, will be ignored--

        Igor Vaynberg committed 1205668 (1 file)
        Reviews: none

        tester.assertfeedbackmessages no longer depends on the order
        Issue: WICKET-4226

        Igor Vaynberg committed 1205666 (1 file)
        Reviews: none

        tester.assertfeedbackmessage no longer depends on the order
        Issue: WICKET-4226

        Gabriel Landon made changes -
        Attachment MiddleColumnsView.patch [ 12503698 ]
        Hide
        Gabriel Landon added a comment -

        Patch for wicket 1.5.x

        Show
        Gabriel Landon added a comment - Patch for wicket 1.5.x
        Gabriel Landon made changes -
        Field Original Value New Value
        Description When you create a TreeTable with only one column in the middle (Alignment.MIDDLE), the column is not display in the browser.

        When you look at the HTML code, the width set is 00%:
        ...
        <div class="a_">
            <span class="b_" style="width:00%">
               <span class="c_">...
            </span>
        </div>
        ...

        The error comes from the MiddleColumnsView class where the number is formatted :

                /**
        * @see org.apache.wicket.MarkupContainer#onRender()
        */
        @Override
        protected void onRender()
        {
        Response response = RequestCycle.get().getResponse();
        double widths[] = computeColumnWidths();

        NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH);
        nf.setMaximumFractionDigits(0);
        nf.setMaximumIntegerDigits(2); // <--------- Should be nf.setMaximumIntegerDigits(3); to handle value > 99

        for (int i = 0; i < columns.size(); ++i)
        {
        Component component = components.get(i);
        IRenderable renderable = renderables.get(i);
        IColumn column = columns.get(i);

        // write the wrapping column markup
        response.write("<span class=\"b_\" style=\"width:" + nf.format(widths[i]) + "%\">");


        To reproduce you can use the TreeTablePage class from wicket example and keep only one "middle" column :
        ...
                        IColumn columns[] = new IColumn[] {
        new PropertyTreeColumn<String>(new ColumnLocation(Alignment.MIDDLE, 8,
        Unit.PROPORTIONAL), "Tree Column (middle)", "userObject.property1"),
        new PropertyRenderableColumn<String>(
        new ColumnLocation(Alignment.RIGHT, 8, Unit.EM), "R1", "userObject.property6"), };
        ...
        When you create a TreeTable with only one column in the middle (Alignment.MIDDLE), the column is not display in the browser.

        When you look at the HTML code, the width is set to 00%:
        ...
        <div class="a_">
            <span class="b_" style="width:00%">
               <span class="c_">...
            </span>
        </div>
        ...

        The error comes from the MiddleColumnsView class where the number is formatted :

                /**
        * @see org.apache.wicket.MarkupContainer#onRender()
        */
        @Override
        protected void onRender()
        {
        Response response = RequestCycle.get().getResponse();
        double widths[] = computeColumnWidths();

        NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH);
        nf.setMaximumFractionDigits(0);
        nf.setMaximumIntegerDigits(2); // <--------- Should be nf.setMaximumIntegerDigits(3); to handle value > 99

        for (int i = 0; i < columns.size(); ++i)
        {
        Component component = components.get(i);
        IRenderable renderable = renderables.get(i);
        IColumn column = columns.get(i);

        // write the wrapping column markup
        response.write("<span class=\"b_\" style=\"width:" + nf.format(widths[i]) + "%\">");


        To reproduce you can use the TreeTablePage class from wicket example and keep only one "middle" column :
        ...
                        IColumn columns[] = new IColumn[] {
        new PropertyTreeColumn<String>(new ColumnLocation(Alignment.MIDDLE, 8,
        Unit.PROPORTIONAL), "Tree Column (middle)", "userObject.property1"),
        new PropertyRenderableColumn<String>(
        new ColumnLocation(Alignment.RIGHT, 8, Unit.EM), "R1", "userObject.property6"), };
        ...
        Gabriel Landon created issue -

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Gabriel Landon
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development