Image Column in Tableview

Hi all,
here's the thing: I'm trying to add an image column to a tableview but it doesn't work (there's no error, but the image doesn't appear). I've tried it with an iterator.
Page Layout:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design           = "design2003"
               controlRendering = "SAP" >
  <htmlb:document>
    <htmlb:documentHead>
    </htmlb:documentHead>
    <htmlb:documentBody>
      <htmlb:form>
        <htmlb:tableView id            = "tableview_scarr"
                         table         = "<%= pa_tab_scarr %>"
                         headerText    = "Table SCARR"
                         headerVisible = "TRUE"
                         iterator      = "<%= application %>" >
        </htmlb:tableView>
        <%
  IF page->messages->num_messages( ) > 0.
        %>
        Error
        <%
  ENDIF.
        %>
      </htmlb:form>
    </htmlb:documentBody>
  </htmlb:document>
</htmlb:content>
OnInitialization:
SELECT * FROM scarr INTO TABLE pa_tab_scarr.
My application class is my iterator. It implements GET_COLUMN_DEFINITIONS:
METHOD if_htmlb_tableview_iterator~get_column_definitions.
  DATA tv_column TYPE tableviewcontrol.
  tv_column-columnname          = 'SHOW_ICON'.
  tv_column-title               = 'SHOW_ICON'.
  tv_column-encode = 'X'.
  tv_column-width               = '100'.
  APPEND tv_column TO p_column_definitions.
  CLEAR tv_column.
  tv_column-columnname          = 'CARRID'.
  tv_column-width               = '100'.
  APPEND tv_column TO p_column_definitions.
ENDMETHOD.
...and it implements RENDER_CELL_START:
METHOD if_htmlb_tableview_iterator~render_cell_start.
  CASE p_column_key.
    WHEN 'SHOW_ICON'.
      DATA col_image TYPE REF TO cl_htmlb_image.
      CREATE OBJECT col_image.
      col_image->src = "@2N@".
      col_image->width = '16'.
      col_image->height = '14'.
      p_replacement_bee = col_image.
  ENDCASE.
ENDMETHOD.
I've checked the SICF, but all services concerning icons are activated. This is my first Iterator so i'm not sure if i've forgotten something. Why the image is not shown?
Regards
Mark-André

Hi Mark,
First of all, define an object named iterator in page attributes type ref to iterator_class_name
i.e
iterator TYPE REF TO ZCL_ITERATOR(or iterator_class_name)
Then in <b>onInitialization</b> use
create object iterator.
Also you can use any name of the iterator object...but the name application is reserved for the application class....
So your tableView code will be
        <htmlb:tableView id            = "tableview_scarr"
                         table         = "<%= pa_tab_scarr %>"
                         headerText    = "Table SCARR"
                         headerVisible = "TRUE"
                         iterator      = "<%= iterator %>" >
Rest all is fine...!!
Hope this helps.
<b><i>Do reward each useful answer..!</i></b>
Thanks,
Tatvagna.

