Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » File Chooser and Upload for RAP UI
File Chooser and Upload for RAP UI [message #915195] Sun, 16 September 2012 19:38 Go to next message
Sebastian Boccardi is currently offline Sebastian BoccardiFriend
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 07:48 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
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 12:04 Go to previous messageGo to next message
Sebastian Boccardi is currently offline Sebastian BoccardiFriend
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 09:02 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
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 16:53 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
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: Tue Apr 16 14:22:34 GMT 2024

Powered by FUDForum. Page generated in 1.24396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top