Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » File Chooser and Upload for RAP UI
File Chooser and Upload for RAP UI [message #915195] Sun, 16 September 2012 15:38 Go to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
Hi, im new to scout, i checked the forum but i didn't found anything on this subject.

I'm currently prototyping an application and testing the scout framework to see if i can use it.

Is there a Field or Component i can insert in a Form to choose and upload a file into a byte[] for insertion in a database?

There is a FileChooser but it doesn't support RAP UI i think.

thanks
Sebastian
Re: File Chooser and Upload for RAP UI [message #915396 is a reply to message #915195] Mon, 17 September 2012 03:48 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan Merkli
Messages: 10
Registered: April 2012
Junior Member
Hi Sebastian

The FileChooser field is the right one to use, see the example below:

      @Order(20.0)
      public class FileField extends AbstractFileChooserField {

        @Override
        protected String getConfiguredLabel() {
          return TEXTS.get("Filename");
        }

        @Override
        protected boolean getConfiguredTypeLoad() {
          return true;
        }
      }


And to get the file as byte[]
byte[] content = IOUtility.getContent(new FileInputStream(getFileField().getValue()));


For RAP UI, you need to enable the FileChooser explicitly by following these steps:
1. Switch to Scout Perspective
2. Select your Scout project (e.g. org.example.logo)
3. In Scout Object Properties view, choose RAP FileChooser Support (Incubation) under UI Features

index.php/fa/11509/0/

Regards
Stephan
Re: File Chooser and Upload for RAP UI [message #915492 is a reply to message #915396] Mon, 17 September 2012 08:04 Go to previous messageGo to next message
Sebastian Boccardi is currently offline Sebastian Boccardi
Messages: 47
Registered: September 2012
Location: Montevideo
Member
Oops never saw that, i will try it, thank you.

So far the scout experience is pretty good, so my congratulations to the people involved.

Re: File Chooser and Upload for RAP UI [message #1005897 is a reply to message #915492] Tue, 29 January 2013 04:02 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 318
Registered: October 2012
Location: Bern, Switzerland
Senior Member
In my project I only see the "SVG" option but not the "Incubation" support. Is there an explanation on how to make those changes manually somewhere?
Re: File Chooser and Upload for RAP UI [message #1006062 is a reply to message #1005897] Tue, 29 January 2013 11:53 Go to previous message
Urs Beeli is currently offline Urs Beeli
Messages: 318
Registered: October 2012
Location: Bern, Switzerland
Senior Member
I solved my problem by installing the missing RAP SDK in my eclipse. The FileChooserField in forms works now nicely in RAP. Using a FileChooser instance directly in the following way does not work, however:

  File folder = new File(getDefaultFolder());
  FileChooser.setCurrentDirectory(getDefaultFolder());
  String filename = "Portrait*.*";
  FileChooser chooser = new FileChooser(folder, new String[]{"png", "jpg", "gif", "bmp", "*"}, true);
  chooser.setFileName(filename);
  File[] files = chooser.startChooser();


Is there any way to make the above code work in RAP? If not, I can probably work around it.
Previous Topic:Rayo & rap support with Scout 3.9.0 Milestone 4
Next Topic:Load Codes Problem
Goto Forum:
  


Current Time: Mon Jul 28 22:42:45 EDT 2014

Powered by FUDForum. Page generated in 0.03139 seconds