Cells with HTML <img> tags do not appear in filter choices

Issue #28 resolved
altmany created an issue
What steps will reproduce the problem?
1. create a JTable with a cell that includes &quot;&lt;html&gt;&lt;img src='image.gif'&gt;&quot;
(i.e., just an icon image, no text)
2. filter the table; try to select the image rows from the filter

What is the expected output? What do you see instead?
I expect to see the cell image in the list of filter options. Instead, I see nothing
- I cannot filter for rows that contain images.

What version of the product are you using? On what operating system?
4.4

Please provide any additional information below.
This is a direct consequence of the fix for issue #23 - If the cell contents are entirely
within HTML tags, then the filter disregards the cell and the user cannot filter accordingly.
HTML &lt;Img&gt; tags are a special case that should get special treatment.

Original issue reported on code.google.com by altmany on 2012-09-30 10:31:53

Comments (5)

  1. coderazzi coderazzi repo owner

    ``` Hi,

    There is basically to behaviors associated to each filter editor in the filter header: text-oriented editors perform text searches, implementing logic such as wildcards and comparison operators. The implementation done for issue 23 implied extracting the valid HTML information from the content, which by default is to exclude those HTML tags -this behavior can be modified by providing a different Parser implementation, by the way-.

    The other type of filter editors is choice-oriented, where the user can only choose one option from the associated combobox. In this case, what is already possible is to define a net.coderazzi.filters.gui.ChoiceRenderer for that column. Note that a basic implementation for this Renderer, using a JLabel would already show perfectly your image -or any HTML content- (well in so far as the JLabel does it correctly).

    Two caveats: 1- The height of the editor is fixed (larger ones can be created by modifying the TableFilter' settings). Care must be taken to have proper renderers. 2- The default implementation will still be accessing the content as text: that is, not because the library detects HTML in the column, it should be expected to use HTML renderers. That is up to the user.

    So, in summary, I believe your issue can be solved by setting a ChoiceRenderer that delegates into a JLabel to render the HTML content -and such renderer could be, indeed, part of the FilterHeader library-.

    What do you think?

    Cheers,

    Lu. ```

    Original issue reported on code.google.com by `coderazzi` on 2012-10-03 01:51:02

  2. coderazzi coderazzi repo owner

    ``` Hi,

    There are basically two behaviors associated to each filter editor in the filter header: text-oriented editors perform text searches, implementing logic such as wildcards and comparison operators. The implementation done for issue 23 implied extracting the valid HTML information from the content, which by default is to exclude those HTML tags -this behavior can be modified by providing a different Parser implementation, by the way-.

    The other type of filter editors is choice-oriented, where the user can only choose one option from the associated combobox. In this case, what is already possible is to define a net.coderazzi.filters.gui.ChoiceRenderer for that column. Note that a basic implementation for this Renderer, using a JLabel would already show perfectly your image -or any HTML content- (well in so far as the JLabel does it correctly).

    Two caveats: 1- The height of the editor is fixed (larger ones can be created by modifying the TableFilter' settings). Care must be taken to have proper renderers. 2- The default implementation will still be accessing the content as text: that is, not because the library detects HTML in the column, it should be expected to use HTML renderers. That is up to the user.

    So, in summary, I believe your issue can be solved by setting a ChoiceRenderer that delegates into a JLabel to render the HTML content -and such renderer could be, indeed, part of the FilterHeader library-.

    What do you think?

    Cheers,

    Lu. ```

    Original issue reported on code.google.com by `coderazzi` on 2012-10-03 01:51:36

  3. altmany reporter

    ``` Sounds like a good plan. But why not automatically use the HTML renderer if <html> is detected in 1+ cell(s) of the column? I think this would be more intuitive. Of course the user can always switch between text/HTML/custom renderers, I'm just saying regarding the default behavior. ```

    Original issue reported on code.google.com by `altmany` on 2012-10-03 23:04:52

  4. coderazzi coderazzi repo owner

    ``` I think that letting the developer choosing how to handle the column is better, also from a performance point of view. Furthermore, the header handles automatically changes in the table, so how to react if one cell in the column has HTML info, and after an update, it doesn't? It is not just a matter of handling the content differently, but the user interaction would change as well (with a renderer, the user cannot enter free text on the editor).

    Finally, although the solution of using a renderer would solve the problem of handling images: 1- Perhaps it is still better searching for text. 2- I am not confident on how the rendering of the cell will look on the editor. That is, the rendering will show the image, but obvious work like fitting the content to the editor cell will be missing...

    Cheers! ```

    Original issue reported on code.google.com by `coderazzi` on 2012-10-04 00:49:24

  5. coderazzi coderazzi repo owner
    As proposed, a new renderer called HtmlChoiceRenderer can be setup on the columns with
    html content.
    Code included already on the repository, will be included on release 4.5.0
    

    Original issue reported on code.google.com by coderazzi on 2012-11-18 00:54:22

  6. Log in to comment