Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Problem with the Image View
Problem with the Image View [message #988605] Fri, 30 November 2012 11:50 Go to next message
Omkar Mujumdar is currently offline Omkar Mujumdar
Messages: 22
Registered: October 2012
Junior Member
Hi,


Thank You for wonderful Eclipse Scout Tutorial.

I have created a form in Scout, where I have added an Image Field in the Mainbox and I am able to load an icon which is available in Scout or an Url image into that field. But I am unable to load an image from the SQL database into the Image Field. Can you please help me with this or give some pointers.

Another thing I wanted to ask is, I have created a Table Page with some values displayed in table page and a Form within it to display the selected values. I am able to display the Form when I right click on the selected value of a TablePage, where the Form appears. Now I need to display that Form when I double clicked (Left Click) on the selected value of the TablePage, where again I am struck.
Can u please provide me with some pointers .

Thank You in Advance.
Re: Problem with the Image View [message #988673 is a reply to message #988605] Fri, 30 November 2012 19:18 Go to previous messageGo to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
Never tried to load image so i can't help you there, to open form with a double click on a table you should override in the table :

    @Override
    protected void execRowAction(ITableRow row) throws ProcessingException {
        // here you can call i thin the menu option to open the form 
        // or just create the form here
    }


I'm no expert but it works for me.... it's only executed when you double click or hit Enter key while row selected (so if you navigate with keyboard is useful).

luck!
Sebastian


Re: Problem with the Image View [message #988683 is a reply to message #988673] Sat, 01 December 2012 04:00 Go to previous messageGo to next message
Omkar Mujumdar is currently offline Omkar Mujumdar
Messages: 22
Registered: October 2012
Junior Member
Thank you very much Sebastian for the solution for displaying the Form when double clicked, it worked.
Re: Problem with the Image View [message #988689 is a reply to message #988673] Sat, 01 December 2012 05:43 Go to previous messageGo to next message
Matthias Zimmermann is currently offline Matthias Zimmermann
Messages: 81
Registered: February 2010
Member
Regarding loading an image from a database: Let's assume that in your database there is a table IMAGE with columns ID and CONTENT. To fetch the image content from the server you could add a loadFile method on some FileTransferProcessService server service as follows:

  @Override
  public byte[] loadFile(String id) throws ProcessingException {
    ByteArrayHolder contentHolder = new ByteArrayHolder();
    SQL.selectInto("SELECT CONTENT INTO :content FROM IMAGE WHERE ID=:id", new NVPair("content", contentHolder), new NVPair("id", id));
    return contentHolder.getValue();
  }


using this server method you can display the image in your form by adding the method execInitField to the image filed in your form:

@Override
protected void execInitField() throws ProcessingException {
  String id = <<here goes your file id>>;
  byte[] content = SERVICES.getService(IFileTransferProcessService.class).loadFile(id);
  setImage(content);
}


let us know if that's what you were looking for

matthias
Re: Problem with the Image View [message #988703 is a reply to message #988689] Sat, 01 December 2012 10:45 Go to previous message
Omkar Mujumdar is currently offline Omkar Mujumdar
Messages: 22
Registered: October 2012
Junior Member
Thank You very much Matthias, it worked great. Thanks for your solution.
Previous Topic:How to get image in Image view
Next Topic:Authentication with RAP
Goto Forum:
  


Current Time: Wed Aug 27 13:20:17 EDT 2014

Powered by FUDForum. Page generated in 0.01798 seconds