You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Edvin Syse <es...@syse.no> on 2011/08/19 14:20:22 UTC

FileBrowserSheet#setSelectedFile() does not take effect

I want to select a spesific  folder after the sheet is opened, but nothing is selected:

FileBrowserSheet browser = new FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
browser.getWindowStateListeners().add(new WindowStateListener.Adapter() {
	public void windowOpened(Window window) {
			browser.setSelectedFile(lastTarget);
	}
});
browser.open(...)

FileBrowserSheet. selectedFiles is updated with the selection, and selectedFilesChanged is fired. Any idea what's wrong?

-- Edvin

Re: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
Is the file you are selecting relative or absolute?

On Aug 19, 2011, at 9:09 AM, Edvin Syse wrote:

> Yes it does.
> 
>> -----Opprinnelig melding-----
>> Fra: Greg Brown [mailto:gk_brown@verizon.net]
>> Sendt: 19. august 2011 14:51
>> Til: user@pivot.apache.org
>> Emne: Re: SV: FileBrowserSheet#setSelectedFile() does not take effect
>> 
>> Does the sheet actually go to the right directory when you call
>> setRootDirectory()?
>> 
>> On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:
>> 
>>> That's the first thing i tried actually :) Same result.
>>> 
>>>> -----Opprinnelig melding-----
>>>> Fra: Greg Brown [mailto:gk_brown@verizon.net]
>>>> Sendt: 19. august 2011 14:39
>>>> Til: user@pivot.apache.org
>>>> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
>>>> 
>>>> Try calling setRootDirectory() with the parent directory of the file
>>>> you want to select.
>>>> 
>>>> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
>>>> 
>>>>> I want to select a spesific  folder after the sheet is opened, but
>>>>> nothing
>>>> is selected:
>>>>> 
>>>>> FileBrowserSheet browser = new
>>>> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
>>>>> browser.getWindowStateListeners().add(new
>>>> WindowStateListener.Adapter() {
>>>>> 	public void windowOpened(Window window) {
>>>>> 			browser.setSelectedFile(lastTarget);
>>>>> 	}
>>>>> });
>>>>> browser.open(...)
>>>>> 
>>>>> FileBrowserSheet. selectedFiles is updated with the selection, and
>>>> selectedFilesChanged is fired. Any idea what's wrong?
>>>>> 
>>>>> -- Edvin
>>> 
> 


SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
Yes it does.

> -----Opprinnelig melding-----
> Fra: Greg Brown [mailto:gk_brown@verizon.net]
> Sendt: 19. august 2011 14:51
> Til: user@pivot.apache.org
> Emne: Re: SV: FileBrowserSheet#setSelectedFile() does not take effect
> 
> Does the sheet actually go to the right directory when you call
> setRootDirectory()?
> 
> On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:
> 
> > That's the first thing i tried actually :) Same result.
> >
> >> -----Opprinnelig melding-----
> >> Fra: Greg Brown [mailto:gk_brown@verizon.net]
> >> Sendt: 19. august 2011 14:39
> >> Til: user@pivot.apache.org
> >> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
> >>
> >> Try calling setRootDirectory() with the parent directory of the file
> >> you want to select.
> >>
> >> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
> >>
> >>> I want to select a spesific  folder after the sheet is opened, but
> >>> nothing
> >> is selected:
> >>>
> >>> FileBrowserSheet browser = new
> >> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
> >>> browser.getWindowStateListeners().add(new
> >> WindowStateListener.Adapter() {
> >>> 	public void windowOpened(Window window) {
> >>> 			browser.setSelectedFile(lastTarget);
> >>> 	}
> >>> });
> >>> browser.open(...)
> >>>
> >>> FileBrowserSheet. selectedFiles is updated with the selection, and
> >> selectedFilesChanged is fired. Any idea what's wrong?
> >>>
> >>> -- Edvin
> >


Re: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,

>I see now that when TerraFileBrowserSheetSkin#selectedFilesChanged() is
called, the selection is null. I'll investigate a bit further :)
yes, could be interesting to see if/where is a problem, and fix it for 2.0.1
(assuming there is something to fix :-) ).

Edvin, to make a summary, you are executing your application as Standard
Java Application, right ?
On what OS, Java version, and from latest sources from trunk ?
If you have time to prepare a minimal test would be great ...

Bye


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/FileBrowserSheet-setSelectedFile-does-not-take-effect-tp3267865p3268036.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
I see now that when TerraFileBrowserSheetSkin#selectedFilesChanged() is called, the selection is null. I'll investigate a bit further :)


Re: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
Haven't had time to investigate in depth - just trying to help if I can.

On Aug 19, 2011, at 10:02 AM, Edvin Syse wrote:

