BrightSide Workbench Full Report + Source Code
WorthSet.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2017 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.dossier.dossier;
20 
21 import java.util.TreeSet;
22 import org.turro.dossier.entity.Category;
23 import org.turro.dossier.entity.Dossier;
24 import org.turro.dossier.entity.WorthDefinition;
25 
30 public class WorthSet extends TreeSet<WorthDefinition> {
31 
32  private Dossier dossier;
33 
34  public WorthSet(Dossier dossier) {
35  super(new WorthComparator());
36  this.dossier = dossier;
37  initDossier(dossier);
38  }
39 
40  private void initDossier(Dossier dossier) {
41  Category current = dossier.getCategory();
42  while (current != null) {
43  addAll(current.getWorths());
44  current = current.getParent();
45  }
46  // map values
47  for (WorthDefinition wd : this) {
48  wd.assignDossier(dossier);
49  }
50  }
51 
52 //<#if container!true>
53 //<div id="${controlId!}">
54 //</#if>
55 //
56 //<table class="ui celled padded table">
57 // <#list dossier.worthSet as worth>
58 // <#if worth.grouping == 'Votacions'>
59 // <tr>
60 // <td style="text-align:center;">
61 // <div class="ui equal width grid">
62 // <#list worth.pairValues as pair>
63 // <div class="column">
64 // <a class="ui icon button" style="color:#fff;background-color:${pair.color};"
65 // onClick="${control.getVoteUrl(controlId, 1)?html}">
66 // ${pair.value}
67 // </a>
68 // </div>
69 // </#list>
70 // </div>
71 // </td>
72 // <td>
73 // <h3>${worth.title}</h3>
74 // ${worth.description}
75 // </td>
76 // </tr>
77 // </#if>
78 // </#list>
79 //</table>
80 
81 }
Set< WorthDefinition > getWorths()
Definition: Category.java:168