01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.handler;
20:
21: import java.awt.event.MouseEvent;
22:
23: import com.jeta.forms.gui.form.GridComponent;
24: import com.jeta.forms.gui.handler.CellMouseHandler;
25:
26: /**
27: * AbstractMouse event handler for a standard grid cell.
28: *
29: * @author Jeff Tassin
30: */
31: public abstract class AbstractMouseHandler implements CellMouseHandler {
32: /**
33: * The grid component.
34: */
35: private GridComponent m_comp;
36:
37: /**
38: * Set to non-null if we are currently dragging the component associated
39: * with this handler
40: */
41: private static CellMouseHandler m_drag_source;
42:
43: /**
44: * ctor
45: */
46: public AbstractMouseHandler(GridComponent gc) {
47: m_comp = gc;
48: }
49:
50: /**
51: * @return true if we are currently dragging a component.
52: */
53: public static boolean isDragging() {
54: return (m_drag_source != null);
55: }
56:
57: public static CellMouseHandler getDragSource() {
58: return m_drag_source;
59: }
60:
61: /**
62: * @return the grid component associated with this handler.
63: */
64: public GridComponent getGridComponent() {
65: return m_comp;
66: }
67:
68: public void mouseClicked(MouseEvent e) {
69: }
70:
71: public void mouseEntered(MouseEvent e) {
72: }
73:
74: public void mouseExited(MouseEvent e) {
75:
76: }
77:
78: public static void setDragSource(CellMouseHandler handler) {
79: m_drag_source = handler;
80: }
81: }
|