> I am doing it in the window opened method, see the test case :)
> 
> Sendt fra min HTC
> 
> ----- Reply message -----
> Fra: "Greg Brown" <gk...@verizon.net>
> Til: "user@pivot.apache.org" <us...@pivot.apache.org>
> Emne: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect
> Dato: fre., aug. 19, 2011 15:53
> 
> 
> 
> Are you doing this from a background thread?
> 
> On Aug 19, 2011, at 9:39 AM, Edvin Syse wrote:
> 
> > After further investigation, it seems that the folder is indeed selected, but the button state and the selection background is not updated. Test case attached.
> > 
> > -- Edvin
> > <FileBrowserSelectionTest.java>
> 


Re: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
I am doing it in the window opened method, see the test case :)

Sendt fra min HTC

----- Reply message -----
Fra: "Greg Brown" <gk...@verizon.net>
Til: "user@pivot.apache.org" <us...@pivot.apache.org>
Emne: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect
Dato: fre., aug. 19, 2011 15:53



Are you doing this from a background thread?

On Aug 19, 2011, at 9:39 AM, Edvin Syse wrote:

> After further investigation, it seems that the folder is indeed selected, but the button state and the selection background is not updated. Test case attached.
>
> -- Edvin
> <FileBrowserSelectionTest.java>


Re: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
Are you doing this from a background thread?

On Aug 19, 2011, at 9:39 AM, Edvin Syse wrote:

> After further investigation, it seems that the folder is indeed selected, but the button state and the selection background is not updated. Test case attached.
> 
> -- Edvin
> <FileBrowserSelectionTest.java>


RE: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Sandro Martini <sa...@gmail.com>.
Created an issue for it:
https://issues.apache.org/jira/browse/PIVOT-800
if possible we'll try to fix in 2.0.2, otherwise in 2.1 .

Bye


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/FileBrowserSheet-setSelectedFile-does-not-take-effect-tp3267865p3418062.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Okay, I've been in this area poking around for another fix, and I think I see the problem:
The "selectedFilesChanged" method in TerraFileBrowserSkin.java is being correctly called with the selected file, but before the background task that updates the "fileTableView" data list has completed.  So, the size of the list data is zero and the "files.indexOf(selectedFile)" always returns -1.  So, probably this is better left as a fix in 2.1 (or 2.0.2).  What I think has to happen is that the selected file needs to be saved somewhere and when the background task completes it needs to do the selecting then.


Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@actian.com| Actian Corp. | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA  | +1 650-587-5596 | fax: +1 650-587-5550


-----Original Message-----
From: Edvin Syse [mailto:es@syse.no] 
Sent: Friday, August 19, 2011 7:35 AM
To: user@pivot.apache.org
Subject: SV: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Thanks guys for looking into this :)

I will report back if I can pinpoint where the problem is.

-- Edvin

RE: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Okay, I've been in this area poking around for another fix, and I think I see the problem:
The "selectedFilesChanged" method in TerraFileBrowserSkin.java is being correctly called with the selected file, but before the background task that updates the "fileTableView" data list has completed.  So, the size of the list data is zero and the "files.indexOf(selectedFile)" always returns -1.  So, probably this is better left as a fix in 2.1 (or 2.0.2).  What I think has to happen is that the selected file needs to be saved somewhere and when the background task completes it needs to do the selecting then.


Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@actian.com| Actian Corp. | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA  | +1 650-587-5596 | fax: +1 650-587-5550


-----Original Message-----
From: Edvin Syse [mailto:es@syse.no] 
Sent: Friday, August 19, 2011 7:35 AM
To: user@pivot.apache.org
Subject: SV: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Thanks guys for looking into this :)

I will report back if I can pinpoint where the problem is.

-- Edvin

SV: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
Thanks guys for looking into this :)

I will report back if I can pinpoint where the problem is.

-- Edvin

Re: SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Sandro Martini <sa...@gmail.com>.
> After further investigation, it seems that the folder is indeed selected,
but the button state and the selection background is not updated. Test case
attached.
Great, as soon as possible I'll try it, but you know my (slow) times, so if
in the meantime someone can try too ... let's update later.

Bye


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/FileBrowserSheet-setSelectedFile-does-not-take-effect-tp3267865p3268095.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

SV: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
After further investigation, it seems that the folder is indeed selected, but the button state and the selection background is not updated. Test case attached.

-- Edvin

Re: SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
And you are sure that the selected file actually lives in the selected root directory?

On Aug 19, 2011, at 9:17 AM, Edvin Syse wrote:

