2 * This file is part of NixNote
\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.ContainsAttributeFilter;
\r
28 import cx.fbn.nevernote.filters.ContainsAttributeFilterFactory;
\r
29 import cx.fbn.nevernote.sql.NoteTable;
\r
31 public class ContainsAttributeFilterTable {
\r
32 ArrayList<ContainsAttributeFilter> table;
\r
34 public ContainsAttributeFilterTable() {
\r
35 table = new ArrayList<ContainsAttributeFilter>();
\r
36 for (ContainsAttributeFilterFactory.Contains type: ContainsAttributeFilterFactory.Contains.values())
\r
37 table.add(ContainsAttributeFilterFactory.create(type));
\r
40 public void reset() {
\r
41 for (int i=0; i<table.size(); i++)
\r
42 table.get(i).set(false);
\r
45 public void select(int i) {
\r
46 table.get(i).set(true);
\r
50 return table.size();
\r
53 public boolean hasSelection() {
\r
54 for (int i=0; i<table.size(); i++) {
\r
55 if (table.get(i).isSet())
\r
61 public boolean check(NoteTable sqlTable, Note n) {
\r
62 for (int i=0; i<table.size(); i++) {
\r
63 if (table.get(i).isSet()) {
\r
64 n = sqlTable.getNote(n.getGuid(), true, true, false, false, false);
\r
65 if (!table.get(i).attributeCheck(n))
\r
72 // Get the label of a particular attribute check
\r
73 public String getLabel(int i) {
\r
74 return table.get(i).getLabel();
\r