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  /**
19   * Created by mlemons on 5/21/14.
20   */
21  public class GroupKeyLookupInputField extends org.kuali.rice.krad.uif.field.LookupInputField  implements SingleGroupKeyField {
22      String singleGroupKey = null;
23      public void singleGroupKeyCheck()
24      {
25          if (TKUtils.singleGroupKeyExists())
26          {
27              singleGroupKey = TKUtils.getSingleGroupKey();
28          }
29      }
30  
31  
32      public GroupKeyLookupInputField() {
33          super();
34  
35          singleGroupKeyCheck();
36      }
37  
38      public boolean isReadOnly() {
39          if (TKUtils.singleGroupKeyExists())
40          {
41              return true;
42          }
43  
44          return super.isReadOnly();
45      }
46  
47      public String getForcedValue() {
48          if (TKUtils.singleGroupKeyExists())
49          {
50              return singleGroupKey;
51          }
52  
53          return super.getForcedValue();
54      }
55  
56      public boolean isAddHiddenWhenReadOnly() {
57          if (TKUtils.singleGroupKeyExists())
58          {
59              return true;
60          }
61  
62          return super.isAddHiddenWhenReadOnly();
63      }
64  
65      public String getDefaultValue() {
66          if (TKUtils.singleGroupKeyExists())
67          {
68              return singleGroupKey;
69          }
70  
71          return super.getDefaultValue();
72      }
73  }