Package shared.popupmenu

Examples of shared.popupmenu.JStatusPopupMenu


            {
                int row = m_table.rowAtPoint(ev.getPoint());
                if (row >= 0 && ev.isPopupTrigger())
                {
                    selectRow(row, false);
                    JStatusPopupMenu menu = new JStatusPopupMenu(m_statusBar);
                    JStatusMenuItem menuItem;
                    menuItem = new JStatusMenuItem(Main.getString("menu_table_rename"), Main.getString("statusbar_menutable_rename_help"), m_statusBar);
                    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));
                    menu.add(menuItem);
                    menuItem.addActionListener(new ActionListener()
                    {
                        public void actionPerformed (ActionEvent ev)
                        {
                            doRename();
                        }
                    });
                    menuItem = new JStatusMenuItem(Main.getString("menu_table_copy"), Main.getString("statusbar_menutable_copy_help"), m_statusBar);
                    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK));
                    menu.add(menuItem);
                    menuItem.addActionListener(new ActionListener()
                    {
                        public void actionPerformed (ActionEvent ev)
                        {
                            doCopy(-1, false);
                        }
                    });
                    menuItem = new JStatusMenuItem(Main.getString("menu_table_move"), Main.getString("statusbar_menutable_move_help"), m_statusBar);
                    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_DOWN_MASK));
                    menu.add(menuItem);
                    menuItem.addActionListener(new ActionListener()
                    {
                        public void actionPerformed (ActionEvent ev)
                        {
                            doMove();
                        }
                    });
                    menuItem = new JStatusMenuItem(Main.getString("menu_table_del"), Main.getString("statusbar_menutable_del_help"), m_statusBar);
                    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
                    menu.add(menuItem);
                    menuItem.addActionListener(new ActionListener()
                    {
                        public void actionPerformed (ActionEvent ev)
                        {
                            doDel(-1);
                        }
                    });

                    menu.addSeparator();
                    menuItem = new JStatusMenuItem(Main.getString("cancel"), Main.getString("statusbar_menutable_cancel_help"), m_statusBar);
                    menu.add(menuItem);
                    m_statusBar.saveText();
                    menu.show(ev.getComponent(), ev.getX(), ev.getY());
                }
            }
        });
    }
View Full Code Here


                        {
                            final TreePath selTreePath = m_tree.getLeadSelectionPath();
                            m_bTreePopupMenu = true;
                            m_tree.setSelectionPath(treePath);
                            m_tree.scrollPathToVisible(treePath);
                            JStatusPopupMenu menu = new JStatusPopupMenu(m_statusBar);
                            menu.addPopupMenuListener(new PopupMenuAdapter()
                            {
                                @Override
                                public void popupMenuWillBecomeInvisible(PopupMenuEvent ev)
                                {
                                    m_bTreePopupMenu = false;
                                }
                            });
                            JStatusMenuItem menuItem;
                            final DefaultTreeModel treeModel = (DefaultTreeModel)m_tree.getModel();
                            if (treeNode.isCustom())
                            {
                                menuItem = new JStatusMenuItem(Main.getString("menu_tree_remove"), Main.getString("statusbar_menutree_remove_help"), m_statusBar);
                                menu.add(menuItem);
                                menuItem.addActionListener(new ActionListener()
                                {
                                    public void actionPerformed (ActionEvent ev)
                                    {
                                        DefaultMutableTreeNode parent = (DefaultMutableTreeNode)treeNode.getParent();
                                        parent.remove(treeNode);
                                        treeModel.nodeStructureChanged(parent);
                                        /*
                                        JPathTreeNode root = (JPathTreeNode)treeModel.getRoot();
                                        ArrayList<TreePath> treePathList = new ArrayList<TreePath>();
                                        root.addExpandedChilds(m_tree, treePathList);
                                        for (TreePath item : treePathList)
                                        {
                                            m_tree.expandPath(item);
                                        }
                                         */
                                        // if (selTreePath != null) m_tree.scrollPathToVisible(selTreePath);
                                    }
                                });
                            }
                            else
                            {
                                menuItem = new JStatusMenuItem(Main.getString("menu_tree_add"), Main.getString("statusbar_menutree_add_help"), m_statusBar);
                                menu.add(menuItem);
                                menuItem.addActionListener(new ActionListener()
                                {
                                    public void actionPerformed (ActionEvent ev)
                                    {
                                        DefaultMutableTreeNode root = (DefaultMutableTreeNode)treeModel.getRoot();
                                        String path = getPathFromTreePath(treePath);
                                        JPathTreeNode newNode = new JPathTreeNode(path, !JPathTreeNode.hasChilds(new File(path)), false, true);
                                        root.insert(newNode, 0);
                                        treeModel.nodeStructureChanged(root);
                                        m_tree.scrollPathToVisible(selTreePath);
                                        m_tree.scrollPathToVisible(new TreePath(newNode.getPath()));
                                    }
                                });
                            }
                            menu.addSeparator();
                            menuItem = new JStatusMenuItem(Main.getString("menu_tree_batch"), Main.getString("statusbar_menutree_batch_help"), m_statusBar);
                            menu.add(menuItem);
                            menuItem.addActionListener(new ActionListener()
                            {
                                public void actionPerformed (ActionEvent ev)
                                {
                                    m_batchData.m_srcFolder = getPathFromTreePath(treePath);
                                    doBatch();
                                }
                            });
                            menu.addSeparator();
                            menuItem = new JStatusMenuItem(Main.getString("cancel"), Main.getString("statusbar_menutree_cancel_help"), m_statusBar);
                            menu.add(menuItem);
                            menu.show(ev.getComponent(), ev.getX(), ev.getY());
                        }
                    }
                }
            }
        });
View Full Code Here

TOP

Related Classes of shared.popupmenu.JStatusPopupMenu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.