Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.mainplugin / src / main / java / org / gvsig / raster / mainplugin / toolbar / GenericToolBarMenuItem.java @ 2443

History | View | Annotate | Download (2.99 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
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
* as published by the Free Software Foundation; either version 2
9
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.mainplugin.toolbar;
23

    
24
import java.util.Map;
25

    
26
import javax.swing.Icon;
27

    
28
import org.gvsig.andami.IconThemeHelper;
29
import org.gvsig.app.project.documents.view.toc.ITocItem;
30
import org.gvsig.fmap.mapcontext.layers.FLayer;
31
import org.gvsig.tools.extensionpoint.ExtensionBuilder;
32

    
33
/**
34
 * Clase que implementa un IGenericToolBarMenuItem para evitar tener que crear
35
 * clases para items de menu sencillas
36
 *
37
 * @version 06/02/2008
38
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
39
 */
40
public class GenericToolBarMenuItem implements IGenericToolBarMenuItem, ExtensionBuilder {
41
        private String text  = "";
42
        private int    order = 0;
43
        private int    groupOrder = 0;
44
        private Icon   icon  = null;
45
        private String group = "";
46

    
47
        public GenericToolBarMenuItem(String text, Icon icon) {
48
                this(text, icon, "", 0);
49
        }
50

    
51
        public GenericToolBarMenuItem(String text) {
52
                this(text, IconThemeHelper.getImageIcon("blank-icon"), "", 0);
53
        }
54

    
55
        public GenericToolBarMenuItem(String text, Icon icon, String group, int order) {
56
                this.text = text;
57
                this.order = order;
58
                this.icon = icon;
59
                this.group = group;
60
        }
61

    
62
        public GenericToolBarMenuItem(String text, Icon icon, String group) {
63
                this(text, icon, group, 0);
64
        }
65

    
66
        public GenericToolBarMenuItem(String text, Icon icon, int order) {
67
                this(text, icon, "", 0);
68
        }
69

    
70
        public String getGroup() {
71
                return group;
72
        }
73

    
74
        public int getOrder() {
75
                return order;
76
        }
77

    
78
        public String getText() {
79
                return text;
80
        }
81

    
82
        public Icon getIcon() {
83
                return icon;
84
        }
85

    
86
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
87
                return true;
88
        }
89

    
90
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
91
                return true;
92
        }
93

    
94
        public int getGroupOrder() {
95
                return groupOrder;
96
        }
97

    
98
        public void execute(ITocItem item, FLayer[] selectedItems) {}
99

    
100
        public Object create() {
101
                return this;
102
        }
103

    
104
        public Object create(Object[] args) {
105
                return this;
106
        }
107

    
108
        @SuppressWarnings("rawtypes")
109
        public Object create(Map args) {
110
                return this;
111
        }
112

    
113
        public boolean isEnableEvents() {
114
                return true;
115
        }
116
}