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;
}
Aggregations