1 /**
2 * Copyright 2005-2016 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.uif.container;
17
18 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
21
22 /**
23 * Special <code>Group</code> that presents a grouping on links, which can
24 * also include nested groupings of links
25 *
26 * <p>
27 * Generally this group outputs a list of <code>LinkField</code> instances, however
28 * it can be configured to place separates between the fields and also delimiters
29 * for the grouping
30 * </p>
31 *
32 * @author Kuali Rice Team (rice.collab@kuali.org)
33 */
34 @BeanTags({@BeanTag(name = "linkGroup-bean", parent = "Uif-LinkGroup"),
35 @BeanTag(name = "linkSubGroup-bean", parent = "Uif-LinkSubGroup"),
36 @BeanTag(name = "lookupView-resultActions-bean", parent = "Uif-LookupView-ResultActions")})
37 public class LinkGroup extends Group {
38 private static final long serialVersionUID = -4173031543626881250L;
39
40 private String groupBeginDelimiter;
41 private String groupEndDelimiter;
42 private String linkSeparator;
43 private String emptyLinkGroupString;
44
45 public LinkGroup() {
46 super();
47 }
48
49 /**
50 * String that will be rendered before the group of links are rendered
51 *
52 * <p>
53 * If the list of links is empty, the start delimiter will not be
54 * rendered but instead the #emptyLinkGroupString will be outputted
55 * </p>
56 *
57 * e.g. '['
58 *
59 * @return group begin delimiter
60 */
61 @BeanTagAttribute(name = "groupBeginDelimiter")
62 public String getGroupBeginDelimiter() {
63 return groupBeginDelimiter;
64 }
65
66 /**
67 * Setter for the group begin delimiter
68 *
69 * @param groupBeginDelimiter
70 */
71 public void setGroupBeginDelimiter(String groupBeginDelimiter) {
72 this.groupBeginDelimiter = groupBeginDelimiter;
73 }
74
75 /**
76 * String that will be rendered after the group of links are rendered
77 *
78 * <p>
79 * If the list of links is empty, the end delimiter will not be
80 * rendered but instead the #emptyLinkGroupString will be outputted
81 * </p>
82 *
83 * e.g. ']'
84 *
85 * @return group end delimiter
86 */
87 @BeanTagAttribute(name = "groupEndDelimiter")
88 public String getGroupEndDelimiter() {
89 return groupEndDelimiter;
90 }
91
92 /**
93 * Setter for the group end delimiter
94 *
95 * @param groupEndDelimiter
96 */
97 public void setGroupEndDelimiter(String groupEndDelimiter) {
98 this.groupEndDelimiter = groupEndDelimiter;
99 }
100
101 /**
102 * String that will be rendered between each rendered link
103 *
104 * e.g. '|'
105 *
106 * @return link separator
107 */
108 @BeanTagAttribute(name = "linkSeparator")
109 public String getLinkSeparator() {
110 return linkSeparator;
111 }
112
113 /**
114 * Setter for the link separator
115 *
116 * @param linkSeparator
117 */
118 public void setLinkSeparator(String linkSeparator) {
119 this.linkSeparator = linkSeparator;
120 }
121
122 /**
123 * String that will be outputted when the list backing the
124 * link group is empty
125 *
126 * @return empty group string
127 */
128 @BeanTagAttribute(name = "emptyLinkGroupString")
129 public String getEmptyLinkGroupString() {
130 return emptyLinkGroupString;
131 }
132
133 /**
134 * Setter for the empty group string
135 *
136 * @param emptyLinkGroupString
137 */
138 public void setEmptyLinkGroupString(String emptyLinkGroupString) {
139 this.emptyLinkGroupString = emptyLinkGroupString;
140 }
141
142 /**
143 * @see org.kuali.rice.krad.uif.component.ComponentBase#copy()
144 */
145 @Override
146 protected <T> void copyProperties(T component) {
147 super.copyProperties(component);
148 LinkGroup linkGroupCopy = (LinkGroup) component;
149 linkGroupCopy.setGroupBeginDelimiter(this.getGroupBeginDelimiter());
150 linkGroupCopy.setGroupEndDelimiter(this.getGroupEndDelimiter());
151 linkGroupCopy.setLinkSeparator(this.getLinkSeparator());
152 linkGroupCopy.setEmptyLinkGroupString(this.getEmptyLinkGroupString());
153 }
154
155 }