1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.container;
17
18 import com.google.common.collect.Lists;
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.rice.core.api.exception.RiceRuntimeException;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
24 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
25 import org.kuali.rice.krad.datadictionary.validator.Validator;
26 import org.kuali.rice.krad.uif.UifConstants;
27 import org.kuali.rice.krad.uif.UifParameters;
28 import org.kuali.rice.krad.uif.component.BindingInfo;
29 import org.kuali.rice.krad.uif.component.ClientSideState;
30 import org.kuali.rice.krad.uif.component.Component;
31 import org.kuali.rice.krad.uif.component.ComponentSecurity;
32 import org.kuali.rice.krad.uif.component.DataBinding;
33 import org.kuali.rice.krad.uif.element.Action;
34 import org.kuali.rice.krad.uif.element.Message;
35 import org.kuali.rice.krad.uif.field.DataField;
36 import org.kuali.rice.krad.uif.field.Field;
37 import org.kuali.rice.krad.uif.util.ComponentFactory;
38 import org.kuali.rice.krad.uif.util.ComponentUtils;
39 import org.kuali.rice.krad.uif.view.View;
40 import org.kuali.rice.krad.uif.widget.QuickFinder;
41
42 import java.util.ArrayList;
43 import java.util.List;
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 @BeanTags({@BeanTag(name = "collectionGroup-bean", parent = "Uif-CollectionGroupBase"),
66 @BeanTag(name = "stackedCollectionGroup-bean", parent = "Uif-StackedCollectionGroup"),
67 @BeanTag(name = "stackedCollectionSection-bean", parent = "Uif-StackedCollectionSection"),
68 @BeanTag(name = "stackedCollectionSubSection-bean", parent = "Uif-StackedCollectionSubSection"),
69 @BeanTag(name = "stackedSubCollection-withinSection-bean", parent = "Uif-StackedSubCollection-WithinSection"),
70 @BeanTag(name = "stackedSubCollection-withinSubSection-bean", parent = "Uif-StackedSubCollection-WithinSubSection"),
71 @BeanTag(name = "disclosure-stackedCollectionSection-bean", parent = "Uif-Disclosure-StackedCollectionSection"),
72 @BeanTag(name = "disclosure-stackedCollectionSubSection-bean",
73 parent = "Uif-Disclosure-StackedCollectionSubSection"),
74 @BeanTag(name = "disclosure-stackedSubCollection-withinSection-bean",
75 parent = "Uif-Disclosure-StackedSubCollection-WithinSection"),
76 @BeanTag(name = "disclosure-stackedSubCollection-withinSubSection-bean",
77 parent = "Uif-Disclosure-StackedSubCollection-WithinSubSection"),
78 @BeanTag(name = "tableCollectionGroup-bean", parent = "Uif-TableCollectionGroup"),
79 @BeanTag(name = "tableCollectionSection-bean", parent = "Uif-TableCollectionSection"),
80 @BeanTag(name = "tableCollectionSubSection-bean", parent = "Uif-TableCollectionSubSection"),
81 @BeanTag(name = "tableSubCollection-withinSection-bean", parent = "Uif-TableSubCollection-WithinSection"),
82 @BeanTag(name = "tableSubCollection-withinSubSection-bean", parent = "Uif-TableSubCollection-WithinSubSection"),
83 @BeanTag(name = "disclosure-tableCollectionSection-bean", parent = "Uif-Disclosure-TableCollectionSection"),
84 @BeanTag(name = "disclosure-tableCollectionSubSection-bean", parent = "Uif-Disclosure-TableCollectionSubSection"),
85 @BeanTag(name = "disclosure-tableSubCollection-withinSection-bean",
86 parent = "Uif-Disclosure-TableSubCollection-WithinSection"),
87 @BeanTag(name = "disclosure-tableSubCollection-withinSubSection-bean",
88 parent = "Uif-Disclosure-TableSubCollection-WithinSubSection"),
89 @BeanTag(name = "listCollectionGroup-bean", parent = "Uif-ListCollectionGroup"),
90 @BeanTag(name = "listCollectionSection-bean", parent = "Uif-ListCollectionSection"),
91 @BeanTag(name = "listCollectionSubSection-bean", parent = "Uif-ListCollectionSubSection"),
92 @BeanTag(name = "documentNotesSection-bean", parent = "Uif-DocumentNotesSection"),
93 @BeanTag(name = "lookupResultsCollectionSection-bean", parent = "Uif-LookupResultsCollectionSection"),
94 @BeanTag(name = "maintenanceStackedCollectionSection-bean", parent = "Uif-MaintenanceStackedCollectionSection"),
95 @BeanTag(name = "maintenanceStackedSubCollection-withinSection-bean",
96 parent = "Uif-MaintenanceStackedSubCollection-WithinSection"),
97 @BeanTag(name = "maintenanceTableCollectionSection-bean", parent = "Uif-MaintenanceTableCollectionSection"),
98 @BeanTag(name = "maintenanceTableSubCollection-withinSection-bean",
99 parent = "Uif-MaintenanceTableSubCollection-withinSection")})
100 public class CollectionGroup extends Group implements DataBinding {
101 private static final long serialVersionUID = -6496712566071542452L;
102
103 private Class<?> collectionObjectClass;
104
105 private String propertyName;
106 private BindingInfo bindingInfo;
107
108 private boolean renderAddLine;
109 private String addLinePropertyName;
110 private BindingInfo addLineBindingInfo;
111
112 private Message addLineLabel;
113 private List<? extends Component> addLineItems;
114 private List<Action> addLineActions;
115
116 private boolean renderLineActions;
117 private List<Action> lineActions;
118
119 private boolean includeLineSelectionField;
120 private String lineSelectPropertyName;
121
122 private QuickFinder collectionLookup;
123
124 private boolean renderInactiveToggleButton;
125 @ClientSideState(variableName = "inactive")
126 private boolean showInactiveLines;
127 private CollectionFilter activeCollectionFilter;
128 private List<CollectionFilter> filters;
129
130 private List<CollectionGroup> subCollections;
131 private String subCollectionSuffix;
132
133 private CollectionGroupBuilder collectionGroupBuilder;
134
135 private int displayCollectionSize = -1;
136
137 private boolean highlightNewItems;
138 private boolean highlightAddItem;
139 private String newItemsCssClass;
140 private String addItemCssClass;
141
142 private boolean renderAddBlankLineButton;
143 private Action addBlankLineAction;
144 private String addLinePlacement;
145
146 private boolean renderSaveLineActions;
147 private boolean addViaLightBox;
148 private Action addViaLightBoxAction;
149
150 private boolean useServerPaging = false;
151 private int displayStart = -1;
152 private int displayLength = -1;
153 private int filteredCollectionSize = -1;
154
155 private List<String> totalColumns;
156
157 public CollectionGroup() {
158 renderAddLine = true;
159 renderLineActions = true;
160 renderInactiveToggleButton = true;
161 highlightNewItems = true;
162 highlightAddItem = true;
163 addLinePlacement = "TOP";
164
165 filters = new ArrayList<CollectionFilter>();
166 lineActions = new ArrayList<Action>();
167 addLineItems = new ArrayList<Field>();
168 addLineActions = new ArrayList<Action>();
169 subCollections = new ArrayList<CollectionGroup>();
170 }
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188 @Override
189 public void performInitialization(View view, Object model) {
190 setFieldBindingObjectPath(getBindingInfo().getBindingObjectPath());
191
192 super.performInitialization(view, model);
193
194 if (bindingInfo != null) {
195 bindingInfo.setDefaults(view, getPropertyName());
196 }
197
198 if (addLineBindingInfo != null) {
199
200 if (StringUtils.isNotBlank(addLinePropertyName)) {
201 addLineBindingInfo.setDefaults(view, getPropertyName());
202 addLineBindingInfo.setBindingName(addLinePropertyName);
203 if (StringUtils.isNotBlank(getFieldBindByNamePrefix())) {
204 addLineBindingInfo.setBindByNamePrefix(getFieldBindByNamePrefix());
205 }
206 }
207 }
208
209 for (Component item : getItems()) {
210 if (item instanceof DataField) {
211 DataField field = (DataField) item;
212
213 if (StringUtils.isBlank(field.getDictionaryObjectEntry())) {
214 field.setDictionaryObjectEntry(collectionObjectClass.getName());
215 }
216 }
217 }
218
219 if ((addLineItems == null) || addLineItems.isEmpty()) {
220 addLineItems = getItems();
221 } else {
222 for (Component addLineField : addLineItems) {
223 if (!(addLineField instanceof DataField)) {
224 continue;
225 }
226
227 DataField field = (DataField) addLineField;
228
229 if (StringUtils.isBlank(field.getDictionaryObjectEntry())) {
230 field.setDictionaryObjectEntry(collectionObjectClass.getName());
231 }
232 }
233 }
234
235
236 if (this.activeCollectionFilter == null) {
237 activeCollectionFilter = new ActiveCollectionFilter();
238 }
239
240
241 String collectionPath = "";
242 if (StringUtils.isNotBlank(getBindingInfo().getCollectionPath())) {
243 collectionPath += getBindingInfo().getCollectionPath() + ".";
244 }
245 if (StringUtils.isNotBlank(getBindingInfo().getBindByNamePrefix())) {
246 collectionPath += getBindingInfo().getBindByNamePrefix() + ".";
247 }
248 collectionPath += getBindingInfo().getBindingName();
249
250 List<DataField> collectionFields = ComponentUtils.getComponentsOfTypeDeep(getItems(), DataField.class);
251 for (DataField collectionField : collectionFields) {
252 collectionField.getBindingInfo().setCollectionPath(collectionPath);
253 }
254
255 List<DataField> addLineCollectionFields = ComponentUtils.getComponentsOfTypeDeep(addLineItems, DataField.class);
256 for (DataField collectionField : addLineCollectionFields) {
257 collectionField.getBindingInfo().setCollectionPath(collectionPath);
258 }
259
260 for (CollectionGroup collectionGroup : getSubCollections()) {
261 collectionGroup.getBindingInfo().setCollectionPath(collectionPath);
262 }
263
264
265 if (!view.getObjectPathToConcreteClassMapping().containsKey(collectionPath)) {
266 view.getObjectPathToConcreteClassMapping().put(collectionPath, getCollectionObjectClass());
267 }
268 }
269
270
271
272
273
274
275
276
277 @Override
278 public void performApplyModel(View view, Object model, Component parent) {
279 super.performApplyModel(view, model, parent);
280
281
282 if (this.renderAddBlankLineButton) {
283 if (this.addBlankLineAction == null) {
284 this.addBlankLineAction = (Action) ComponentFactory.getNewComponentInstance(
285 ComponentFactory.ADD_BLANK_LINE_ACTION);
286 view.assignComponentIds(this.addBlankLineAction);
287 }
288
289 if (addLinePlacement.equals(UifConstants.Position.BOTTOM.name())) {
290 this.addBlankLineAction.setOnClickScript("writeCurrentPageToSession(this, 'last');");
291 } else {
292 this.addBlankLineAction.setOnClickScript("writeCurrentPageToSession(this, 'first');");
293 }
294 } else if (this.addViaLightBox) {
295 if (this.addViaLightBoxAction == null) {
296 this.addViaLightBoxAction = (Action) ComponentFactory.getNewComponentInstance(
297 ComponentFactory.ADD_VIA_LIGHTBOX_ACTION);
298 view.assignComponentIds(this.addViaLightBoxAction);
299 }
300
301 if (this.addLinePlacement.equals(UifConstants.Position.BOTTOM.name())) {
302 this.addViaLightBoxAction.setOnClickScript("writeCurrentPageToSession(this, 'last');");
303 } else {
304 this.addViaLightBoxAction.setOnClickScript("writeCurrentPageToSession(this, 'first');");
305 }
306 }
307
308 pushCollectionGroupToReference();
309
310
311 if (isRender()) {
312 getCollectionGroupBuilder().build(view, model, this);
313 }
314
315
316
317 pushCollectionGroupToReference();
318 }
319
320
321
322
323
324 protected void pushCollectionGroupToReference() {
325 List<Component> components = getComponentsForLifecycle();
326 components.addAll(getComponentPrototypes());
327
328 ComponentUtils.pushObjectToContext(components, UifConstants.ContextVariableNames.COLLECTION_GROUP, this);
329
330 List<Action> actions = ComponentUtils.getComponentsOfTypeDeep(components, Action.class);
331 for (Action action : actions) {
332 action.addActionParameter(UifParameters.SELLECTED_COLLECTION_PATH, this.getBindingInfo().getBindingPath());
333 }
334 }
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349 public void initializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup,
350 boolean clearExistingLine) {
351 getCollectionGroupBuilder().initializeNewCollectionLine(view, model, collectionGroup, clearExistingLine);
352 }
353
354
355
356
357 @Override
358 public List<Component> getComponentsForLifecycle() {
359 List<Component> components = super.getComponentsForLifecycle();
360
361 components.add(addLineLabel);
362 components.add(collectionLookup);
363 components.add(addBlankLineAction);
364 components.add(addViaLightBoxAction);
365
366
367
368 for (Component item : getItems()) {
369 if (components.contains(item)) {
370 components.remove(item);
371 }
372 }
373
374 return components;
375 }
376
377
378
379
380 @Override
381 public List<Component> getComponentPrototypes() {
382 List<Component> components = super.getComponentPrototypes();
383
384 components.addAll(lineActions);
385 components.addAll(addLineActions);
386 components.addAll(getItems());
387 components.addAll(getSubCollections());
388
389
390
391 if (addLineItems != null) {
392 for (Component addLineItem : addLineItems) {
393 if (!components.contains(addLineItem)) {
394 components.add(addLineItem);
395 }
396 }
397 }
398
399 return components;
400 }
401
402
403
404
405
406
407
408 @BeanTagAttribute(name = "collectionObjectClass")
409 public Class<?> getCollectionObjectClass() {
410 return this.collectionObjectClass;
411 }
412
413
414
415
416
417
418 public void setCollectionObjectClass(Class<?> collectionObjectClass) {
419 this.collectionObjectClass = collectionObjectClass;
420 }
421
422
423
424
425 @BeanTagAttribute(name = "propertyName")
426 public String getPropertyName() {
427 return this.propertyName;
428 }
429
430
431
432
433
434
435 public void setPropertyName(String propertyName) {
436 this.propertyName = propertyName;
437 }
438
439
440
441
442
443
444
445
446 @BeanTagAttribute(name = "bindingInfo", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
447 public BindingInfo getBindingInfo() {
448 return this.bindingInfo;
449 }
450
451
452
453
454
455
456 public void setBindingInfo(BindingInfo bindingInfo) {
457 this.bindingInfo = bindingInfo;
458 }
459
460
461
462
463
464
465
466 @BeanTagAttribute(name = "lineActions", type = BeanTagAttribute.AttributeType.LISTBEAN)
467 public List<Action> getLineActions() {
468 return this.lineActions;
469 }
470
471
472
473
474
475
476 public void setLineActions(List<Action> lineActions) {
477 this.lineActions = lineActions;
478 }
479
480
481
482
483
484
485
486 @BeanTagAttribute(name = "renderLineActions")
487 public boolean isRenderLineActions() {
488 return this.renderLineActions;
489 }
490
491
492
493
494
495
496 public void setRenderLineActions(boolean renderLineActions) {
497 this.renderLineActions = renderLineActions;
498 }
499
500
501
502
503
504
505
506 @BeanTagAttribute(name = "renderAddLine")
507 public boolean isRenderAddLine() {
508 return this.renderAddLine;
509 }
510
511
512
513
514
515
516 public void setRenderAddLine(boolean renderAddLine) {
517 this.renderAddLine = renderAddLine;
518 }
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534 public String getAddLabel() {
535 if (getAddLineLabel() != null) {
536 return getAddLineLabel().getMessageText();
537 }
538
539 return null;
540 }
541
542
543
544
545
546
547 public void setAddLabel(String addLabelText) {
548 if (getAddLineLabel() != null) {
549 getAddLineLabel().setMessageText(addLabelText);
550 }
551 }
552
553
554
555
556
557
558
559 @BeanTagAttribute(name = "addLineLabel", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
560 public Message getAddLineLabel() {
561 return this.addLineLabel;
562 }
563
564
565
566
567
568
569
570 public void setAddLineLabel(Message addLineLabel) {
571 this.addLineLabel = addLineLabel;
572 }
573
574
575
576
577
578
579
580
581
582 @BeanTagAttribute(name = "addLinePropertyName")
583 public String getAddLinePropertyName() {
584 return this.addLinePropertyName;
585 }
586
587
588
589
590
591
592 public void setAddLinePropertyName(String addLinePropertyName) {
593 this.addLinePropertyName = addLinePropertyName;
594 }
595
596
597
598
599
600
601
602
603
604
605
606 @BeanTagAttribute(name = "addLineBindingInfo", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
607 public BindingInfo getAddLineBindingInfo() {
608 return this.addLineBindingInfo;
609 }
610
611
612
613
614
615
616 public void setAddLineBindingInfo(BindingInfo addLineBindingInfo) {
617 this.addLineBindingInfo = addLineBindingInfo;
618 }
619
620
621
622
623
624
625
626
627
628 @BeanTagAttribute(name = "addLineItems", type = BeanTagAttribute.AttributeType.LISTBEAN)
629 public List<? extends Component> getAddLineItems() {
630 return this.addLineItems;
631 }
632
633
634
635
636
637
638 public void setAddLineItems(List<? extends Component> addLineItems) {
639 this.addLineItems = addLineItems;
640 }
641
642
643
644
645
646
647
648
649 @BeanTagAttribute(name = "addLineActions", type = BeanTagAttribute.AttributeType.LISTBEAN)
650 public List<Action> getAddLineActions() {
651 return this.addLineActions;
652 }
653
654
655
656
657
658
659 public void setAddLineActions(List<Action> addLineActions) {
660 this.addLineActions = addLineActions;
661 }
662
663
664
665
666
667
668
669
670
671
672
673
674 @BeanTagAttribute(name = "includeLineSelectionField")
675 public boolean isIncludeLineSelectionField() {
676 return includeLineSelectionField;
677 }
678
679
680
681
682
683
684 public void setIncludeLineSelectionField(boolean includeLineSelectionField) {
685 this.includeLineSelectionField = includeLineSelectionField;
686 }
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706 @BeanTagAttribute(name = "lineSelectPropertyName")
707 public String getLineSelectPropertyName() {
708 return lineSelectPropertyName;
709 }
710
711
712
713
714
715
716 public void setLineSelectPropertyName(String lineSelectPropertyName) {
717 this.lineSelectPropertyName = lineSelectPropertyName;
718 }
719
720
721
722
723
724
725
726
727
728
729
730
731 @BeanTagAttribute(name = "collectionLookup", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
732 public QuickFinder getCollectionLookup() {
733 return collectionLookup;
734 }
735
736
737
738
739
740
741 public void setCollectionLookup(QuickFinder collectionLookup) {
742 this.collectionLookup = collectionLookup;
743 }
744
745
746
747
748
749
750
751
752
753
754
755
756
757 @BeanTagAttribute(name = "showInactiveLines")
758 public boolean isShowInactiveLines() {
759 return showInactiveLines;
760 }
761
762
763
764
765
766
767 public void setShowInactiveLines(boolean showInactiveLines) {
768 this.showInactiveLines = showInactiveLines;
769 }
770
771
772
773
774
775
776
777 @BeanTagAttribute(name = "activeCollectionFilter", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
778 public CollectionFilter getActiveCollectionFilter() {
779 return activeCollectionFilter;
780 }
781
782
783
784
785
786
787
788 public void setActiveCollectionFilter(CollectionFilter activeCollectionFilter) {
789 this.activeCollectionFilter = activeCollectionFilter;
790 }
791
792
793
794
795
796
797
798 @BeanTagAttribute(name = "filters", type = BeanTagAttribute.AttributeType.LISTBEAN)
799 public List<CollectionFilter> getFilters() {
800 return filters;
801 }
802
803
804
805
806
807
808 public void setFilters(List<CollectionFilter> filters) {
809 this.filters = filters;
810 }
811
812
813
814
815
816
817
818 @BeanTagAttribute(name = "subCollections", type = BeanTagAttribute.AttributeType.LISTBEAN)
819 public List<CollectionGroup> getSubCollections() {
820 return this.subCollections;
821 }
822
823
824
825
826
827
828 public void setSubCollections(List<CollectionGroup> subCollections) {
829 this.subCollections = subCollections;
830 }
831
832
833
834
835
836
837
838
839
840
841 public String getSubCollectionSuffix() {
842 return subCollectionSuffix;
843 }
844
845
846
847
848
849
850
851 public void setSubCollectionSuffix(String subCollectionSuffix) {
852 this.subCollectionSuffix = subCollectionSuffix;
853 }
854
855
856
857
858
859
860 public CollectionGroupSecurity getCollectionGroupSecurity() {
861 return (CollectionGroupSecurity) super.getComponentSecurity();
862 }
863
864
865
866
867
868
869 @Override
870 public void setComponentSecurity(ComponentSecurity componentSecurity) {
871 if (!(componentSecurity instanceof CollectionGroupSecurity)) {
872 throw new RiceRuntimeException(
873 "Component security for CollectionGroup should be instance of CollectionGroupSecurity");
874 }
875
876 super.setComponentSecurity(componentSecurity);
877 }
878
879 @Override
880 protected Class<? extends ComponentSecurity> getComponentSecurityClass() {
881 return CollectionGroupSecurity.class;
882 }
883
884
885
886
887
888
889
890 @BeanTagAttribute(name = "collectionGroupBuilder", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
891 public CollectionGroupBuilder getCollectionGroupBuilder() {
892 if (this.collectionGroupBuilder == null) {
893 this.collectionGroupBuilder = new CollectionGroupBuilder();
894 }
895 return this.collectionGroupBuilder;
896 }
897
898
899
900
901
902
903 public void setCollectionGroupBuilder(CollectionGroupBuilder collectionGroupBuilder) {
904 this.collectionGroupBuilder = collectionGroupBuilder;
905 }
906
907
908
909
910 public void setRenderInactiveToggleButton(boolean renderInactiveToggleButton) {
911 this.renderInactiveToggleButton = renderInactiveToggleButton;
912 }
913
914
915
916
917 @BeanTagAttribute(name = "renderInactiveToggleButton")
918 public boolean isRenderInactiveToggleButton() {
919 return renderInactiveToggleButton;
920 }
921
922
923
924
925
926
927 @BeanTagAttribute(name = "displayCollectionSize")
928 public int getDisplayCollectionSize() {
929 return this.displayCollectionSize;
930 }
931
932
933
934
935
936
937 public void setDisplayCollectionSize(int displayCollectionSize) {
938 this.displayCollectionSize = displayCollectionSize;
939 }
940
941
942
943
944
945
946 @BeanTagAttribute(name = "highlightNewItems")
947 public boolean isHighlightNewItems() {
948 return highlightNewItems;
949 }
950
951
952
953
954
955
956 public void setHighlightNewItems(boolean highlightNewItems) {
957 this.highlightNewItems = highlightNewItems;
958 }
959
960
961
962
963
964
965 @BeanTagAttribute(name = "newItemsCssClass")
966 public String getNewItemsCssClass() {
967 return newItemsCssClass;
968 }
969
970
971
972
973
974
975 public void setNewItemsCssClass(String newItemsCssClass) {
976 this.newItemsCssClass = newItemsCssClass;
977 }
978
979
980
981
982
983
984 @BeanTagAttribute(name = "addItemCssClass")
985 public String getAddItemCssClass() {
986 return addItemCssClass;
987 }
988
989
990
991
992
993
994 public void setAddItemCssClass(String addItemCssClass) {
995 this.addItemCssClass = addItemCssClass;
996 }
997
998
999
1000
1001
1002
1003 @BeanTagAttribute(name = "highlightAddItem")
1004 public boolean isHighlightAddItem() {
1005 return highlightAddItem;
1006 }
1007
1008
1009
1010
1011
1012
1013 public void setHighlightAddItem(boolean highlightAddItem) {
1014 this.highlightAddItem = highlightAddItem;
1015 }
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027 @BeanTagAttribute(name = "renderAddBlankLineButton")
1028 public boolean isRenderAddBlankLineButton() {
1029 return renderAddBlankLineButton;
1030 }
1031
1032
1033
1034
1035
1036
1037 public void setRenderAddBlankLineButton(boolean renderAddBlankLineButton) {
1038 this.renderAddBlankLineButton = renderAddBlankLineButton;
1039 }
1040
1041
1042
1043
1044
1045
1046 @BeanTagAttribute(name = "addBlankLineAction", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1047 public Action getAddBlankLineAction() {
1048 return addBlankLineAction;
1049 }
1050
1051
1052
1053
1054
1055
1056 public void setAddBlankLineAction(Action addBlankLineAction) {
1057 this.addBlankLineAction = addBlankLineAction;
1058 }
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071 @BeanTagAttribute(name = "addLinePlacement")
1072 public String getAddLinePlacement() {
1073 return addLinePlacement;
1074 }
1075
1076
1077
1078
1079
1080
1081 public void setAddLinePlacement(String addLinePlacement) {
1082 this.addLinePlacement = addLinePlacement;
1083 }
1084
1085
1086
1087
1088
1089
1090 @BeanTagAttribute(name = "renderSaveLineActions")
1091 public boolean isRenderSaveLineActions() {
1092 return renderSaveLineActions;
1093 }
1094
1095
1096
1097
1098
1099
1100 public void setRenderSaveLineActions(boolean renderSaveLineActions) {
1101 this.renderSaveLineActions = renderSaveLineActions;
1102 }
1103
1104
1105
1106
1107
1108
1109 @BeanTagAttribute(name = "addViaLightBox")
1110 public boolean isAddViaLightBox() {
1111 return addViaLightBox;
1112 }
1113
1114
1115
1116
1117
1118
1119 public void setAddViaLightBox(boolean addViaLightBox) {
1120 this.addViaLightBox = addViaLightBox;
1121 }
1122
1123
1124
1125
1126
1127
1128 @BeanTagAttribute(name = "addViaLightBoxAction", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
1129 public Action getAddViaLightBoxAction() {
1130 return addViaLightBoxAction;
1131 }
1132
1133
1134
1135
1136
1137
1138 public void setAddViaLightBoxAction(Action addViaLightBoxAction) {
1139 this.addViaLightBoxAction = addViaLightBoxAction;
1140 }
1141
1142
1143
1144
1145
1146
1147 @BeanTagAttribute(name = "useServerPaging")
1148 public boolean isUseServerPaging() {
1149 return useServerPaging;
1150 }
1151
1152
1153
1154
1155
1156
1157 public void setUseServerPaging(boolean useServerPaging) {
1158 this.useServerPaging = useServerPaging;
1159 }
1160
1161
1162
1163
1164
1165
1166
1167
1168 public int getDisplayStart() {
1169 return displayStart;
1170 }
1171
1172
1173
1174
1175
1176
1177 public void setDisplayStart(int displayStart) {
1178 this.displayStart = displayStart;
1179 }
1180
1181
1182
1183
1184
1185
1186
1187
1188 public int getDisplayLength() {
1189 return displayLength;
1190 }
1191
1192
1193
1194
1195
1196
1197 public void setDisplayLength(int displayLength) {
1198 this.displayLength = displayLength;
1199 }
1200
1201
1202
1203
1204
1205
1206
1207
1208 public int getFilteredCollectionSize() {
1209 return filteredCollectionSize;
1210 }
1211
1212
1213
1214
1215
1216
1217
1218
1219 public void setFilteredCollectionSize(int filteredCollectionSize) {
1220 this.filteredCollectionSize = filteredCollectionSize;
1221 }
1222
1223
1224
1225
1226
1227 @BeanTagAttribute(name = "addTotalColumns")
1228 protected List<String> getTotalColumns() {
1229 return totalColumns;
1230 }
1231
1232
1233
1234
1235
1236
1237 protected void setTotalColumns(List<String> totalColumns) {
1238 this.totalColumns = totalColumns;
1239 }
1240
1241
1242
1243
1244 @Override
1245 public void completeValidation(ValidationTrace tracer) {
1246 tracer.addBean(this);
1247
1248
1249 if (getCollectionObjectClass() == null) {
1250 if (Validator.checkExpressions(this, "collectionObjectClass")) {
1251 String currentValues[] = {"collectionObjectClass = " + getCollectionObjectClass()};
1252 tracer.createWarning("CollectionObjectClass is not set (disregard if part of an abstract)",
1253 currentValues);
1254 }
1255 }
1256
1257 super.completeValidation(tracer.getCopy());
1258 }
1259
1260
1261
1262
1263 @Override
1264 protected <T> void copyProperties(T component) {
1265 super.copyProperties(component);
1266
1267 CollectionGroup collectionGroupCopy = (CollectionGroup) component;
1268
1269 collectionGroupCopy.setDisplayCollectionSize(this.displayCollectionSize);
1270 collectionGroupCopy.setActiveCollectionFilter(this.activeCollectionFilter);
1271
1272 if (this.addBlankLineAction != null) {
1273 collectionGroupCopy.setAddBlankLineAction((Action) this.addBlankLineAction.copy());
1274 }
1275
1276 collectionGroupCopy.setAddItemCssClass(this.addItemCssClass);
1277
1278 if (addLineItems != null) {
1279 List<Component> addLineItemsCopy = new ArrayList<Component>();
1280
1281 for (Component addLineItem : this.addLineItems) {
1282 addLineItemsCopy.add((Component) addLineItem.copy());
1283 }
1284
1285 collectionGroupCopy.setAddLineItems(addLineItemsCopy);
1286 }
1287
1288 if (addLineActions != null) {
1289 List<Action> addLineActionsCopy = new ArrayList<Action>();
1290
1291 for (Action addLineAction : this.addLineActions) {
1292 addLineActionsCopy.add((Action) addLineAction.copy());
1293 }
1294
1295 collectionGroupCopy.setAddLineActions(addLineActionsCopy);
1296 }
1297
1298 if (this.addLineBindingInfo != null) {
1299 collectionGroupCopy.setAddLineBindingInfo((BindingInfo) this.addLineBindingInfo.copy());
1300 }
1301
1302 if (this.addLineLabel != null) {
1303 collectionGroupCopy.setAddLineLabel((Message) this.addLineLabel.copy());
1304 }
1305
1306 collectionGroupCopy.setAddLinePlacement(this.addLinePlacement);
1307 collectionGroupCopy.setAddLinePropertyName(this.addLinePropertyName);
1308 collectionGroupCopy.setAddViaLightBox(this.addViaLightBox);
1309
1310 if (this.addViaLightBoxAction != null) {
1311 collectionGroupCopy.setAddViaLightBoxAction((Action) this.addViaLightBoxAction.copy());
1312 }
1313
1314 if (this.bindingInfo != null) {
1315 collectionGroupCopy.setBindingInfo((BindingInfo) this.bindingInfo.copy());
1316 }
1317
1318 if (this.collectionLookup != null) {
1319 collectionGroupCopy.setCollectionLookup((QuickFinder) this.collectionLookup.copy());
1320 }
1321
1322 collectionGroupCopy.setCollectionObjectClass(this.collectionObjectClass);
1323 collectionGroupCopy.setFilters(new ArrayList<CollectionFilter>(this.filters));
1324 collectionGroupCopy.setHighlightAddItem(this.highlightAddItem);
1325 collectionGroupCopy.setHighlightNewItems(this.highlightNewItems);
1326 collectionGroupCopy.setIncludeLineSelectionField(this.includeLineSelectionField);
1327 collectionGroupCopy.setUseServerPaging(this.useServerPaging);
1328
1329 if (lineActions != null) {
1330 List<Action> lineActions = new ArrayList<Action>();
1331 for (Action lineAction : this.lineActions) {
1332 lineActions.add((Action) lineAction.copy());
1333 }
1334
1335 collectionGroupCopy.setLineActions(lineActions);
1336 }
1337 collectionGroupCopy.setLineSelectPropertyName(this.lineSelectPropertyName);
1338 collectionGroupCopy.setNewItemsCssClass(this.newItemsCssClass);
1339 collectionGroupCopy.setPropertyName(this.propertyName);
1340 collectionGroupCopy.setRenderAddBlankLineButton(this.renderAddBlankLineButton);
1341 collectionGroupCopy.setRenderAddLine(this.renderAddLine);
1342 collectionGroupCopy.setRenderInactiveToggleButton(this.renderInactiveToggleButton);
1343 collectionGroupCopy.setActiveCollectionFilter(this.activeCollectionFilter);
1344 collectionGroupCopy.setFilters(this.filters);
1345
1346 collectionGroupCopy.setRenderLineActions(this.renderLineActions);
1347 collectionGroupCopy.setRenderSaveLineActions(this.renderSaveLineActions);
1348 collectionGroupCopy.setShowInactiveLines(this.showInactiveLines);
1349
1350 if (subCollections != null) {
1351 List<CollectionGroup> subCollectionsCopy = new ArrayList<CollectionGroup>();
1352 for (CollectionGroup subCollection : this.subCollections) {
1353 subCollectionsCopy.add((CollectionGroup) subCollection.copy());
1354 }
1355
1356 collectionGroupCopy.setSubCollections(subCollectionsCopy);
1357 }
1358 collectionGroupCopy.setSubCollectionSuffix(this.subCollectionSuffix);
1359
1360 if (this.totalColumns != null) {
1361 collectionGroupCopy.setTotalColumns(new ArrayList<String>(this.totalColumns));
1362 }
1363 }
1364 }