> No it is not. Also, setRootDirectory() works fine.
> 
>> -----Opprinnelig melding-----
>> Fra: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
>> Sendt: 19. august 2011 15:15
>> Til: user@pivot.apache.org
>> Emne: RE: SV: FileBrowserSheet#setSelectedFile() does not take effect
>> 
>> I'm new in pivot....but cant' it be a chroot problem? I mean, the app
>> starts with the relative location of where its launched...when you make
>> debug which is the actual route you have into FileBrowserSheet object??
>> 
>> Cordialmente,
>> 
>> 
>> Camilo Casadiego Espitia
>> Arquitecto de SW
>> A + 57 1 6393000
>>  camilo.casadiego@adv.com.co
>> c http://www.adv.com.co
>> Carrera 11 No. 93 - 53 P7
>> Bogotá - Colombia
>> 
>> 
>> 
>> -----Mensaje original-----
>> De: Greg Brown [mailto:gk_brown@verizon.net]
>> Enviado el: Friday, August 19, 2011 7:51 AM
>> Para: user@pivot.apache.org
>> Asunto: Re: SV: FileBrowserSheet#setSelectedFile() does not take effect
>> 
>> Does the sheet actually go to the right directory when you call
>> setRootDirectory()?
>> 
>> On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:
>> 
>>> That's the first thing i tried actually :) Same result.
>>> 
>>>> -----Opprinnelig melding-----
>>>> Fra: Greg Brown [mailto:gk_brown@verizon.net]
>>>> Sendt: 19. august 2011 14:39
>>>> Til: user@pivot.apache.org
>>>> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
>>>> 
>>>> Try calling setRootDirectory() with the parent directory of the file you
>>>> want to select.
>>>> 
>>>> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
>>>> 
>>>>> I want to select a spesific  folder after the sheet is opened, but
>> nothing
>>>> is selected:
>>>>> 
>>>>> FileBrowserSheet browser = new
>>>> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
>>>>> browser.getWindowStateListeners().add(new
>>>> WindowStateListener.Adapter() {
>>>>> 	public void windowOpened(Window window) {
>>>>> 			browser.setSelectedFile(lastTarget);
>>>>> 	}
>>>>> });
>>>>> browser.open(...)
>>>>> 
>>>>> FileBrowserSheet. selectedFiles is updated with the selection, and
>>>> selectedFilesChanged is fired. Any idea what's wrong?
>>>>> 
>>>>> -- Edvin
>>> 
> 


SV: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
No it is not. Also, setRootDirectory() works fine.

> -----Opprinnelig melding-----
> Fra: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
> Sendt: 19. august 2011 15:15
> Til: user@pivot.apache.org
> Emne: RE: SV: FileBrowserSheet#setSelectedFile() does not take effect
> 
> I'm new in pivot....but cant' it be a chroot problem? I mean, the app
> starts with the relative location of where its launched...when you make
> debug which is the actual route you have into FileBrowserSheet object??
> 
> Cordialmente,
> 
> 
> Camilo Casadiego Espitia
> Arquitecto de SW
> A + 57 1 6393000
>   camilo.casadiego@adv.com.co
> c http://www.adv.com.co
> Carrera 11 No. 93 - 53 P7
> Bogotá - Colombia
> 
> 
> 
> -----Mensaje original-----
> De: Greg Brown [mailto:gk_brown@verizon.net]
> Enviado el: Friday, August 19, 2011 7:51 AM
> Para: user@pivot.apache.org
> Asunto: Re: SV: FileBrowserSheet#setSelectedFile() does not take effect
> 
> Does the sheet actually go to the right directory when you call
> setRootDirectory()?
> 
> On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:
> 
> > That's the first thing i tried actually :) Same result.
> >
> >> -----Opprinnelig melding-----
> >> Fra: Greg Brown [mailto:gk_brown@verizon.net]
> >> Sendt: 19. august 2011 14:39
> >> Til: user@pivot.apache.org
> >> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
> >>
> >> Try calling setRootDirectory() with the parent directory of the file you
> >> want to select.
> >>
> >> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
> >>
> >>> I want to select a spesific  folder after the sheet is opened, but
> nothing
> >> is selected:
> >>>
> >>> FileBrowserSheet browser = new
> >> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
> >>> browser.getWindowStateListeners().add(new
> >> WindowStateListener.Adapter() {
> >>> 	public void windowOpened(Window window) {
> >>> 			browser.setSelectedFile(lastTarget);
> >>> 	}
> >>> });
> >>> browser.open(...)
> >>>
> >>> FileBrowserSheet. selectedFiles is updated with the selection, and
> >> selectedFilesChanged is fired. Any idea what's wrong?
> >>>
> >>> -- Edvin
> >


RE: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Camilo Casadiego <Ca...@adv.co>.
I'm new in pivot....but cant' it be a chroot problem? I mean, the app starts with the relative location of where its launched...when you make debug which is the actual route you have into FileBrowserSheet object??

