01: // @@
02: // @@
03: /*
04: * Wi.Ser Framework
05: *
06: * LGPL Version: 1.8.1, 20-September-2007
07: * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library located in LGPL.txt in the
21: * license directory; if not, write to the
22: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23: * Boston, MA 02111-1307, USA.
24: *
25: * If this agreement does not cover your requirements, please contact us
26: * via email to get detailed information about the commercial license
27: * or our service offerings!
28: *
29: */
30: // @@
31: package de.ug2t.unifiedGui.cellRenderer.implementations.table;
32:
33: import java.util.*;
34: import java.util.regex.*;
35:
36: import de.ug2t.kernel.*;
37: import de.ug2t.unifiedGui.*;
38: import de.ug2t.unifiedGui.interfaces.*;
39:
40: public class DefaultTableSearcher implements IKeExecutable {
41: public Object pcmf_execObj(Object xParam) {
42: IUnTable l_table = (IUnTable) xParam;
43: int l_rowcnt = l_table.pcmf_getRowCount();
44: for (int i = 0; i < l_rowcnt; i++)
45: l_table.pcmf_unHideRow(i);
46:
47: KeTable l_content = l_table.pcmf_getComplete();
48:
49: Collection l_header = l_table.pcmf_getHeader();
50: Iterator l_it = l_header.iterator();
51: IUnInputField l_fipt = null;
52: while (l_it.hasNext()) {
53: UnComponent l_hcomp = (UnComponent) l_it.next();
54: IUnInputField l_ipt = (IUnInputField) l_hcomp
55: .pcmf_getNodeAt(1);
56:
57: if (l_fipt == null)
58: l_fipt = l_ipt;
59:
60: String l_toSearch = l_ipt.pcmf_getValue().toString();
61:
62: if (l_toSearch.trim().equals(""))
63: continue;
64:
65: int l_col = ((Integer) l_ipt.pcmf_getUnComponent()
66: .pcmf_getAdditionalInfo()).intValue();
67:
68: ArrayList l_clist = l_content.pcmf_getColArrayList(l_col);
69: Iterator l_cit = l_clist.iterator();
70: int l_rcnt = 1;
71: while (l_cit.hasNext()) {
72: Object l_cval = l_cit.next();
73:
74: if (!Pattern.matches(
75: KeTools.pcmf_wildcardToRegex(l_toSearch
76: .toUpperCase()), l_cval.toString()
77: .toUpperCase()))
78: l_table.pcmf_hideRow(l_rcnt);
79:
80: l_rcnt++;
81: }
82: }
83:
84: return (null);
85: }
86: }
|