1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.actionlist.web; |
18 | |
|
19 | |
import org.displaytag.decorator.TableDecorator; |
20 | |
import org.kuali.rice.kew.actionitem.ActionItemActionListExtension; |
21 | |
import org.kuali.rice.kew.actionlist.DisplayParameters; |
22 | |
import org.kuali.rice.kew.util.KEWConstants; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public class ActionListDecorator extends TableDecorator { |
31 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ActionListDecorator.class); |
32 | |
|
33 | 0 | private int rowCounter = 0; |
34 | |
|
35 | |
@Override |
36 | |
public String startRow() { |
37 | 0 | return ""; |
38 | |
} |
39 | |
|
40 | |
@Override |
41 | |
public String finishRow() { |
42 | 0 | ActionItemActionListExtension actionItem = (ActionItemActionListExtension) getCurrentRowObject(); |
43 | 0 | String returnRow = ""; |
44 | |
try { |
45 | 0 | DisplayParameters displayParameters = actionItem.getDisplayParameters(); |
46 | 0 | if (displayParameters != null) { |
47 | 0 | Integer index = actionItem.getActionItemIndex(); |
48 | 0 | Integer frameHeight = new Integer(290); |
49 | |
try { |
50 | 0 | if (displayParameters.getFrameHeight() != null && displayParameters.getFrameHeight() > 0) { |
51 | 0 | frameHeight = displayParameters.getFrameHeight(); |
52 | |
} |
53 | 0 | } catch (Exception ex) { |
54 | 0 | LOG.error("Error getting custom action list frame height.", ex); |
55 | 0 | } |
56 | 0 | StringBuffer newRow = new StringBuffer(); |
57 | 0 | newRow.append("<tr id='G"); |
58 | 0 | newRow.append(index.toString()); |
59 | 0 | newRow.append("' style='display: none;'>"); |
60 | 0 | newRow.append("<td class='white' height='0' colspan='11' >"); |
61 | 0 | newRow.append("<iframe name='iframeAL_"); |
62 | 0 | newRow.append(index.toString()); |
63 | 0 | newRow.append("' scrolling='yes' width=100% height="); |
64 | 0 | newRow.append(frameHeight.toString()); |
65 | 0 | newRow.append(" hspace=0 vspace=0 frameborder=0></iframe>"); |
66 | 0 | newRow.append("</td></tr>"); |
67 | 0 | returnRow += newRow.toString(); |
68 | |
} |
69 | 0 | } catch (Exception e) { |
70 | 0 | LOG.error("Error with custom action list attribute.", e); |
71 | 0 | } |
72 | 0 | return returnRow; |
73 | |
} |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
@Override |
81 | |
public String addRowClass() { |
82 | 0 | ActionItemActionListExtension actionItem = (ActionItemActionListExtension) getCurrentRowObject(); |
83 | 0 | return "actionlist_" + KEWConstants.ACTION_LIST_COLOR_NAMES.get(actionItem.getRowStyleClass()); |
84 | |
} |
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
@Override |
93 | |
public String addRowId() { |
94 | 0 | return "actionlist_tr_" + rowCounter++; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
@Override |
103 | |
public void finish() { |
104 | 0 | super.finish(); |
105 | 0 | rowCounter = 0; |
106 | 0 | } |
107 | |
|
108 | |
} |