Revision 37338 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/AbstractTocContextMenuAction.java

View differences:

AbstractTocContextMenuAction.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government.
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., 59 Temple Place - Suite 330,
19
 * Boston, MA  02111-1307, USA.
20
 *
21
 */
1 22
package com.iver.cit.gvsig.project.documents.view.toc;
2 23

  
3 24
import java.util.Map;
......
7 28
import com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction;
8 29
import com.iver.utiles.extensionPoints.IExtensionBuilder;
9 30

  
10
public abstract class AbstractTocContextMenuAction extends AbstractContextMenuAction implements IExtensionBuilder{
11
	private MapContext mapContext;
12
	
13
	public MapContext getMapContext() {
14
		return this.mapContext;
15
	}
16
	
17
	public void setMapContext(MapContext mapContext) {
18
		this.mapContext = mapContext;
19
	}
20
	
21
	/**
22
	 * @deprecated use public boolean isEnabled(ITocItem item, FLayer[] selectedItems)
23
	 */
24
	public boolean isEnabled(Object item, Object[] selectedItems) {
25
		return this.isEnabled((ITocItem)item, (FLayer[])selectedItems);
26
	}
31
public abstract class AbstractTocContextMenuAction extends
32
    AbstractContextMenuAction implements IExtensionBuilder {
27 33

  
28
	/**
29
	 * @deprecated use public boolean isVisible(ITocItem item, FLayer[] selectedItems)
30
	 */
31
	public boolean isVisible(Object item, Object[] selectedItems) {
32
		return this.isVisible((ITocItem)item, (FLayer[])selectedItems);
33
	}
34
    private MapContext mapContext;
34 35

  
35
	/**
36
	 * @deprecated use public void execute(ITocItem item, FLayer[] selectedItems)
37
	 */
38
	public void execute(Object item, Object[] selectedItems) {
39
		this.execute((ITocItem)item, (FLayer[])selectedItems);		
40
	}
36
    public MapContext getMapContext() {
37
        return this.mapContext;
38
    }
41 39

  
42
	public FLayer getNodeLayer(ITocItem node) {
43
		if (isTocItemBranch(node))
44
			return ((TocItemBranch) node).getLayer();
45
		return null;
46
	}
47
	public boolean isTocItemLeaf(ITocItem node) {
48
		return node instanceof TocItemLeaf;
49
	}
50
	
51
	public boolean isTocItemBranch(ITocItem node) {
52
		return node instanceof TocItemBranch;
53
	}
40
    public void setMapContext(MapContext mapContext) {
41
        this.mapContext = mapContext;
42
    }
54 43

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

  
56
	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
57
		return true;
58
	}
54
    /**
55
     * @deprecated use public boolean isVisible(ITocItem item, FLayer[]
56
     *             selectedItems)
57
     */
58
    @Deprecated
59
    @Override
60
    public boolean isVisible(Object item, Object[] selectedItems) {
61
        return this.isVisible((ITocItem) item, (FLayer[]) selectedItems);
62
    }
59 63

  
60
	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
61
		return true;
62
	}
64
    /**
65
     * @deprecated use public void execute(ITocItem item, FLayer[]
66
     *             selectedItems)
67
     */
68
    @Deprecated
69
    public void execute(Object item, Object[] selectedItems) {
70
        this.execute((ITocItem) item, (FLayer[]) selectedItems);
71
    }
63 72

  
64
	public abstract void execute(ITocItem item, FLayer[] selectedItems);
73
    public FLayer getNodeLayer(ITocItem node) {
74
        if (isTocItemBranch(node)) {
75
            return ((TocItemBranch) node).getLayer();
76
        }
77
        return null;
78
    }
65 79

  
66
	public Object create() {		
67
		return this;
68
	}
80
    public boolean isTocItemLeaf(ITocItem node) {
81
        return node instanceof TocItemLeaf;
82
    }
69 83

  
70
	public Object create(Map args) {
71
		// TODO Auto-generated method stub
72
		return this;
73
	}
84
    public boolean isTocItemBranch(ITocItem node) {
85
        return node instanceof TocItemBranch;
86
    }
74 87

  
75
	public Object create(Object[] args) {
76
		// TODO Auto-generated method stub
77
		return this;
78
	}
88
    public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
89
        return true;
90
    }
79 91

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

  
96
    public abstract void execute(ITocItem item, FLayer[] selectedItems);
97

  
98
    public Object create() {
99
        return this;
100
    }
101

  
102
    public Object create(Map args) {
103
        // TODO Auto-generated method stub
104
        return this;
105
    }
106

  
107
    public Object create(Object[] args) {
108
        // TODO Auto-generated method stub
109
        return this;
110
    }
111

  
80 112
}

Also available in: Unified diff