View Javadoc

1   /**
2    * Copyright 2005-2013 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.view;
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.uif.UifConstants.ViewType;
21  
22  /**
23   * Type of <code>View</code> that provides a read-only display of a record of
24   * data (object instance)
25   *
26   * <p>
27   * The <code>InquiryView</code> provides the interface for the Inquiry
28   * framework. It works with the <code>Inquirable</code> service and inquiry
29   * controller. The view does render a form to support the configuration of
30   * actions to perform operations on the data.
31   * </p>
32   *
33   * <p>
34   * Inquiry views are primarily configured by the object class they are
35   * associated with. This provides the default dictionary information for the
36   * fields. If more than one inquiry view is needed for the same object class,
37   * the view name can be used to further identify an unique view
38   * </p>
39   *
40   * @author Kuali Rice Team (rice.collab@kuali.org)
41   */
42  @BeanTag(name = "inquiryView-bean", parent = "Uif-InquiryView")
43  public class InquiryView extends FormView {
44      private static final long serialVersionUID = 716926008488403616L;
45  
46      private Class<?> dataObjectClassName;
47  
48      public InquiryView() {
49          super();
50  
51          setViewTypeName(ViewType.INQUIRY);
52          setApplyDirtyCheck(false);
53          setTranslateCodesOnReadOnlyDisplay(true);
54      }
55  
56      /**
57       * The following initialization is performed:
58       *
59       * <ul>
60       * <li>Set the abstractTypeClasses map for the inquiry object path</li>
61       * </ul>
62       *
63       * @see org.kuali.rice.krad.uif.container.ContainerBase#performInitialization(org.kuali.rice.krad.uif.view.View, java.lang.Object)
64       */
65      @Override
66      public void performInitialization(View view, Object model) {
67          super.performInitialization(view, model);
68  
69          getObjectPathToConcreteClassMapping().put(getDefaultBindingObjectPath(), getDataObjectClassName());
70      }
71  
72      /**
73       * Class name for the object the inquiry applies to
74       *
75       * <p>
76       * The object class name is used to pick up a dictionary entry which will
77       * feed the attribute field definitions and other configuration. In addition
78       * it is used to configure the <code>Inquirable</code> which will carry out
79       * the inquiry action
80       * </p>
81       *
82       * @return inquiry object class
83       */
84      @BeanTagAttribute(name="dataObjectClassName")
85      public Class<?> getDataObjectClassName() {
86          return this.dataObjectClassName;
87      }
88  
89      /**
90       * Setter for the object class name
91       *
92       * @param dataObjectClassName
93       */
94      public void setDataObjectClassName(Class<?> dataObjectClassName) {
95          this.dataObjectClassName = dataObjectClassName;
96      }
97  
98      /**
99       * @see org.kuali.rice.krad.uif.component.ComponentBase#copy()
100      */
101     @Override
102     protected <T> void copyProperties(T component) {
103         super.copyProperties(component);
104         InquiryView inquiryViewCopy = (InquiryView) component;
105 
106         if(this.dataObjectClassName != null) {
107             inquiryViewCopy.setDataObjectClassName(this.getDataObjectClassName());
108         }
109 
110     }
111 }