Statistics
| Revision:

svn-gvsig-desktop / branches / gvSIG_CAD_Layout_version / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / CADPopupMenu.java @ 1763

History | View | Annotate | Download (3.44 KB)

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

    
43
import java.awt.Font;
44
import java.awt.Point;
45
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionListener;
47

    
48
import javax.swing.JMenuItem;
49
import javax.swing.JPopupMenu;
50

    
51
import com.iver.andami.PluginServices;
52
import com.iver.cit.gvsig.gui.cad.tools.SelectionCadTool;
53

    
54

    
55
public class CADPopupMenu extends JPopupMenu {
56
    private final static Font theFont = new Font("SansSerif", Font.PLAIN, 10);
57
    private JMenuItem m_ok=null;
58
    private JMenuItem m_close = null;
59
    private JMenuItem m_cancel = null;
60
    private FLayoutGraphics m_flg = null;
61
    private Layout m_layout = null;
62
    private Point m_p = null;
63

    
64
    /**
65
     * Crea un nuevo Popupmenu.
66
     *
67
     * @param layout Layout sobre el que se abre el Popupmenu.
68
     * @param p punto donde se abre el popupmenu.
69
     */
70
    public CADPopupMenu(Layout layout, Point p) {
71
        m_layout = layout;
72
        m_flg = new FLayoutGraphics(m_layout);
73
        m_p = p;
74
        initialize();
75
    }
76

    
77
    /**
78
     * Inicializa los componentes del Popupmenu.
79
     */
80
    private void initialize() {
81
            m_ok=new JMenuItem(PluginServices.getText(this,"Aceptar"));
82
        m_close = new JMenuItem(PluginServices.getText(this,"Cerrar"));
83
        m_cancel = new JMenuItem(PluginServices.getText(this,"Cancelar"));
84
        add(m_ok);
85
        addSeparator();
86
        add(m_close);
87
        addSeparator();
88
        add(m_cancel);
89
        addSeparator();
90
        m_ok.addActionListener(new ActionListener() {
91
                                public void actionPerformed(ActionEvent e) {
92
                                        try{
93
                                         m_layout.getCadToolAdapter().transition("aceptar");  
94
                         m_layout.refresh();
95
                                        }catch (Exception e1) {
96
                                                
97
                                        }
98
                                }
99
                        });
100
        m_close.addActionListener(new ActionListener() {
101
                public void actionPerformed(ActionEvent e) {
102
                    try{
103
                        m_layout.getCadToolAdapter().transition("cerrar");  
104
                    m_layout.refresh();
105
                    }catch (Exception e1) {
106
                                        }
107
                }
108
            });
109
        m_cancel.addActionListener(new ActionListener() {
110
                        public void actionPerformed(ActionEvent e) {
111
                                m_layout.getCadToolAdapter().popCadTool();
112
                                m_layout.getCadToolAdapter().pushCadTool(new SelectionCadTool());
113
                        }
114
                });
115
        this.show(m_layout, m_p.x, m_p.y);
116
    }
117
}
118