1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.docsearch; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Iterator; |
20 | |
import java.util.List; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class StandardDocSearchCriteriaManager implements java.io.Serializable { |
30 | |
|
31 | |
private static final long serialVersionUID = -1898076444679158722L; |
32 | |
|
33 | 0 | private List<List<StandardDocSearchCriteriaFieldContainer>> columnsPreSearchAttributes = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
34 | 0 | private List<List<StandardDocSearchCriteriaFieldContainer>> columnsPostSearchAttributes = new ArrayList<List<StandardDocSearchCriteriaFieldContainer>>(); |
35 | |
|
36 | 0 | public StandardDocSearchCriteriaManager(int preSearchAttributeColumns, int postSearchAttributeColumns, boolean searchCriteriaDisplayed, boolean headerBarDisplayed) { |
37 | 0 | setupColumns(preSearchAttributeColumns,postSearchAttributeColumns); |
38 | 0 | } |
39 | |
|
40 | |
private void setupColumns(int preSearchAttributeColumns, int postSearchAttributeColumns) { |
41 | 0 | for (int i = 0; i < preSearchAttributeColumns; i++) { |
42 | 0 | columnsPreSearchAttributes.add(new ArrayList<StandardDocSearchCriteriaFieldContainer>()); |
43 | |
} |
44 | 0 | for (int i = 0; i < postSearchAttributeColumns; i++) { |
45 | 0 | columnsPostSearchAttributes.add(new ArrayList<StandardDocSearchCriteriaFieldContainer>()); |
46 | |
} |
47 | 0 | } |
48 | |
|
49 | |
public List<StandardDocSearchCriteriaFieldContainer> getPreSearchAttributeMaxRows() { |
50 | 0 | return getMaxRowsForList(columnsPreSearchAttributes); |
51 | |
} |
52 | |
|
53 | |
public List<StandardDocSearchCriteriaFieldContainer> getPostSearchAttributeMaxRows() { |
54 | 0 | return getMaxRowsForList(columnsPostSearchAttributes); |
55 | |
} |
56 | |
|
57 | |
@SuppressWarnings("unchecked") |
58 | |
private List<StandardDocSearchCriteriaFieldContainer> getMaxRowsForList(List<List<StandardDocSearchCriteriaFieldContainer>> columns) { |
59 | 0 | List<StandardDocSearchCriteriaFieldContainer> biggestFieldContainerList = null; |
60 | 0 | for (Iterator iter = columns.iterator(); iter.hasNext();) { |
61 | 0 | List<StandardDocSearchCriteriaFieldContainer> fieldContainerList = (List<StandardDocSearchCriteriaFieldContainer>) iter.next(); |
62 | 0 | if (biggestFieldContainerList == null) { |
63 | 0 | biggestFieldContainerList = fieldContainerList; |
64 | |
} else { |
65 | 0 | if (fieldContainerList.size() > biggestFieldContainerList.size()) { |
66 | 0 | biggestFieldContainerList = fieldContainerList; |
67 | |
} |
68 | |
} |
69 | 0 | } |
70 | 0 | return biggestFieldContainerList; |
71 | |
} |
72 | |
|
73 | |
public int getMaxColumnCount() { |
74 | 0 | return Math.max(columnsPreSearchAttributes.size(), columnsPostSearchAttributes.size()); |
75 | |
} |
76 | |
|
77 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getColumnsPreSearchAttributes() { |
78 | 0 | return this.columnsPreSearchAttributes; |
79 | |
} |
80 | |
|
81 | |
public void setColumnsPreSearchAttributes(List<List<StandardDocSearchCriteriaFieldContainer>> columnsPreSearchAttributes) { |
82 | 0 | this.columnsPreSearchAttributes = columnsPreSearchAttributes; |
83 | 0 | } |
84 | |
|
85 | |
public List<List<StandardDocSearchCriteriaFieldContainer>> getColumnsPostSearchAttributes() { |
86 | 0 | return this.columnsPostSearchAttributes; |
87 | |
} |
88 | |
|
89 | |
public void setColumnsPostSearchAttributes(List<List<StandardDocSearchCriteriaFieldContainer>> columnsPostSearchAttributes) { |
90 | 0 | this.columnsPostSearchAttributes = columnsPostSearchAttributes; |
91 | 0 | } |
92 | |
|
93 | |
} |