Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.swing / org.gvsig.symbology.swing.api / src / main / java / org / gvsig / app / gui / styling / EditorTool.java @ 40560

History | View | Annotate | Download (2.3 KB)

1 40560 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3 40435 jjdelcerro
 *
4 40560 jjdelcerro
 * Copyright (C) 2007-2013 gvSIG Association.
5 40435 jjdelcerro
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8 40560 jjdelcerro
 * as published by the Free Software Foundation; either version 3
9 40435 jjdelcerro
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18 40560 jjdelcerro
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20 40435 jjdelcerro
 *
21 40560 jjdelcerro
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23 40435 jjdelcerro
 */
24
package org.gvsig.app.gui.styling;
25
26
import java.awt.Cursor;
27
import java.awt.Dimension;
28
import java.awt.event.MouseEvent;
29
import java.awt.event.MouseListener;
30
import java.awt.event.MouseMotionListener;
31
32
import javax.swing.AbstractButton;
33
import javax.swing.JComponent;
34
35
36
/**
37
 * Abstract class that specifies the methods that are useful for the edition.
38
 * Most of them are methods in relation with mouse events in order to control its
39
 * position, what button is pressed and so on.
40
 *
41
 * @author jaume dominguez faus - jaume.dominguez@iver.es
42
 */
43
public abstract class EditorTool implements MouseListener, MouseMotionListener {
44
45
        public static final Dimension SMALL_BTN_SIZE = new Dimension(24, 24);
46
        protected JComponent owner;
47
        /**
48
         * Constructor method
49
         *
50
         * @param targetEditor
51
         */
52
        public EditorTool(JComponent targetEditor) {
53
                super();
54
                owner = targetEditor;
55
        }
56
        /**
57
         * Returns the cursor
58
         */
59
        public abstract Cursor getCursor();
60
61
        public void mouseClicked(MouseEvent e) {}
62
63
        public void mouseEntered(MouseEvent e) {
64
                owner.setCursor(getCursor());
65
        }
66
67
        public void mouseExited(MouseEvent e) {
68
                owner.setCursor(Cursor.getDefaultCursor());
69
        }
70
71
        public void mouseMoved(MouseEvent e) { }
72
73
        public abstract AbstractButton getButton();
74
75
        public abstract boolean isSuitableFor(Object obj);
76
        public abstract String getID();
77
        public abstract void setModel(Object objectToBeEdited);
78
}