Similar Messages

  • Add Image column in classic sql report to open a pop page

    I have sql report I want to add a new column which will have image to click, Once user clicks the image a popup page should open.

    Hi Vikram,
    Sorry to bother you, I am very new to apex. Here is my sql query for sql report. Can you please help me.
    <xmp>select
    case
    when ISUPPORT_NUMBER is null or ISUPPORT_NUMBER = 'N/A' then '<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Enter SR Number</p></a>'
    else '<span style="background-color:red;font-weight:bold">'
    || ISUPPORT_NUMBER
    || '</span>'
    end ISUPPORT_NUMBER,
    case
    when ISUPPORT_NUMBER is not null and ISUPPORT_NUMBER != 'N/A' then '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#FF0000;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    else '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    end MACHINE_NAME,
    FUNCTION,
    VERSION,
    VENDOR_CLUSTER,
    case when used_by is null then '<a href="javascript:myFunc2(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc5(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || used_by || '</p></a>'
    else used_by
    end used_by,
    case
    when loaned_to is null and ( upper(used_by)=v('APP_USER') or used_by is null) then '<a href="javascript:myFunc(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc6(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || loaned_to || '</p></a>'
    else loaned_to
    end loaned_to,
    LOANED_TO_EXPIRY_DATE,
    LOAN_INFO,
    decode(SCAN_NAME,null,'<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>','<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>') SCAN_NAME,
    USERNAME,
    VNC_PASSWORD,
    LAST_UPDATED_BY , </xmp>
    <b>Here I want to add a image column where I can give a link like above to open popup </b>
    from install_dbqa_machines
    Edited by: Sivaramaraju on Jun 19, 2012 9:06 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:07 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:08 AM

  • Image column in an interactive report (APEX 4.0)

    Hi,
    I have added a new blob column containing images to an interactive report, but get the following error:-
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    If the "IMAGE" column is removed from the report using the "actions:select column" control, the report is ok.
    The column contains the following settings in the "BLOB Download Format Mask":-
    IMAGE:WINEDETAILS:IMAGE:WINE_ID::MIMETYPE:FILENAME:::inline:Download
    Have I missed something?
    Regards
    Tim

    Firstly, did you run: GRANT EXECUTE ON DISPLAY_IMAGE TO PUBLIC
    Yes..
    Secondly, is "OBJEKT" a reserved word in your language version of Oracle?
    No, objekt is not reserved word.
    Lastly, is your table defined in the same way as mine:
    CREATE TABLE "A_IMAGES"
    "IMAGE_ID" NUMBER(10,0) NOT NULL ENABLE,
    "FILE_NAME" VARCHAR2(4000) NOT NULL ENABLE,
    "BLOB_CONTENT" BLOB,
    "MIME_TYPE" VARCHAR2(4000),
    CONSTRAINT "A_IMAGES_PK" PRIMARY KEY ("IMAGE_ID") ENABLE
    Script of my table:
    CREATE TABLE PROD.TOB_DOKUMENTI
    ID NUMBER(10) NOT NULL,
    PARENT_ID NUMBER(3) NOT NULL,
    ID_VALUE NUMBER(10),
    NAZIV_DOKUMENTA VARCHAR2(500 BYTE),
    VELICINA NUMBER,
    OBJEKT BLOB,
    LINK VARCHAR2(1000 BYTE),
    DATUM_OD DATE NOT NULL,
    DATUM_DO DATE,
    STATUS VARCHAR2(1 BYTE) DEFAULT 'D' NOT NULL,
    ID_KUPCA NUMBER(10) NOT NULL,
    ID_VRSTE NUMBER(6) NOT NULL,
    ID_DOC_ORIGINAL NUMBER,
    FILE_NAME VARCHAR2(4000 BYTE),
    MIME_TYPE VARCHAR2(100 BYTE)
    I also think that everything is set up correctly, but it still not working..
    THNX for Your reply..
    Kreso..
    (apart from the table and field names)
    Andy

  • Display BLOB (image) column in (interactive) report

    Hi,
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query. if possible, i would like to control the size of the picture rendered within the report like say 40*50.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    in my query.
    The above also makes the report column as of type "number". is this expected?
    Any help would be much appreciated.
    Regards,
    Ramakrishnan

    You haven't actually said what the problem is?
    >
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    >
    Something like:
    select
              name
            , description
            , dbms_lob.getlength(picture) picture
    from
              details
    if possible, i would like to control the size of the picture rendered within the report like say 40*50.For images close to this size it's easy to do this for declarative BLOB images in interactive reports using CSS. Add a style sheet with:
    .apexir_WORKSHEET_DATA td[headers="PICTURE"] img {
      display: block;
      width: 40px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }where the <tt>PICTURE</tt> value in the attribute selector is the table header ID of the image column. Setting only one dimension (in this case the width) scales the image with the correct aspect ratio. (The border, padding and background properties are just eye candy...)
    However, scaling large images in the browser this way is a huge waste of bandwidth and produces poorer quality images than creating proper scaled down versions using image tools. For improved performance and image quality, and where you require image-specific scaling you can use the database ORDImage object to produce thumbnail and preview versions automatically, as described in this blog post.

  • How to increase the width of the column in Tableview

    Hi ALL,
    How to increase the width of the column in tableview?I have name column where big name is displaying in rows.Does any one have any idea how to increase the width of the column dynamically in tableview.Please respond its little urgent.
    Thanks in advance

    Hi Peter,
    Here is my Dynpage
    package com.ust.jcatotable;     
    import java.awt.Event;
    import javax.resource.cci.MappedRecord;
    import javax.resource.cci.RecordFactory;
    import com.sapportals.connector.connection.IConnection;
    import com.sapportals.connector.execution.functions.IInteraction;
    import com.sapportals.connector.execution.functions.IInteractionSpec;
    import com.sapportals.connector.execution.structures.IRecordSet;
    import com.sapportals.htmlb.DropdownListBox;
    import com.sapportals.htmlb.event.TableNavigationEvent;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.ivs.cg.ConnectionProperties;
    import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
    import com.sapportals.portal.ivs.cg.IConnectorService;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentProfile;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    public class Display extends PageProcessorComponent {
      public DynPage getPage(){
         return new DisplayDynPage();
    public static class DisplayDynPage extends JSPDynPage{
         private Object formatFlag;
         public static IConnection connection ;
         private IPortalComponentRequest request;
         private IPortalComponentContext context;
         private IPortalComponentProfile profile;
         private IPortalComponentResponse  response;
         private int visibleRow=1;
         TableBean myBean;
         public void doInitialization(){
                   response = (IPortalComponentResponse) this.getResponse();
                   request = (IPortalComponentRequest) this.getRequest();
                    context = request.getComponentContext();
                    profile = context.getProfile();
                    IPortalComponentProfile profile = context.getProfile();
                    Object o = context.getValue("myBean");
                    if(o==null || !(o instanceof TableBean)){
                       myBean = new TableBean();
                       setBeanFromProfile(profile, myBean);
                       context.putValue("myBean",myBean);
                     }else {
                       setBeanFromProfile(profile, myBean);
                        myBean = (TableBean) o;
                    this.getData();
         public void myOnNavigate(Event event) throws PageException{
              TableNavigationEvent tne = (TableNavigationEvent) event;
              this.visibleRow = tne.getFirstVisibleRowAfter();
              if(myBean!=null)
              myBean.setVisibleRow(new Integer(this.visibleRow).toString());

  • WebRowSet With Image Columns (or text)

    I tried posting this in the general Java programming and got no response.
    We have a requirement to pass part (whole rows) from a table in one DB to the same DB schema on a different machine via web services.
    We thought we could use WebRowSet to pull the data out and pack it into an XML file, send, and re-synch the data in the other DB.
    Every time we call the writeXml() for the WebRowSet a null pointer exception is being thrown. I changed the output object from a file to System.out to see where (what column) it is having problems and it seems to have problems on an image column.
    What is needed so the image fields are placed into the file?
    Thanks
    Larry

    Hi,
    I have the same problem with postgresql database with columns defined as TEXT. Did you solve your problem?
    What are you doing?
    Thanks,
    St�phane

  • Accessing IMAGE Columns in SQL Server

    I'm trying to use the TG4MSSQL to access tables in a SS2k database. All is well, except for 1 table that has an IMAGE column in it. I must say that I'm a little surprised and disappointed that the 10gR2 gateway for MSSQL apparently translates these things into LONG RAW columns, which are known to be antiquated and minimally supported. However, I still need access to the data, and ultimately, I need it in a BLOB. Doing simple queries (in TOAD) such as:
    select * from image@tg4ss where image_id = 1;
    returns the row, and I can use TOAD to determine that all the data is there. However, apparently, you cannot use PL/SQL to bind more than 32K of this data into a variable, so I haven't had much success there.
    The only way I know of converting a long raw to a blob is to use the to_lob function, but that's only good in the select list of a subquery of an insert statement. Thing is, that doesn't seem to work with the gateway. I tried something like:
    insert into my_blob_table( id, image )
    select id, to_lob(image) as image from image@tg4ss where id = 1;
    That gets me a ORA-00997: illegal use of LONG datatype.
    In fact, I can't even do this:
    insert into my_long_raw_table( id, image )
    select id, image from image@tg4ss where id = 1;
    I get the same error on that command.
    Now, I can do this, but I only get the first 32k of the image:
    begin
    for I in (select id, image from IMAGE@tg4ss)
    loop
    insert into my_long_raw_table( id, image )
    values (I.id, I.image);
    end loop;
    end;
    So, does anyone know how you can get image data out of an SQL Server database into a blob value? If so, I'd appreciate a reply. Thanks.
    -Rich.

    Hello Rich,
    I found your article after running into the same problem. I imagine you've dealt with this one way or another already but just in case...
    The reason the LONG RAW gets truncated is explained in:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#i43252
    Basically, LONG RAW variables are limited to 32760 bytes inside PL/SQL. The ORA-00997 error is explained a little in:
    http://www.dbaxchange.com/3_4_longdatatypes.htm
    The only solution I found to work was to create a Java utility that read in each LONG RAW value (one at a time) and then update a record in a table's BLOB column. This was even a bit tricky. I found the gateway would lock up if I tried to do too much at a time. I kept it simple my reading all column IDs into an array and then looping through the array while executing a simple select statement that retrieved the LONG RAW value. I concatenated the id to the end of the select statement because prepared statements seemed to be one of the reasons the gateway locked up. I used a ByteArrayInputStream object to populate the BLOB in an update prepared statement for each LONG RAW value processed in the loop.
    - Aaron

  • How to export an image column from SQL server to an excel

    Hi team,
    Would like to know how can i get an Image column storeed in SQL Server database to get copied in Excel (Hard Drive).
    Requirement : Need to get Username, User email address and User photo in to an excel sheet from SQL server database.
    Fix: I can get Username and Useremail adress however could not find a way to export /Copy user Image.
    Please suggest
    Thanks,
    venkatesh

    This is an Oracle forum. Your question relates to SQL Server and Excel, neither of which are Oracle related.

  • Displaying image in a TableView

    Hi,
    Can we display images in a tableView? what I like to do is, when user click a row, a picture(maybe the picture of a person) can be displayed in the same grid?

    A search in Google for "image in table cocoa" brings up a few good links. The Irate Scotsman, Matt Gemmell, has a good example on his source code page. He's actually got a few versions of this page floating around but this link works best for now. Search the page for "image in table". It sounds like you might also be interested in his Address Book Test.
    I would suggest downloading all of his source code. He's got a lot of great examples.
    The Apple Developer article on using Bindings for images in a table is good if you're working with Bindings.
    The Theocacao post about smoother image scaling is good and he offers the source for the subclass he describes. This post is featured on Cocoa Dev Central which is a great resource.
    Another site you should bookmark is CocoaDev. If you think of posting there, be sure to look into the Starting Points and the Other Points before you do. There's some helpful stuff in CocoaIntroduction, CommonProblems, and SampleCode. Of course HowToUseThisSite is essential, as is HowToAskQuestions.
    iMac G5 20"   Mac OS X (10.4.6)  

  • Standard Report & Image Column

    Hi everybody,
    I have a standard report for employees in this report there is an image column displaying the employee photo.
    Of course if there is no image in the database for the employee the report won't display anything.
    What I want is that if the image column is NULL the report will display a standard NO_PHOTO.JPG image for this employee.. is this possible??
    My select statment is simple:
    select
           "EMP_ID",
           "EMP_FIRST_NAME",
           "EMP_SECOND_NAME",
           "EMP_FAMILY_NAME",
           dbms_lob.getlength("EMP_PHOTO") "EMP_PHOTO"
    from   "T_EMPLOYEE"

    One method is to use a Dynamic Action to insert the default image when there isn't one in the report. This avoids having to modify the report query or attributes.
    h4. When
    Event: After Refresh
    Selection Type: Region
    Region: <your report region>
    h4. True Action
    Action: Execute JavaScript Code
    Fire On Page Load: Yes
    Code:
    $('#emp-report td[headers="PHOTO"]')
      .contents()
      .filter(function() {
        return this.nodeType === 3; // report cell contents is a text node, not an img element
      .replaceWith('<img src="&WORKSPACE_IMAGES.NO_PHOTO.jpg" alt="No photo">');Another is to put the logic in the query and get the image source programatically:
    select
           "EMP_ID",
           "EMP_FIRST_NAME",
           "EMP_SECOND_NAME",
           "EMP_FAMILY_NAME",
              '<img src="' || nvl2(photo, apex_util.get_blob_file_src('P2_PHOTO_FILE', employee_id), '&WORKSPACE_IMAGES.NO_PHOTO.jpg')
           || '" alt="' || nvl2(photo,  "EMP_FIRST_NAME" || ' ' || "EMP_FAMILY_NAME", 'no photo') || '">' "EMP_PHOTO"
    from   "T_EMPLOYEE"Where <tt>P2_PHOTO_FILE</tt> is the file browser item used to upload the photos.
    The Display As column attribute for the EMP_PHOTO column must be changed to Standard Report Column when using this method.

  • How to migrate data fSQL server 2005 Tables with image column To ORACLE 11g

    Hi ....
    I am in the middle of migrating our database from sqlserver 2005 version to ORACLE 11g instance, and i'm facing a problem when trying to load data into one of the oracle table which has blob column and some more. The data file was extracted from sql server 2005 table which has image column and some more. All other columns are sinking with the migration as expected but the image column is not getting loaded into oralce blob.
    I tried loading data using sqlloader.
    Is there any other way to migrate data directly between these two versions of database?. Pls help...
    Edited by: user13310523 on 21-Jun-2010 23:48

    Welcome to the forum,
    Hi,
    To link Oracle with SQL Server follow this steps:
    1-Install Oracle ODBC drivers on the server (your local Oracle database) that will access the remote SQL Server database using the database link.
    2. Setup the ODBC connection on the local Oracle database using the Windows ODBC Data Source Administrator
    3. Test the ODBC drivers to ensure that connectivity is made to the SQL Server database.
    4. Ensure that your global_names parameter is set to False.
    5. Configure the Oracle Heterogeneous services by creating an initodbc.ora file within the Oracle database.
    7. Modify the Listener.ora file.
    SID_NAME is the DSN for the remote database.
    ORACLE_HOME is the actual Oracle home file path.
    PROGRAM tells Oracle to use heterogeneous services.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME=Cas30C) -- Enter the DSN on this line
    (ORACLE_HOME = c:\oracle10gdb) -- Enter your Oracle home on this line
    (PROGRAM = hsodbc) ) )
    8. Modify the Tnsnames.ora file. This is the Oracle database installation accessed by the users to connect to the ODBC drivers
    (DESCRIPTION=
    (ADDRESS_LIST=
    (Address=(PROTOCOL=TCP)
    (HOST=
    -- (Server x)
    (PORT=1521))) -- Enter the port on which the server x Oracle installation
    -- is listening
    (CONNECT_DATA=(SID=Cas30c)) - Enter the DSN name
    (HS=OK) -- Enter this value. It tells Oracle to use hetergeneous services
    9. Reload the listener on local Oracle database
    10. Create a database link on the local Oracle installation that accesses the heterogeneous connection, which, in turn, connect to SQL Server.
    11. Run a SQL Server Select statement from the Oracle installation using the database link
    Thanks
    BelMan :)

  • Use same image column twice in a report

    Hello,
    I have a question  which is, can I use a same image column (example column A) twice in a report? first occurrence (column A) will show the image thumbnail and the second occurrence (column A) will show  image download link which opens image in a new window. Is it possible?
    Thanks
    Pravish

    LA-APEX-DEv wrote:
    Yes, it's possible. However, if you intent to have two different images, then I would suggest you use a javascript to link or download the blob.
    What on Earth for? Why is JavaScript necessary to download two different images? Even if this were in any way true, the OP is clear that the displayed thumbnail and download link involve the same image.
    To accomplish this task, you either use decode or create a union query.
    No, all that should be necessary is to reference the image column twice in the report query projection, and apply a download format mask to one column and an image mask to the other. That the OP has apparently failed to do this probably indicates that they are unnecessarily complicating things.
    For example:
    select '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>' link_col
    from table
    where allow_view = 'Y'
    union all
    select '<img src="/i/folder.gif">' link_col
    from table
    where allow_view = 'N'
    or
    select decode(allow_view,'Y',
              '<a href="javascript:downloadImg(' || image_id || ');"><img src="/i/download.gif"></a>',
              '<img src="/i/folder.gif">') link_col
    from table
    What is downloadImg? it is not a standard APEX JavaScript API. It is therefore highly unlikely that this is of any use to the OP.

  • Retrieve image column

    Hi,
    Can anyone show to me, with an example, by which we can use executeQuery to retrieve one image column from the DB, and then show/refresh it on the jsf page?
    Many Thanks & Best Regards,
    HuaMin

    Your example is quite big! Last time I could not find out the case I expected to see!
    Timo,
    I searched your example project but I see nothing found in that.
    Looking for: executeQuery in: FODLogicalDataModel.jpr
    Found 0 occurrences in 69 file(s)
    Does anyone have a clear example using executeQuery to retrieve that, as I can't see one example to this in Jdev Help?
    Edited by: HuaMin on May 14, 2012 10:57 AM

  • How to dynamically load an Image into a TableView when its row/cell becomes visible?

    Hi,
    I am building an application that shows tables with large amounts of data containing columns that should display a thumbnail. However, this thumbnail is supposed to be loaded in the background lazily, when a row becomes visible because it is computationally too expensive to to this when the model data is loaded and typically not necessary to retrieve the thumbnail for all data that is in the table.
    I have done the exact same thing in the past in a Swing application by doing this:
    Whenever the model has changed or the vertical scrollbar has moved:
    - Render a placeholder image in the custom cell renderer for this JTable if no image is available in the model object representing the corresponding row
    - Compute the visible rows by using getVisibleRect and rowAtPoint methods in JTable
    - Start a background thread that retrieves the image for the given rows and sets the resulting BufferedImage in a custom Model Object that was used in the TableModel (if not already there because of an earlier run)
    - Fire a corresponding model change event in the EDT whenever an image has been retrieved in the background thread so the row is rendered again
    Btw. the field in the model class holding the BufferedImage was a weak reference in this case so the memory can be reclaimed as needed by the application.
    What is the best way to achieve this behaviour using a JFX TableView? I have so far failed to find anything in the API to retrieve the visible items/rows. Is there a completely different approach available/required that uses the Cell API? I fail to see it so far.
    Thanks in advance for any hints here.

    Here’s what I have tried so far:
    I have defined a property in my model object that contains a weak reference to the image that is expensive to load. I have modeled that reference as an inner class to the object so I have a reference to its enclosing object. That is necessary because my cell factory otherwise has no access to the enclosing model object, which it needs to trigger loading the image in the background.
    The remaining problems I have is, that I don’t have sufficient control over the loading process, i.e. I need to delay the loading process until scrolling has stopped and abort it as soon as the user starts scrolling again and the visible content changes. Imagine that loading an image for a table row (e.g. a thumbnail for a video) takes 200ms to load and a user quickly scrolls through a few hundred records and then stops. With my current set-up, the user has to wait for all loading processes that were triggered in the cell factories to finish until the thumbnails of the records they are looking at will appear (imagine an application like finder to be implemented like that, it would simply suck UX-wise). In my swing application a background thread that loads images for the visible records is triggered with a delay and stopped as soon as the visible content changes. This works well enough for a good user experience. I don’t see how I can do this based on the cell API. It is nice to have all this abstracted away but in this case I do not see how I can achieve the same user experience as in my swing application.
    I also tried registering a change listener to the TreeCell’s visible property to make that control the image loading but I don’t seem to get any change events at all when I do that.
    I must be missing something.

  • Dynamic image column in report

    Hi
    I want to display either a vaue of Y or (better) a small image next to each row in a standard SQL report, but only display it if any one of 6 other column values are not null
    Can anyone advise how please ?
    I have looked at adding a derived column based on a condition but that does not seem to do it, and I can't see where to add a default value of Y.

    Hi,
    [Edit] Have you tried this :
    SELECT id, column1, column2, column3, column4, column5, column6,
           DECODE
              (column1,
               NULL, DECODE (column2,
                             NULL, DECODE (column3,
                                           NULL, DECODE
                                                     (column4,
                                                      NULL, DECODE
                                                              (column5,
                                                               NULL, DECODE
                                                                       (column6,
                                                                        NULL, 'Y',
                                                                        'N'
                                                               'N'
                                                      'N'
                                           'N'
                             'N'
               'N'
              ) AS check_null_columns
      FROM my_tableIf you prefer to display image, try to remplace 'Y' value by '< img src="your_source" ... >'.
    Hope this helps,
    Gregory

Maybe you are looking for

  • Po print out after making changes in po

    hi experts, we r facing a problem ,after making a po when we edit it for additon of some more materials  and take the print out ,only item that were there in po intially are coming , it is not printing all the items that are that are added i po, but

  • Thanks for the help...iPhoto 11 on my Pro isn't recognizing the .nef file extension.  Advice?

    I'm importing photos from a Nikon d5200 in RAW format and iPhoto says it doesn't recognize that file extension (.nef).  The movie files came off just fine.  And when the initial window comes up in iPhoto asking if I want to import all photos or just

  • Colors are off

    I've used previous Photoshop versions and recently upgraded to Photoshop CS5 (I've used the same Dell monitor with previous versions and it looked just fine before). For some reason the colors I use in Photoshop CS5's work-space are off. For example,

  • Data propagation problems w/ NIS+ to LDAP migration..

    Hello All, I'm running in to an issue performing an NIS+ to LDAP migration with Solaris 9. It all happens like this: NIS+ successfully populates the directory through the 'initialUpdateAction=to_ldap' option-- afterwards, no updates made directly to

  • Problem archiving file using FTP adapter

    Hi, I am polling some files from another server using FTP adapter in SOA 11g. Even though I have checked the option to archive the files, the files get archived successfully on the server where the SOA process is running, but I am unable to archive t