01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.gl.web.optionfinder;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.lookup.keyvalues.KeyValuesBase;
22: import org.kuali.core.lookup.valueFinder.ValueFinder;
23: import org.kuali.core.web.ui.KeyLabelPair;
24: import org.kuali.module.gl.web.Constant;
25:
26: /**
27: * An implementation of ValueFinder that allows inquirers to include no pending entries, approved pending entries,
28: * or all pending entries in the results of their lookup
29: */
30: public class GLPendingEntryOptionFinder extends KeyValuesBase implements
31: ValueFinder {
32:
33: /**
34: * Returns a list of key/value pairs for this ValueFinder, in this case no pending entries, approved pending entries, and all pending entries
35: * @return a List of key/value pairs to populate a control
36: * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
37: */
38: public List getKeyValues() {
39:
40: List labels = new ArrayList();
41: labels.add(new KeyLabelPair(Constant.NO_PENDING_ENTRY,
42: Constant.NO_PENDING_ENTRY));
43: labels.add(new KeyLabelPair(Constant.APPROVED_PENDING_ENTRY,
44: Constant.APPROVED_PENDING_ENTRY));
45: labels.add(new KeyLabelPair(Constant.ALL_PENDING_ENTRY,
46: Constant.ALL_PENDING_ENTRY));
47:
48: return labels;
49: }
50:
51: /**
52: * Returns the default value for this ValueFinder, in this case no pending entries
53: * @return the key of the default value
54: * @see org.kuali.core.lookup.valueFinder.ValueFinder#getValue()
55: */
56: public String getValue() {
57: return Constant.NO_PENDING_ENTRY;
58: }
59: }
|