View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.core.util;
17  
18  import org.kuali.rice.krad.uif.field.DataField;
19  
20  public class GroupKeyDataField extends DataField implements SingleGroupKeyField {
21      String singleGroupKey = null;
22      public void singleGroupKeyCheck() {
23          if (TKUtils.singleGroupKeyExists())
24          {
25              singleGroupKey = TKUtils.getSingleGroupKey();
26          }
27      }
28  
29      public GroupKeyDataField() {
30          super();
31  
32          singleGroupKeyCheck();
33      }
34  
35      public boolean isReadOnly() {
36          if (TKUtils.singleGroupKeyExists())
37          {
38              return true;
39          }
40  
41          return super.isReadOnly();
42      }
43  
44      public String getForcedValue() {
45          if (TKUtils.singleGroupKeyExists())
46          {
47              return singleGroupKey;
48          }
49  
50          return super.getForcedValue();
51      }
52  
53      public boolean isAddHiddenWhenReadOnly() {
54          if (TKUtils.singleGroupKeyExists())
55          {
56              return true;
57          }
58  
59          return super.isAddHiddenWhenReadOnly();
60      }
61  
62      public String getDefaultValue() {
63          if (TKUtils.singleGroupKeyExists())
64          {
65              return singleGroupKey;
66          }
67  
68          return super.getDefaultValue();
69      }
70  }