Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / toc / AbstractTocContextMenuAction.java @ 40558

History | View | Annotate | Download (2.95 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.project.documents.view.toc;
25

    
26
import java.util.Map;
27

    
28
import org.gvsig.app.project.documents.view.AbstractContextMenuAction;
29
import org.gvsig.fmap.mapcontext.MapContext;
30
import org.gvsig.fmap.mapcontext.layers.FLayer;
31
import org.gvsig.tools.extensionpoint.ExtensionBuilder;
32

    
33

    
34
public abstract class AbstractTocContextMenuAction extends AbstractContextMenuAction implements ExtensionBuilder{
35
        private MapContext mapContext;
36

    
37
        public MapContext getMapContext() {
38
                return this.mapContext;
39
        }
40

    
41
        public void setMapContext(MapContext mapContext) {
42
                this.mapContext = mapContext;
43
        }
44

    
45
        /**
46
         * @deprecated use public boolean isEnabled(ITocItem item, FLayer[] selectedItems)
47
         */
48
        public boolean isEnabled(Object item, Object[] selectedItems) {
49
                return this.isEnabled((ITocItem)item, (FLayer[])selectedItems);
50
        }
51

    
52
        /**
53
         * @deprecated use public boolean isVisible(ITocItem item, FLayer[] selectedItems)
54
         */
55
        public boolean isVisible(Object item, Object[] selectedItems) {
56
                return this.isVisible((ITocItem)item, (FLayer[])selectedItems);
57
        }
58

    
59
        /**
60
         * @deprecated use public void execute(ITocItem item, FLayer[] selectedItems)
61
         */
62
        public void execute(Object item, Object[] selectedItems) {
63
                this.execute((ITocItem)item, (FLayer[])selectedItems);
64
        }
65

    
66
        public FLayer getNodeLayer(ITocItem node) {
67
                if (isTocItemBranch(node))
68
                        return ((TocItemBranch) node).getLayer();
69
                return null;
70
        }
71
        public boolean isTocItemLeaf(ITocItem node) {
72
                return node instanceof TocItemLeaf;
73
        }
74

    
75
        public boolean isTocItemBranch(ITocItem node) {
76
                return node instanceof TocItemBranch;
77
        }
78

    
79

    
80
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
81
                return true;
82
        }
83

    
84
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
85
                return true;
86
        }
87

    
88
        public abstract void execute(ITocItem item, FLayer[] selectedItems);
89

    
90
        public Object create() {
91
                return this;
92
        }
93

    
94
        public Object create(Map args) {
95
                // TODO Auto-generated method stub
96
                return this;
97
        }
98

    
99
        public Object create(Object[] args) {
100
                // TODO Auto-generated method stub
101
                return this;
102
        }
103

    
104
}