source: 3thparty/jupload/src/main/java/wjhk/jupload2/gui/JUploadMainPopupMenu.java @ 3951

Revision 3951, 1.9 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #1709 - Adicao de codigo fonte java do componente jupload

Line 
1package wjhk.jupload2.gui;
2
3import java.awt.event.ActionEvent;
4import java.awt.event.KeyEvent;
5
6import javax.swing.Action;
7import javax.swing.JMenuItem;
8import javax.swing.JPopupMenu;
9import javax.swing.KeyStroke;
10import javax.swing.TransferHandler;
11
12import wjhk.jupload2.policies.UploadPolicy;
13
14/**
15 * The main contextual menu of the applet. It contains currently, only the paste
16 * action.
17 *
18 * @author etienne_sf
19 */
20public class JUploadMainPopupMenu extends JPopupMenu {
21
22    /** A generated serialVersionUID, to avoid warning during compilation */
23    private static final long serialVersionUID = 4204344561680290852L;
24
25    /**
26     * The current upload policy.
27     */
28    private UploadPolicy uploadPolicy;
29
30    /**
31     * The current upload panel. Can't be retrieve by
32     * uploadPolicy.getAppel().getUploadPanel(), as the menu is cosntructed from
33     * JUploadPanel constructor. That is: the applet did not get the
34     * JUploadPanel reference (getUploadPanel returns null);
35     */
36    @SuppressWarnings("unused")
37    private JUploadPanel uploadPanel;
38
39    JUploadMainPopupMenu(UploadPolicy uploadPolicy, JUploadPanel uploadPanel) {
40        this.uploadPolicy = uploadPolicy;
41        this.uploadPanel = uploadPanel;
42
43        // ////////////////////////////////////////////////////////////////////////
44        // Creation of the menu items
45        // ////////////////////////////////////////////////////////////////////////
46        JMenuItem menuItem = new JMenuItem(this.uploadPolicy.getLocalizedString("menuitem_paste"));
47        menuItem.setActionCommand((String) TransferHandler.getPasteAction()
48                .getValue(Action.NAME));
49        menuItem.addActionListener(uploadPanel.getActionListener());
50        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
51                ActionEvent.CTRL_MASK));
52        menuItem.setMnemonic(KeyEvent.VK_P);
53
54        add(menuItem);
55    }
56
57}
Note: See TracBrowser for help on using the repository browser.