5

I have a problem when trying to implement the configuration file of my plugin. I started my program with the already existing SideBar Plugin, but I encountered a problem when I added a List<String> as a variable to the class Action : private List<String> projects; How can I fill such a list within the jelly file?

I tried doing as such :

<f:entry>
 <f:optionalBlock title="Project to be considered :">
  <f:repeatable var="project" items="${link.projects}" name="projects" add="Add a project">
   <f:entry title="Project 1 :">
   </f:entry>
  </f:repeatable>      
 </f:optionalBlock>
</f:entry>

I added these lines in the links.jelly file, but it doesn't work.

If anyone knows how to do this, it would be great.

Thank you

Illidanek
  • 996
  • 1
  • 18
  • 32
Mtrompe
  • 351
  • 5
  • 15

2 Answers2

4

The list in your action should have a type (also for better reading)

private List<YourObject> projects

Then your config.jelly can look like this:

<f:repeatable var="projectInList" name="projects" items="${instance.projects}" noAddButton="true" minimum="0">
    <fieldset>
        <f:entry title="${%Project}" description="Project desc." 
                                field="variableInProjectObject">
            <f:textbox value="${projectInList.variableInProjectObject}" default="" />
        </f:entry>
    </fieldset>
</f:repeatable>
iwan.z
  • 552
  • 5
  • 8
0

I fixed similar problem this way:

<f:entry title="Parameters" field="projects">
   <f:repeatableProperty field="projects"  minimum="1" />  
</f:entry>

Thanks to this resource

Tatiana Goretskaya
  • 536
  • 10
  • 25