Trails
  1. Trails
  2. TRAILS-59

ObjectTable needs to be instrumented to be able to automatically render images

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      XP Pro, MySQL, HSql
    • Number of attachments :
      3

      Description

      ObjectTable needs to be instrumented to be able to automatically render images

      Given the current support for blob this should be an easy task and may entail instrumentation of EditLink to parse a boolean that checks for ITrailsBlob and based on the annotation setting of the ITrailsBlob (beit link or image or frame) the object table would render it as is.

      1. DefaultList.html
        2 kB
        Ken in nashua
      2. ObjectTable.java
        8 kB
        Ken in nashua
      3. extending_the_ObjectTable_component.patch
        2 kB
        Alejandro Scandroli

        Activity

        Hide
        Ken in nashua added a comment -

        Ok, instrumenting ObjectTable was not my original idea but I wanted to get your feedback about it. Where this logic should preferably go.

        Show
        Ken in nashua added a comment - Ok, instrumenting ObjectTable was not my original idea but I wanted to get your feedback about it. Where this logic should preferably go.
        Hide
        Ken in nashua added a comment -

        Overrided a column, it is a guess... if it exists in the object it gets overridden otherwise ignored.

        Show
        Ken in nashua added a comment - Overrided a column, it is a guess... if it exists in the object it gets overridden otherwise ignored.
        Hide
        Ken in nashua added a comment -

        Alejandro, can you offer any advise about this...

        Currently this solution is hardcoded to "photo" and descriptor="ognl:components.thisTable.photoColumnPropertyDescriptor"

        Not pretty especially when the table knows nothing about whether the objects it is iterating even has UploadableMedia as any of it's properties.

        Can you expand on a nice solution?

        Ideally, it would be nice if the table was smart enough to render image or link for all UploadableMedia.

        The solution I attached works fine... and operates the table column just as TrailsDownload.html works.

        So it looks nice... I am curious about your view of the world at this juncture.

        Thanks

        Show
        Ken in nashua added a comment - Alejandro, can you offer any advise about this... Currently this solution is hardcoded to "photo" and descriptor="ognl:components.thisTable.photoColumnPropertyDescriptor" Not pretty especially when the table knows nothing about whether the objects it is iterating even has UploadableMedia as any of it's properties. Can you expand on a nice solution? Ideally, it would be nice if the table was smart enough to render image or link for all UploadableMedia. The solution I attached works fine... and operates the table column just as TrailsDownload.html works. So it looks nice... I am curious about your view of the world at this juncture. Thanks
        Hide
        Kalle Korhonen added a comment -

        Alejandro already gave you his advice. Use the block to render it. I'd suggesting closing the bug.

        Show
        Kalle Korhonen added a comment - Alejandro already gave you his advice. Use the block to render it. I'd suggesting closing the bug.
        Hide
        Ken in nashua added a comment -

        Sure, I am going to make one pass at abstract integration and close it for good.

        Show
        Ken in nashua added a comment - Sure, I am going to make one pass at abstract integration and close it for good.
        Hide
        Alejandro Scandroli added a comment -

        Ken that is waaaayyy too much code.
        I wrote a snippet for you copying the usage of the EditLink block. Take a look at the patch.
        That's all the code you need to change in ObjectTable.java. In ObjectTable.html you have 5 lines to do whatever you need to do to render the blob, if 5 lines of code are not enough you are going to need to create another component to hold your logic. I'm not following the blob components evolution too closely but I think you should be able to reuse the blob download component here. If you are not able to use it that means the download component could use a refactoring.

        BTW, I'm not a fan of rendering blobs in the object table, but as long as the user can avoid it I'm ok with adding it.

        Show
        Alejandro Scandroli added a comment - Ken that is waaaayyy too much code. I wrote a snippet for you copying the usage of the EditLink block. Take a look at the patch. That's all the code you need to change in ObjectTable.java. In ObjectTable.html you have 5 lines to do whatever you need to do to render the blob, if 5 lines of code are not enough you are going to need to create another component to hold your logic. I'm not following the blob components evolution too closely but I think you should be able to reuse the blob download component here. If you are not able to use it that means the download component could use a refactoring. BTW, I'm not a fan of rendering blobs in the object table, but as long as the user can avoid it I'm ok with adding it.
        Hide
        Ken in nashua added a comment -

        Thanks Alejandro, thats what I was looking for...

        Let me run with this and see what comes out of it.

        great.. thanks !

        Show
        Ken in nashua added a comment - Thanks Alejandro, thats what I was looking for... Let me run with this and see what comes out of it. great.. thanks !
        Hide
        Ken in nashua added a comment -

        Works like a dream...

        Show
        Ken in nashua added a comment - Works like a dream...

          People

          • Assignee:
            Ken in nashua
            Reporter:
            Ken in nashua
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: