Search in sources :

Example 41 with JCheckBoxMenuItem

use of javax.swing.JCheckBoxMenuItem in project processdash by dtuma.

the class TaskScheduleDialog method buildMenuBar.

private JMenuBar buildMenuBar() {
    JMenuBar result = new JMenuBar();
    boolean rw = canEdit();
    // create the File menu
    JMenu fileMenu = makeMenu("File");
    fileMenu.add(closeAction);
    if (rw)
        fileMenu.add(saveAction);
    result.add(fileMenu);
    // If we're in read-write mode, create the Edit menu.
    if (rw) {
        JMenu editMenu = makeMenu("Edit");
        editMenu.add(addTaskAction);
        editMenu.add(deleteTaskAction);
        editMenu.add(moveUpAction);
        editMenu.add(moveDownAction);
        editMenu.add(copyTaskInfoAction);
        if (!isRollup()) {
            editMenu.addSeparator();
            editMenu.add(addPeriodAction);
            editMenu.add(insertPeriodAction);
            editMenu.add(deletePeriodAction);
        }
        result.add(editMenu);
    }
    // create the View menu
    JMenu viewMenu = makeMenu("View");
    viewMenu.add(expandAllAction);
    viewMenu.add(chartAction);
    viewMenu.add(filteredChartAction);
    viewMenu.add(reportAction);
    viewMenu.add(weekReportAction);
    for (TSAction t : altReportActions) viewMenu.add(t);
    viewMenu.add(filteredReportAction);
    viewMenu.add(errorAction);
    if (Settings.isPersonalMode()) {
        viewMenu.addSeparator();
        viewMenu.add(showTimeLogAction);
        viewMenu.add(showDefectLogAction);
    }
    viewMenu.addSeparator();
    viewMenu.add(JTableColumnVisibilityAction.getForTable(treeTable));
    viewMenu.add(new TSAction("Column_Chooser.Reset_Columns") {

        public void actionPerformed(ActionEvent e) {
            guiPrefs.reset("treeTable", "flatTable");
        }
    });
    if (flatViewAction != null) {
        viewMenu.addSeparator();
        JCheckBoxMenuItem item = new JCheckBoxMenuItem(flatViewAction);
        flatViewAction.installButtonModel(item);
        viewMenu.add(item);
    } else if (mergedViewAction != null) {
        viewMenu.addSeparator();
        JCheckBoxMenuItem item = new JCheckBoxMenuItem(mergedViewAction);
        mergedViewAction.installButtonModel(item);
        viewMenu.add(item);
    }
    result.add(viewMenu);
    // create the Tools menu
    if (Settings.isReadWrite()) {
        JMenu toolsMenu = makeMenu("Tools");
        saveBaselineAction = new BaselineAction("Buttons.Save_Baseline") {

            public void actionPerformed(ActionEvent e) {
                saveBaseline();
            }
        };
        toolsMenu.add(saveBaselineAction);
        manageBaselinesAction = new BaselineAction("Buttons.Manage_Baselines") {

            public void actionPerformed(ActionEvent e) {
                manageBaselines();
            }
        };
        toolsMenu.add(manageBaselinesAction);
        if (rw) {
            if (!isCollaborationBlocked()) {
                collaborateAction = new TSAction("Buttons.Collaborate") {

                    public void actionPerformed(ActionEvent e) {
                        showCollaborationWizard();
                    }
                };
                toolsMenu.add(collaborateAction);
            }
            scheduleOptionsAction = new TSAction("Buttons.Schedule_Options") {

                public void actionPerformed(ActionEvent e) {
                    showOptionsDialog();
                }
            };
            toolsMenu.add(scheduleOptionsAction);
        }
        result.add(toolsMenu);
    }
    // create the Help menu
    JMenu helpMenu = makeMenu("Help_Menu.Title");
    JMenuItem usingTaskSchedule = new JMenuItem(resources.getString("Help_Menu.Using_Item"));
    usingTaskSchedule.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            PCSH.displayHelpTopic("UsingTaskSchedule");
        }
    });
    helpMenu.add(usingTaskSchedule);
    result.add(helpMenu);
    // add a group selector, if applicable
    UserGroupManager groupMgr = UserGroupManager.getInstance();
    if (isRollup() && groupMgr.isEnabled()) {
        UserFilter filter = groupMgr.getGlobalFilter();
        groupFilterMenu = new GroupFilterMenu(filter, groupMgr.isIndivFilteringSupported());
        //
        groupFilterMenu.addGroupChangeListener(new GroupFilterHandler(filter));
        result.add(Box.createHorizontalGlue());
        result.add(groupFilterMenu);
    }
    return result;
}
Also used : UserGroupManager(net.sourceforge.processdash.team.group.UserGroupManager) ActionEvent(java.awt.event.ActionEvent) UserFilter(net.sourceforge.processdash.team.group.UserFilter) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) ActionListener(java.awt.event.ActionListener) JMenuItem(javax.swing.JMenuItem) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu) GroupFilterMenu(net.sourceforge.processdash.team.group.ui.GroupFilterMenu)

Aggregations

JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)41 ActionEvent (java.awt.event.ActionEvent)16 JMenuItem (javax.swing.JMenuItem)15 ActionListener (java.awt.event.ActionListener)13 JMenu (javax.swing.JMenu)12 JPopupMenu (javax.swing.JPopupMenu)11 AbstractAction (javax.swing.AbstractAction)8 JMenuBar (javax.swing.JMenuBar)6 JSeparator (javax.swing.JSeparator)5 JTableHeader (javax.swing.table.JTableHeader)4 TableColumn (javax.swing.table.TableColumn)4 Action (javax.swing.Action)3 JButton (javax.swing.JButton)3 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)3 Component (java.awt.Component)2 ItemEvent (java.awt.event.ItemEvent)2 HashMap (java.util.HashMap)2 ButtonGroup (javax.swing.ButtonGroup)2 JFrame (javax.swing.JFrame)2 JOptionPane (javax.swing.JOptionPane)2