View Javadoc
1   /*
2    * Copyright 2014 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.ap.coursesearch.controller;
17  
18  import org.kuali.rice.core.api.util.KeyValue;
19  import org.kuali.student.ap.coursesearch.FacetState;
20  
21  import java.io.Serializable;
22  
23  /**
24   * Simple object for tracking facet click/count state.
25   */
26  public class FacetStateImpl implements Serializable, FacetState {
27      private static final long serialVersionUID = 1719950239861974273L;
28  
29      private final KeyValue value;
30      private boolean checked = true;
31      private int count;
32      private String description;
33  
34      public FacetStateImpl(KeyValue value) {
35          this.value = value;
36      }
37  
38      @Override
39      public KeyValue getValue() {
40          return value;
41      }
42  
43      @Override
44      public boolean isChecked() {
45          return checked;
46      }
47  
48      public void setChecked(boolean checked) {
49          this.checked = checked;
50      }
51  
52      @Override
53      public int getCount() {
54          return count;
55      }
56  
57      public void setCount(int count) {
58          this.count = count;
59      }
60  
61      /**
62       * Increment the count
63       */
64      @Override
65      public void incrementCount() {
66          count++;
67      }
68  
69      @Override
70      public void resetCount() {
71          count = 0;
72      }
73  
74      @Override
75      public String getDescription() {
76          return description;
77      }
78  
79      public void setDescription(String description) {
80          this.description = description;
81      }
82  }