View Javadoc
1   /*
2    * Copyright 2009 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.ole.fp.document.web;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.ole.sys.document.web.renderers.CollectionPropertiesCurious;
20  import org.kuali.ole.sys.document.web.renderers.GroupTotalRenderer;
21  
22  /**
23   * 
24   */
25  public class ProcurementCardGroupTotalRenderer extends GroupTotalRenderer implements CollectionPropertiesCurious {
26      private String collectionProperty = null;
27      private String simpleTotalProperty = null;
28      
29      /**
30       * @see org.kuali.ole.sys.document.web.renderers.CollectionPropertiesCurious#setCollectionItemProperty(java.lang.String)
31       */
32      public void setCollectionItemProperty(String collectionItemProperty) {
33          // whoops, dropped it...
34      }
35  
36      /**
37       * @see org.kuali.ole.sys.document.web.renderers.CollectionPropertiesCurious#setCollectionProperty(java.lang.String)
38       */
39      public void setCollectionProperty(String collectionProperty) {
40          this.collectionProperty = collectionProperty;
41      }
42  
43      /**
44       * @see org.kuali.ole.sys.document.web.renderers.GroupTotalRenderer#clear()
45       */
46      @Override
47      public void clear() {
48          super.clear();
49          this.collectionProperty = null;
50          this.simpleTotalProperty = null;
51      }
52  
53      /**
54       * @see org.kuali.ole.sys.document.web.renderers.GroupTotalRenderer#getTotalProperty()
55       */
56      @Override
57      public String getTotalProperty() {
58          if (!StringUtils.isBlank(collectionProperty)) {
59              return collectionProperty.replaceFirst("\\.[a-z]+AccountingLines", "")+"."+simpleTotalProperty;
60          }
61          return simpleTotalProperty;
62      }
63  
64      /**
65       * @see org.kuali.ole.sys.document.web.renderers.GroupTotalRenderer#setTotalProperty(java.lang.String)
66       */
67      @Override
68      public void setTotalProperty(String totalProperty) {
69          this.simpleTotalProperty = totalProperty;
70      }
71  
72  }