[forge-dev] UIInputMany - Multiple file section

Rafael Pestano rmpestano at gmail.com
Tue Aug 18 21:09:27 EDT 2015


About setting values of UiInputMany I'm trying to add files to
an UIInputMany from a DirectoryResource but UIInputMany is not updated, see
example:


    @Inject
    @WithAttributes(label = "Select Files")
    private UIInputMany<FileResource<?>> files;

    @Inject
    @WithAttributes(label = "Select dir")
    private UIInput<DirectoryResource> dir;

    UIOutput out;


        @Override
public void initializeUI(UIBuilder uiBuilder) throws Exception {

dir.addValueChangeListener(new ValueChangeListener() {

@Override
public void valueChanged(ValueChangeEvent event) {
List<FileResource<?>> fileList = (List<FileResource<?>>) files.getValue();
DirectoryResource selectedDir = (DirectoryResource) event.getNewValue();
for (Resource<?>  resource : selectedDir.listResources()) {
FileResource<?> fileToAdd = resource.reify(FileResource.class);
if(fileToAdd != null && fileToAdd.exists() &&
!fileList.contains(fileToAdd)){
fileList.add(fileToAdd);
}
}
//files.setValue(fileList);
for (FileResource<?> fileResource : ((List<FileResource<?>>)
files.getValue())) {
out.out().println(fileResource.getName());
}

}

});
uiBuilder.add(dir).add(files);
}

Although file names are printed in the console the UI is not updated.

Also files are not added to fileList until I add a file using UIInputMany,
see this 30sec video: http://youtu.be/waJRpyGXIcw





2015-08-18 20:04 GMT-03:00 Rafael Pestano <rmpestano at gmail.com>:

> Also in Eclipse (mars) i just can add a file at a time in UIInputMany.
>
> 2015-08-18 15:36 GMT-03:00 George Gastaldi <ggastald at redhat.com>:
>
>> Yes, you can call UIInputMany.setValues or setDefaultValues in the
>> initializeUI method. I'll have a look at the UI behavior
>>
>> On Tue, Aug 18, 2015 at 3:30 PM, Rafael Pestano <rmpestano at gmail.com>
>> wrote:
>>
>>> I'm using forge  2.17.0
>>>
>>> 2015-08-18 15:29 GMT-03:00 Rafael Pestano <rmpestano at gmail.com>:
>>>
>>>> Another question, can I feed/initialize the UIInputMany with values on
>>>> initializeUI method?
>>>>
>>>> 2015-08-18 15:24 GMT-03:00 Rafael Pestano <rmpestano at gmail.com>:
>>>>
>>>>> Hi George,
>>>>>
>>>>> I'm on Intellij
>>>>>
>>>>> 2015-08-18 15:07 GMT-03:00 George Gastaldi <ggastald at redhat.com>:
>>>>>
>>>>>> Yes, that's how it should work. What UI are you using? Eclipse?
>>>>>>
>>>>>> On Tue, Aug 18, 2015 at 3:00 PM, Rafael Pestano <rmpestano at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi guys,
>>>>>>>
>>>>>>> there is a way to select multiple files *at once *using UIInputMany?
>>>>>>>
>>>>>>> Here the way way i'm using it:
>>>>>>>
>>>>>>> @Inject
>>>>>>> @WithAttributes(label = "Select Files")
>>>>>>> private UIInputMany<FileResource<?>> files;
>>>>>>>
>>>>>>>
>>>>>>> it promps the filesystem wizard to pick files but i can only select
>>>>>>> a single file at a time.
>>>>>>>
>>>>>>> --
>>>>>>> <http://www.advancedit.com.br/>Att,
>>>>>>>
>>>>>>> Rafael M. Pestano
>>>>>>>
>>>>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do
>>>>>>> Sul
>>>>>>> http://rpestano.wordpress.com/
>>>>>>> @realpestano <https://twitter.com/realpestano>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> forge-dev mailing list
>>>>>>> forge-dev at lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *George Gastaldi | Senior Software Engineer*
>>>>>>
>>>>>> JBoss Forge Team
>>>>>> T: +55 11 3524-6169
>>>>>> M: +55 47 9711-1000
>>>>>>
>>>>>> _______________________________________________
>>>>>> forge-dev mailing list
>>>>>> forge-dev at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> <http://www.advancedit.com.br/>Att,
>>>>>
>>>>> Rafael M. Pestano
>>>>>
>>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
>>>>> http://rpestano.wordpress.com/
>>>>> @realpestano <https://twitter.com/realpestano>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> <http://www.advancedit.com.br/>Att,
>>>>
>>>> Rafael M. Pestano
>>>>
>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
>>>> http://rpestano.wordpress.com/
>>>> @realpestano <https://twitter.com/realpestano>
>>>>
>>>
>>>
>>>
>>> --
>>> <http://www.advancedit.com.br/>Att,
>>>
>>> Rafael M. Pestano
>>>
>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
>>> http://rpestano.wordpress.com/
>>> @realpestano <https://twitter.com/realpestano>
>>>
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>
>>
>>
>> --
>> *George Gastaldi | Senior Software Engineer*
>>
>> JBoss Forge Team
>> T: +55 11 3524-6169
>> M: +55 47 9711-1000
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>
>
>
> --
> <http://www.advancedit.com.br/>Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> http://rpestano.wordpress.com/
> @realpestano <https://twitter.com/realpestano>
>



-- 
<http://www.advancedit.com.br/>Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano <https://twitter.com/realpestano>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20150818/4c1d3b40/attachment.html 


More information about the forge-dev mailing list