Cordialmente,
 

Camilo Casadiego Espitia
Arquitecto de SW
A + 57 1 6393000 
  camilo.casadiego@adv.com.co
c http://www.adv.com.co
Carrera 11 No. 93 - 53 P7
Bogotá - Colombia



-----Mensaje original-----
De: Greg Brown [mailto:gk_brown@verizon.net] 
Enviado el: Friday, August 19, 2011 7:51 AM
Para: user@pivot.apache.org
Asunto: Re: SV: FileBrowserSheet#setSelectedFile() does not take effect

Does the sheet actually go to the right directory when you call setRootDirectory()?

On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:

> That's the first thing i tried actually :) Same result.
> 
>> -----Opprinnelig melding-----
>> Fra: Greg Brown [mailto:gk_brown@verizon.net]
>> Sendt: 19. august 2011 14:39
>> Til: user@pivot.apache.org
>> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
>> 
>> Try calling setRootDirectory() with the parent directory of the file you
>> want to select.
>> 
>> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
>> 
>>> I want to select a spesific  folder after the sheet is opened, but nothing
>> is selected:
>>> 
>>> FileBrowserSheet browser = new
>> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
>>> browser.getWindowStateListeners().add(new
>> WindowStateListener.Adapter() {
>>> 	public void windowOpened(Window window) {
>>> 			browser.setSelectedFile(lastTarget);
>>> 	}
>>> });
>>> browser.open(...)
>>> 
>>> FileBrowserSheet. selectedFiles is updated with the selection, and
>> selectedFilesChanged is fired. Any idea what's wrong?
>>> 
>>> -- Edvin
> 


Re: SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
Does the sheet actually go to the right directory when you call setRootDirectory()?

On Aug 19, 2011, at 8:40 AM, Edvin Syse wrote:

> That's the first thing i tried actually :) Same result.
> 
>> -----Opprinnelig melding-----
>> Fra: Greg Brown [mailto:gk_brown@verizon.net]
>> Sendt: 19. august 2011 14:39
>> Til: user@pivot.apache.org
>> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
>> 
>> Try calling setRootDirectory() with the parent directory of the file you
>> want to select.
>> 
>> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
>> 
>>> I want to select a spesific  folder after the sheet is opened, but nothing
>> is selected:
>>> 
>>> FileBrowserSheet browser = new
>> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
>>> browser.getWindowStateListeners().add(new
>> WindowStateListener.Adapter() {
>>> 	public void windowOpened(Window window) {
>>> 			browser.setSelectedFile(lastTarget);
>>> 	}
>>> });
>>> browser.open(...)
>>> 
>>> FileBrowserSheet. selectedFiles is updated with the selection, and
>> selectedFilesChanged is fired. Any idea what's wrong?
>>> 
>>> -- Edvin
> 


SV: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Edvin Syse <es...@syse.no>.
That's the first thing i tried actually :) Same result.

> -----Opprinnelig melding-----
> Fra: Greg Brown [mailto:gk_brown@verizon.net]
> Sendt: 19. august 2011 14:39
> Til: user@pivot.apache.org
> Emne: Re: FileBrowserSheet#setSelectedFile() does not take effect
> 
> Try calling setRootDirectory() with the parent directory of the file you
> want to select.
> 
> On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:
> 
> > I want to select a spesific  folder after the sheet is opened, but nothing
> is selected:
> >
> > FileBrowserSheet browser = new
> FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
> > browser.getWindowStateListeners().add(new
> WindowStateListener.Adapter() {
> > 	public void windowOpened(Window window) {
> > 			browser.setSelectedFile(lastTarget);
> > 	}
> > });
> > browser.open(...)
> >
> > FileBrowserSheet. selectedFiles is updated with the selection, and
> selectedFilesChanged is fired. Any idea what's wrong?
> >
> > -- Edvin


Re: FileBrowserSheet#setSelectedFile() does not take effect

Posted by Greg Brown <gk...@verizon.net>.
Try calling setRootDirectory() with the parent directory of the file you want to select.

On Aug 19, 2011, at 8:20 AM, Edvin Syse wrote:

> I want to select a spesific  folder after the sheet is opened, but nothing is selected:
> 
> FileBrowserSheet browser = new FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
> browser.getWindowStateListeners().add(new WindowStateListener.Adapter() {
> 	public void windowOpened(Window window) {
> 			browser.setSelectedFile(lastTarget);
> 	}
> });
> browser.open(...)
> 
> FileBrowserSheet. selectedFiles is updated with the selection, and selectedFilesChanged is fired. Any idea what's wrong?
> 
> -- Edvin