View Javadoc
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.element;
17  
18  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19  import org.kuali.rice.krad.uif.component.Component;
20  import org.kuali.rice.krad.uif.component.ComponentBase;
21  import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
22  
23  /**
24   * Base component class for content elements.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  @BeanTag(name = "contentElement", parent = "Uif-ContentElementBase")
29  public abstract class ContentElementBase extends ComponentBase implements ContentElement {
30      private static final long serialVersionUID = 5816584444025193540L;
31  
32      public ContentElementBase() {
33          super();
34      }
35  
36      @Override
37      public String getComponentTypeName() {
38          return "element";
39      }
40  
41      /**
42       * Inherits read-only from the parent component if not explicitly populated.
43       * 
44       * {@inheritDoc}
45       */
46      @Override
47      public void afterEvaluateExpression() {
48          super.afterEvaluateExpression();
49          
50          if (getReadOnly() == null) {
51              Component parent = ViewLifecycle.getPhase().getParent();
52              setReadOnly(parent == null ? null : parent.getReadOnly());
53          }
54      }
55  
56  
57  }