Search in sources :

Example 1 with TabPanels

use of com.att.aro.ui.view.SharedAttributesProcesses.TabPanels in project VideoOptimzer by attdevsupport.

the class AROFileMenu method menuSelected.

/**
 * Need to determine whether the print option is enabled or not when menu is opened.
 */
@Override
public void menuSelected(MenuEvent event) {
    TabPanels currentTabPanel = parent.getCurrentTabPanel();
    printItem.setEnabled(currentTabPanel == TabPanels.tab_panel_best_practices || currentTabPanel == TabPanels.tab_panel_statistics);
}
Also used : TabPanels(com.att.aro.ui.view.SharedAttributesProcesses.TabPanels)

Example 2 with TabPanels

use of com.att.aro.ui.view.SharedAttributesProcesses.TabPanels in project VideoOptimzer by attdevsupport.

the class AROFileMenu method getMenu.

/**
 * @return
 */
public JMenu getMenu() {
    if (fileMenu == null) {
        fileMenu = new JMenu(ResourceBundleHelper.getMessageString(MenuItem.menu_file));
        fileMenu.setMnemonic(KeyEvent.VK_UNDEFINED);
        fileMenu.addActionListener(this);
        fileMenu.addMenuListener(this);
        fileMenu.add(menuAdder.getMenuItemInstance(MenuItem.menu_file_open));
        fileMenu.add(menuAdder.getMenuItemInstance(MenuItem.menu_file_open_time_range));
        fileMenu.add(menuAdder.getMenuItemInstance(MenuItem.menu_file_pcap));
        recentMenu = menuAdder.getMenuInstance(ResourceBundleHelper.getMessageString("menu.file.recent"));
        recentMenu.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseEntered(MouseEvent e) {
                boolean getRecentMenuItems = false;
                Map<String, String> recentItemsMap = Util.getRecentOpenMenuItems();
                if (recentMenuItems.isEmpty() || recentMenuItems.size() != recentItemsMap.size()) {
                    getRecentMenuItems = true;
                }
                if (!getRecentMenuItems) {
                    Iterator<String> iterator = recentItemsMap.keySet().iterator();
                    for (String key : recentMenuItems.keySet()) {
                        String keyValue = iterator.hasNext() ? iterator.next() : null;
                        if (!recentMenuItems.get(key).equals(recentItemsMap.get(keyValue))) {
                            getRecentMenuItems = true;
                            break;
                        }
                    }
                }
                if (getRecentMenuItems) {
                    recentMenuItems = recentItemsMap;
                    recentMenu.removeAll();
                    for (Map.Entry<String, String> entry : recentMenuItems.entrySet()) {
                        JMenuItem menuItem = menuAdder.getMenuItemInstance(entry.getValue(), ResourceBundleHelper.getMessageString("menu.file.recent"));
                        menuItem.setToolTipText(entry.getKey());
                        recentMenu.add(menuItem);
                    }
                }
            }
        });
        fileMenu.add(recentMenu);
        fileMenu.addSeparator();
        fileMenu.add(menuAdder.getMenuItemInstance(MenuItem.menu_file_pref));
        fileMenu.addSeparator();
        printItem = menuAdder.getMenuItemInstance(MenuItem.menu_file_print);
        TabPanels tabbedPanel = parent.getCurrentTabPanel();
        printItem.setEnabled(tabbedPanel == TabPanels.tab_panel_best_practices || tabbedPanel == TabPanels.tab_panel_video_tab || tabbedPanel == TabPanels.tab_panel_statistics);
        fileMenu.add(printItem);
        fileMenu.addSeparator();
        fileMenu.add(menuAdder.getMenuItemInstance(MenuItem.menu_file_exit));
    }
    return fileMenu;
}
Also used : MouseEvent(java.awt.event.MouseEvent) TabPanels(com.att.aro.ui.view.SharedAttributesProcesses.TabPanels) MouseAdapter(java.awt.event.MouseAdapter) Iterator(java.util.Iterator) JMenuItem(javax.swing.JMenuItem) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) JMenu(javax.swing.JMenu)

Aggregations

TabPanels (com.att.aro.ui.view.SharedAttributesProcesses.TabPanels)2 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1