OSDN Git Service

Add fix for stack names when updating notebooks.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / DateAttributeFilterTable.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.gui;\r
21 \r
22 import java.util.ArrayList;\r
23 import com.evernote.edam.type.Note;\r
24 import cx.fbn.nevernote.filters.DateAttributeFilter;\r
25 import cx.fbn.nevernote.filters.DateAttributeFilterFactory;\r
26 \r
27 public class DateAttributeFilterTable {\r
28         ArrayList<DateAttributeFilter> table;\r
29         public DateAttributeFilterTable(boolean since, boolean created) {\r
30                 table = new ArrayList<DateAttributeFilter>();\r
31                 for (DateAttributeFilterFactory.FilterType type: DateAttributeFilterFactory.FilterType.values()) {\r
32                         table.add(DateAttributeFilterFactory.getFilter(type,since,created));\r
33                 }\r
34         }\r
35         \r
36         public void reset() {\r
37                 for (int i=0; i<table.size(); i++) \r
38                         table.get(i).set(false);\r
39         }\r
40         \r
41         public void select(int i) {\r
42                 table.get(i).set(true);\r
43         }\r
44         \r
45         public boolean hasSelection() {\r
46                 for (int i=0; i<table.size(); i++) {\r
47                         if (table.get(i).isSet())\r
48                                 return true;\r
49                 }\r
50                 return false;\r
51         }\r
52         \r
53         public int size() { \r
54                 return table.size();\r
55         }\r
56         \r
57         public boolean check(Note n) {\r
58                 for (int i=0; i<table.size(); i++) {\r
59                         if (table.get(i).isSet()\r
60                            && !table.get(i).attributeCheck(n))\r
61                                 return false;\r
62                 }\r
63                 return true;\r
64         }\r
65         \r
66         // Get the name of a particular attribute check\r
67         public String getLabel(int i) {\r
68                 return table.get(i).getLabel();\r
69         }\r
70 }\r