Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / Popupmenu.java @ 4281

History | View | Annotate | Download (4.49 KB)

1
/*
2
 * Created on 12-ago-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package com.iver.cit.gvsig.gui.layout;
46

    
47
import java.awt.Point;
48
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
50

    
51
import javax.swing.JMenuItem;
52
import javax.swing.JPopupMenu;
53

    
54
import com.iver.andami.PluginServices;
55

    
56

    
57
/**
58
 * Popupmenu de bot?n derecho que se abre sobre el Layout.
59
 *
60
 * @author Vicente Caballero Navarro
61
 */
62
public class Popupmenu extends JPopupMenu {
63
    private JMenuItem m_properties=null;
64
    private JMenuItem m_selecAll = null;
65
    private JMenuItem m_behind = null;
66
    private JMenuItem m_before = null;
67
        private JMenuItem m_position = null;
68
    private JMenuItem m_simplify = null;
69
    private JMenuItem m_refresh = null;
70
    private FLayoutGraphics m_flg = null;
71
    private Layout m_layout = null;
72
    private Point m_p = null;
73

    
74
    /**
75
     * Crea un nuevo Popupmenu.
76
     *
77
     * @param layout Layout sobre el que se abre el Popupmenu.
78
     * @param p punto donde se abre el popupmenu.
79
     */
80
    public Popupmenu(Layout layout, Point p) {
81
        m_layout = layout;
82
        m_flg = new FLayoutGraphics(m_layout);
83
        m_p = p;
84
        initialize();
85
    }
86

    
87
    /**
88
     * Inicializa los componentes del Popupmenu.
89
     */
90
    private void initialize() {
91
            m_properties=new JMenuItem(PluginServices.getText(this,"propiedades"));
92
        m_selecAll = new JMenuItem(PluginServices.getText(this,"seleccionar_todos"));
93
        m_behind = new JMenuItem(PluginServices.getText(this,"colocar_detras"));
94
        m_before = new JMenuItem(PluginServices.getText(this,"colocar_delante"));
95
        m_position = new JMenuItem(PluginServices.getText(this,"tamano_posicion"));
96
        m_simplify = new JMenuItem(PluginServices.getText(this,"simplificar"));
97
        m_refresh = new JMenuItem(PluginServices.getText(this,"refrescar"));
98
        add(m_properties);
99
        addSeparator();
100
        add(m_selecAll);
101
        addSeparator();
102
        add(m_behind);
103
        add(m_before);
104
        add(m_position);
105
                addSeparator();
106
        add(m_simplify);
107
        addSeparator();
108
        add(m_refresh);
109
                m_properties.addActionListener(new ActionListener() {
110
                                public void actionPerformed(ActionEvent e) {
111
                                        m_flg.openFFrameDialog();
112
                                }
113
                        });
114
        m_selecAll.addActionListener(new ActionListener() {
115
                public void actionPerformed(ActionEvent e) {
116
                    m_flg.selecAll();
117
                }
118
            });
119
        m_behind.addActionListener(new ActionListener() {
120
                public void actionPerformed(ActionEvent e) {
121
                    m_flg.behind();
122
                }
123
            });
124
        m_before.addActionListener(new ActionListener() {
125
                public void actionPerformed(ActionEvent e) {
126
                    m_flg.before();
127
                }
128
            });
129
                m_position.addActionListener(new ActionListener() {
130
                                public void actionPerformed(ActionEvent e) {
131
                                        m_flg.position();
132
                                }
133
                        });
134
        m_simplify.addActionListener(new ActionListener() {
135
                public void actionPerformed(ActionEvent e) {
136
                    m_flg.simplify();
137
                }
138
            });
139
        m_refresh.addActionListener(new ActionListener() {
140
                public void actionPerformed(ActionEvent e) {
141
                    m_layout.refresh();
142
                }
143
            });
144
        this.show(m_layout, m_p.x, m_p.y);
145
    }
146
}