View Javadoc

1   /*
2    * Copyright 2008 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.sys.document.web;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  import org.kuali.ole.sys.businessobject.AccountingLine;
22  import org.kuali.ole.sys.document.AccountingDocument;
23  import org.kuali.ole.sys.web.struts.KualiAccountingDocumentFormBase;
24  
25  /**
26   * A contract for classes which wish to provide information about an accounting line which is being rendered
27   */
28  public interface AccountingLineRenderingContext extends RenderableElement {
29      
30      /**
31       * @return the accounting line that would be rendered by the rendering of the given accounting line context
32       */
33      public abstract AccountingLine getAccountingLine();
34      
35      /**
36       * @return the property path from the form to the accounting line returned by the getAccountingLine() method
37       */
38      public abstract String getAccountingLinePropertyPath();
39      
40      /**
41       * @return a List of actions which can be performed on the given line
42       */
43      public abstract List<AccountingLineViewAction> getActionsForLine();
44      
45      /**
46       * Tells callers if fields should render help or not
47       * @return true if fields should render help, false otherwise
48       */
49      public abstract boolean fieldsShouldRenderHelp();
50      
51      /**
52       * Tells callers if dynamic field labels should even be rendered
53       * @return true if dynamic field labels can be labeled, false if they should not be labeled.
54       */
55      public abstract boolean fieldsCanRenderDynamicLabels();
56      
57      /**
58       * Reports whether the tag to be rendered by this rendering context is "new" - ie, not added yet to the accounting group, but living on the form somewhere - or not
59       * @return true if the line is new, false otherwise
60       */
61      public abstract boolean isNewLine();
62      
63      /**
64       * If this is a new line, returns null; if it is a line in a collection, returns the line number within that collection
65       * @return the current line count
66       */
67      public abstract Integer getCurrentLineCount();
68      
69      /**
70       * Returns all the field names for the given accounting line, prefixed by the accounting line property path
71       * @return a list of properly prefixed field names
72       */
73      public abstract List<String> getFieldNamesForAccountingLine();
74      
75      /**
76       * Returns a Map of all values from the request which were unconverted to actuall business objects
77       * @return the Map of unconverted values
78       */
79      public abstract Map getUnconvertedValues();
80      
81      /**
82       * Forces the population of values for all fields used to render the accounting line
83       */
84      public abstract void populateValuesForFields();
85      
86      /**
87       * @return the accounting document that this line to render is part of (or will be, once it is successfully added)
88       */
89      public abstract AccountingDocument getAccountingDocument();
90      
91      /**
92       * Returns the tab state for the given tab key on the current form
93       * @param tabKey the tab key to get the state of
94       * @return the state (either "OPEN" or "CLOSED")
95       */
96      public abstract String getTabState(String tabKey);
97      
98      /**
99       * Increments the tab index on the form this rendering is associated with
100      */
101     public abstract void incrementTabIndex();
102     
103     /**
104      * @return the label of the group this accounting line is part of
105      */
106     public abstract String getGroupLabel();
107     
108     /**
109      * @return the list of errors on the form
110      */
111     public abstract List getErrors();
112     
113     /**
114      * @return the form that the rendered accounting line will be associated with
115      */
116     public abstract KualiAccountingDocumentFormBase getForm();
117     
118     /**
119      * @return the property name of the object that contains the accounting lines
120      */
121     public abstract String getAccountingLineContainingObjectPropertyName();
122     
123     /**
124      * Determines whether a field is modifyable or not
125      * @param fieldName the simple name (that is, the name does not include the collection property) of the field
126      * @return true if the field can be modified, false if the field can only be read
127      */
128     public abstract boolean isFieldModifyable(String fieldName);
129     
130     /**
131      * Determines whether the accounting line is - as a whole line - editable or not
132      * @return true if the line - as a whole line - is editable, false if nothing on the line can be edited
133      */
134     public abstract boolean isEditableLine();
135     
136     /**
137      * Determines whether this line should be allowed to be deleted
138      * @return true if it should be allowed to be deleted, false otherwise
139      */
140     public abstract boolean allowDelete();
141     
142     /**
143      * Makes the line within this accounting line context deletable
144      */
145     public void makeDeletable();
146     
147     /**
148      * @return the number of cells that will actually be rendered (ie, colspans are taken into account)
149      */
150     public int getRenderableCellCount();
151     
152     /**
153      * Gets the rows attribute. 
154      * @return Returns the rows.
155      */
156     public List<AccountingLineTableRow> getRows();
157 }