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:
35: import de.ug2t.kernel.*;
36: import de.ug2t.unifiedGui.*;
37: import de.ug2t.unifiedGui.interfaces.*;
38:
39: public class TableSortListener implements IUnGuiEventListener {
40: public void pcmf_execListener(UnComponent xParam) throws Exception {
41: IUnTable l_table = null;
42: l_table = (IUnTable) xParam.pcmf_getParentNode()
43: .pcmf_getParentNode().pcmf_getAdditionalInfo();
44:
45: Collection l_header = l_table.pcmf_getHeader();
46: KeTable l_content = l_table.pcmf_getComplete();
47: Iterator l_it = l_header.iterator();
48: int l_cnt = -1;
49: while (l_it.hasNext()) {
50: l_cnt++;
51: Object l_hobj = l_it.next();
52: if (l_hobj instanceof IUnBox) {
53: l_hobj = ((IUnBox) l_hobj).pcmf_getUnComponent()
54: .pcmf_getNodeAt(0).pcmf_getNodeAt(0);
55: }
56: if (l_hobj instanceof IUnButton) {
57: IUnButton l_cbut = (IUnButton) l_hobj;
58:
59: if (l_cbut == xParam) {
60: String l_iname = l_cbut.pcmf_getIcon()
61: .pcmf_getUnComponent().pcmf_getName();
62: if (l_iname.equals("nn")) {
63: l_content.pcmf_sortByColDir(l_cnt, false);
64: l_cbut
65: .pcmf_setIcon((IUnImage) KeRegisteredObject
66: .pcmf_getObjByName("RgUpIcon"));
67: } else {
68: l_content.pcmf_sortByColDir(l_cnt, true);
69: l_cbut
70: .pcmf_setIcon((IUnImage) KeRegisteredObject
71: .pcmf_getObjByName("RgDownIcon"));
72: }
73: } else {
74: l_cbut.pcmf_setIcon((IUnImage) KeRegisteredObject
75: .pcmf_getObjByName("RgBlankIcon"));
76: }
77: }
78: }
79: l_table.pcmf_setComplete(l_content);
80: }
81: }
|