Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / Popupmenu.java @ 1074

History | View | Annotate | Download (3.39 KB)

1
/*
2
 * Created on 12-ago-2004
3
 *
4
 */
5
package com.iver.cit.gvsig.gui.layout;
6

    
7
import java.awt.Font;
8
import java.awt.Point;
9
import java.awt.event.ActionEvent;
10
import java.awt.event.ActionListener;
11

    
12
import javax.swing.JMenuItem;
13
import javax.swing.JPopupMenu;
14

    
15
import com.iver.andami.PluginServices;
16

    
17

    
18
/**
19
 * Popupmenu de bot?n derecho que se abre sobre el Layout.
20
 *
21
 * @author Vicente Caballero Navarro
22
 */
23
public class Popupmenu extends JPopupMenu {
24
    private final static Font theFont = new Font("SansSerif", Font.PLAIN, 10);
25
    private JMenuItem m_properties=null;
26
    private JMenuItem m_selecAll = null;
27
    private JMenuItem m_behind = null;
28
    private JMenuItem m_before = null;
29
        private JMenuItem m_position = null;
30
    private JMenuItem m_simplify = null;
31
    private JMenuItem m_refresh = null;
32
    private FLayoutGraphics m_flg = null;
33
    private Layout m_layout = null;
34
    private Point m_p = null;
35

    
36
    /**
37
     * Crea un nuevo Popupmenu.
38
     *
39
     * @param layout Layout sobre el que se abre el Popupmenu.
40
     * @param p punto donde se abre el popupmenu.
41
     */
42
    public Popupmenu(Layout layout, Point p) {
43
        m_layout = layout;
44
        m_flg = new FLayoutGraphics(m_layout);
45
        m_p = p;
46
        initialize();
47
    }
48

    
49
    /**
50
     * Inicializa los componentes del Popupmenu.
51
     */
52
    private void initialize() {
53
            m_properties=new JMenuItem(PluginServices.getText(this,"propiedades"));
54
        m_selecAll = new JMenuItem(PluginServices.getText(this,"seleccionar_todos"));
55
        m_behind = new JMenuItem(PluginServices.getText(this,"colocar_detras"));
56
        m_before = new JMenuItem(PluginServices.getText(this,"colocar_delante"));
57
        m_position = new JMenuItem(PluginServices.getText(this,"tama?o_posicion"));
58
        m_simplify = new JMenuItem(PluginServices.getText(this,"simplificar"));
59
        m_refresh = new JMenuItem(PluginServices.getText(this,"refrescar"));
60
        add(m_properties);
61
        addSeparator();
62
        add(m_selecAll);
63
        addSeparator();
64
        add(m_behind);
65
        add(m_before);
66
        add(m_position);
67
                addSeparator();
68
        add(m_simplify);
69
        addSeparator();
70
        add(m_refresh);
71
                m_properties.addActionListener(new ActionListener() {
72
                                public void actionPerformed(ActionEvent e) {
73
                                        m_flg.openFFrameDialog();
74
                                }
75
                        });
76
        m_selecAll.addActionListener(new ActionListener() {
77
                public void actionPerformed(ActionEvent e) {
78
                    m_flg.selecAll();
79
                }
80
            });
81
        m_behind.addActionListener(new ActionListener() {
82
                public void actionPerformed(ActionEvent e) {
83
                    m_flg.behind();
84
                }
85
            });
86
        m_before.addActionListener(new ActionListener() {
87
                public void actionPerformed(ActionEvent e) {
88
                    m_flg.before();
89
                }
90
            });
91
                m_position.addActionListener(new ActionListener() {
92
                                public void actionPerformed(ActionEvent e) {
93
                                        m_flg.position();
94
                                }
95
                        });
96
        m_simplify.addActionListener(new ActionListener() {
97
                public void actionPerformed(ActionEvent e) {
98
                    m_flg.simplify();
99
                }
100
            });
101
        m_refresh.addActionListener(new ActionListener() {
102
                public void actionPerformed(ActionEvent e) {
103
                    m_layout.refresh();
104
                }
105
            });
106
        this.show(m_layout, m_p.x, m_p.y);
107
    }
108
}