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.channel.ho.client.swing;
32:
33: import java.awt.event.*;
34:
35: import javax.swing.*;
36:
37: final class HoPopUpEventDispatcher extends HoMouseAdapter {
38: private JComponent pem_target = null;
39: private int pem_y = 0;
40: private int pem_x = 0;
41:
42: public HoPopUpEventDispatcher(JComponent xTarget, int xY) {
43: this .pem_target = xTarget;
44: this .pem_y = xY;
45:
46: return;
47: };
48:
49: public HoPopUpEventDispatcher(JComponent xTarget, int xY, int xX) {
50: this .pem_target = xTarget;
51: this .pem_y = xY;
52: this .pem_x = xX;
53:
54: return;
55: };
56:
57: public void mouseClicked(MouseEvent e) {
58: pemf_translate(e);
59:
60: MouseListener l_listen[] = this .pem_target.getMouseListeners();
61: for (int i = 0; i < l_listen.length; i++)
62: if (l_listen[i] instanceof HoMouseAdapter
63: || l_listen[i] instanceof IHoMouseListener)
64: l_listen[i].mouseClicked(e);
65: }
66:
67: public void mouseReleased(MouseEvent e) {
68: pemf_translate(e);
69:
70: MouseListener l_listen[] = this .pem_target.getMouseListeners();
71: for (int i = 0; i < l_listen.length; i++)
72: if (l_listen[i] instanceof HoMouseAdapter
73: || l_listen[i] instanceof IHoMouseListener)
74: l_listen[i].mouseReleased(e);
75: }
76:
77: public void mousePressed(MouseEvent e) {
78: pemf_translate(e);
79:
80: MouseListener l_listen[] = this .pem_target.getMouseListeners();
81: for (int i = 0; i < l_listen.length; i++)
82: if (l_listen[i] instanceof HoMouseAdapter
83: || l_listen[i] instanceof IHoMouseListener)
84: l_listen[i].mousePressed(e);
85: }
86:
87: private void pemf_translate(MouseEvent e) {
88: e.translatePoint(this.pem_x, this.pem_y);
89: e.setSource(this.pem_target);
90: }
91: }
|