2 * This file is part of NeverNote
\r
3 * Copyright 2009,2010 Randy Baumgarte
\r
4 * Copyright 2010 Hiroshi Miura
\r
6 * This file may be licensed under the terms of of the
\r
7 * GNU General Public License Version 2 (the ``GPL'').
\r
9 * Software distributed under the License is distributed
\r
10 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
\r
11 * express or implied. See the GPL for the specific language
\r
12 * governing rights and limitations.
\r
14 * You should have received a copy of the GPL along with this
\r
15 * program. If not, go to http://www.gnu.org/licenses/gpl.html
\r
16 * or write to the Free Software Foundation, Inc.,
\r
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
21 package cx.fbn.nevernote.gui;
\r
23 import java.util.ArrayList;
\r
25 import com.evernote.edam.type.Note;
\r
27 import cx.fbn.nevernote.filters.AttributeFilter;
\r
28 import cx.fbn.nevernote.filters.ContainsAttributeFilter;
\r
29 import cx.fbn.nevernote.filters.ContainsAttributeFilterFactory;
\r
30 import cx.fbn.nevernote.sql.NoteTable;
\r
32 public class ContainsAttributeFilterTable {
\r
33 ArrayList<ContainsAttributeFilter> table;
\r
35 public ContainsAttributeFilterTable() {
\r
36 table = new ArrayList<ContainsAttributeFilter>();
\r
37 for (ContainsAttributeFilterFactory.Contains type: ContainsAttributeFilterFactory.Contains.values())
\r
38 table.add(ContainsAttributeFilterFactory.create(type));
\r
41 public void reset() {
\r
42 for (int i=0; i<table.size(); i++)
\r
43 table.get(i).set(false);
\r
46 public void select(int i) {
\r
47 table.get(i).set(true);
\r
51 return table.size();
\r
54 public boolean hasSelection() {
\r
55 for (int i=0; i<table.size(); i++) {
\r
56 if (table.get(i).isSet())
\r
62 public boolean check(NoteTable sqlTable, Note n) {
\r
63 for (int i=0; i<table.size(); i++) {
\r
64 if (table.get(i).isSet()) {
\r
65 n = sqlTable.getNote(n.getGuid(), true, true, false, false, false);
\r
66 if (!table.get(i).attributeCheck(n))
\r
73 // Get the label of a particular attribute check
\r
74 public String getLabel(int i) {
\r
75 return table.get(i).getLabel();
\r