01: /*
02: * @(#)DelegateMouseInputListener.java 10/20/2006
03: *
04: * Copyright 2002 - 2006 JIDE Software Inc. All rights reserved.
05: */
06:
07: package com.jidesoft.swing;
08:
09: import javax.swing.event.MouseInputListener;
10: import java.awt.event.MouseEvent;
11:
12: /**
13: * This mouse input listener can delegate the mouse events to another mouse input listener.
14: * It can be used when you need to do something extra steps when there is a mouse event but you still
15: * want the original mouse input listener to be called under certain condition.
16: */
17: public class DelegateMouseInputListener implements MouseInputListener {
18: private MouseInputListener _listener;
19:
20: public DelegateMouseInputListener(MouseInputListener listener) {
21: _listener = listener;
22: }
23:
24: public void mouseClicked(MouseEvent e) {
25: if (_listener != null) {
26: _listener.mouseClicked(e);
27: }
28: }
29:
30: public void mousePressed(MouseEvent e) {
31: if (_listener != null) {
32: _listener.mousePressed(e);
33: }
34: }
35:
36: public void mouseReleased(MouseEvent e) {
37: if (_listener != null) {
38: _listener.mouseReleased(e);
39: }
40: }
41:
42: public void mouseEntered(MouseEvent e) {
43: if (_listener != null) {
44: _listener.mouseEntered(e);
45: }
46: }
47:
48: public void mouseExited(MouseEvent e) {
49: if (_listener != null) {
50: _listener.mouseExited(e);
51: }
52: }
53:
54: public void mouseDragged(MouseEvent e) {
55: if (_listener != null) {
56: _listener.mouseDragged(e);
57: }
58: }
59:
60: public void mouseMoved(MouseEvent e) {
61: if (_listener != null) {
62: _listener.mouseMoved(e);
63: }
64: }
65: }
|