use of javax.swing.JCheckBoxMenuItem in project jmeter by apache.
the class JMeterMenuBar method makeOptionsMenu.
private void makeOptionsMenu() {
// OPTIONS MENU
//$NON-NLS-1$
optionsMenu = makeMenuRes("option", 'O');
//$NON-NLS-1$
JMenuItem functionHelper = makeMenuItemRes("function_dialog_menu_item", 'F', ActionNames.FUNCTIONS, KeyStrokes.FUNCTIONS);
//$NON-NLS-1$
lafMenu = makeMenuRes("appearance", 'L');
for (LookAndFeelInfo laf : getAllLAFs()) {
JMenuItem menuItem = new JMenuItem(laf.getName());
menuItem.addActionListener(ActionRouter.getInstance());
menuItem.setActionCommand(ActionNames.LAF_PREFIX + laf.getClassName());
// show the classname to the user
menuItem.setToolTipText(laf.getClassName());
lafMenu.add(menuItem);
}
optionsMenu.add(functionHelper);
optionsMenu.add(lafMenu);
//$NON-NLS-1$
JCheckBoxMenuItem menuLoggerPanel = makeCheckBoxMenuItemRes("menu_logger_panel", ActionNames.LOGGER_PANEL_ENABLE_DISABLE);
GuiPackage guiInstance = GuiPackage.getInstance();
if (guiInstance != null) {
//avoid error in ant task tests (good way?)
guiInstance.setMenuItemLoggerPanel(menuLoggerPanel);
}
optionsMenu.add(menuLoggerPanel);
//$NON-NLS-1$
JMenu menuLoggerLevel = makeMenuRes("menu_logger_level");
JMenuItem menuItem;
String levelString;
for (Level level : Level.values()) {
levelString = level.toString();
menuItem = new JMenuItem(levelString);
menuItem.addActionListener(ActionRouter.getInstance());
menuItem.setActionCommand(ActionNames.LOG_LEVEL_PREFIX + levelString);
// show the classname to the user
menuItem.setToolTipText(levelString);
menuLoggerLevel.add(menuItem);
}
optionsMenu.add(menuLoggerLevel);
if (SSLManager.isSSLSupported()) {
//$NON-NLS-1$
sslManager = makeMenuItemRes("sslmanager", 'S', ActionNames.SSL_MANAGER, KeyStrokes.SSL_MANAGER);
optionsMenu.add(sslManager);
}
optionsMenu.add(makeLanguageMenu());
//$NON-NLS-1$
JMenuItem collapse = makeMenuItemRes("menu_collapse_all", ActionNames.COLLAPSE_ALL, KeyStrokes.COLLAPSE_ALL);
optionsMenu.add(collapse);
//$NON-NLS-1$
JMenuItem expand = makeMenuItemRes("menu_expand_all", ActionNames.EXPAND_ALL, KeyStrokes.EXPAND_ALL);
optionsMenu.add(expand);
//$NON-NLS-1$
JMenuItem zoomIn = makeMenuItemRes("menu_zoom_in", ActionNames.ZOOM_IN);
optionsMenu.add(zoomIn);
//$NON-NLS-1$
JMenuItem zoomOut = makeMenuItemRes("menu_zoom_out", ActionNames.ZOOM_OUT);
optionsMenu.add(zoomOut);
addPluginsMenuItems(optionsMenu, menuCreators, MENU_LOCATION.OPTIONS);
}
use of javax.swing.JCheckBoxMenuItem in project jabref by JabRef.
the class IntegrityCheckAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
IntegrityCheck check = new IntegrityCheck(frame.getCurrentBasePanel().getBibDatabaseContext(), Globals.prefs.getFileDirectoryPreferences(), Globals.prefs.getBibtexKeyPatternPreferences(), Globals.journalAbbreviationLoader.getRepository(Globals.prefs.getJournalAbbreviationPreferences()));
List<IntegrityMessage> messages = check.checkBibtexDatabase();
if (messages.isEmpty()) {
JOptionPane.showMessageDialog(frame.getCurrentBasePanel(), Localization.lang("No problems found."));
} else {
Map<String, Boolean> showMessage = new HashMap<>();
// prepare data model
Object[][] model = new Object[messages.size()][4];
int i = 0;
for (IntegrityMessage message : messages) {
model[i][0] = message.getEntry().getId();
model[i][1] = message.getEntry().getCiteKeyOptional().orElse("");
model[i][2] = message.getFieldName();
model[i][3] = message.getMessage();
showMessage.put(message.getMessage(), true);
i++;
}
// construct view
JTable table = new JTable(model, new Object[] { "ID", Localization.lang("BibTeX key"), Localization.lang("Field"), Localization.lang("Message") });
// hide IDs
TableColumnModel columnModel = table.getColumnModel();
columnModel.removeColumn(columnModel.getColumn(0));
RowFilter<Object, Object> filter = new RowFilter<Object, Object>() {
@Override
public boolean include(Entry<?, ?> entry) {
return showMessage.get(entry.getStringValue(3));
}
};
TableRowSorter<TableModel> sorter = new TableRowSorter<>(table.getModel());
sorter.setRowFilter(filter);
table.setRowSorter(sorter);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setDefaultEditor(Object.class, null);
ListSelectionModel selectionModel = table.getSelectionModel();
selectionModel.addListSelectionListener(event -> {
if (!event.getValueIsAdjusting()) {
try {
String entryId = (String) model[table.convertRowIndexToModel(table.getSelectedRow())][0];
String fieldName = (String) model[table.convertRowIndexToModel(table.getSelectedRow())][2];
frame.getCurrentBasePanel().editEntryByIdAndFocusField(entryId, fieldName);
} catch (ArrayIndexOutOfBoundsException exception) {
}
}
});
// BibTeX key
table.getColumnModel().getColumn(0).setPreferredWidth(100);
// field name
table.getColumnModel().getColumn(1).setPreferredWidth(60);
// message
table.getColumnModel().getColumn(2).setPreferredWidth(400);
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
JScrollPane scrollPane = new JScrollPane(table);
String title = Localization.lang("%0 problem(s) found", String.valueOf(messages.size()));
JDialog dialog = new JDialog(frame, title, false);
JPopupMenu menu = new JPopupMenu();
for (String messageString : showMessage.keySet()) {
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(messageString, true);
menuItem.addActionListener(event -> {
showMessage.put(messageString, menuItem.isSelected());
((AbstractTableModel) table.getModel()).fireTableDataChanged();
});
menu.add(menuItem);
}
JButton menuButton = new JButton(Localization.lang("Filter"));
menuButton.addActionListener(entry -> menu.show(menuButton, 0, menuButton.getHeight()));
FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "fill:pref:grow, 2dlu, pref"));
builder.add(scrollPane).xy(1, 1);
builder.add(menuButton).xy(1, 3, "c, b");
dialog.add(builder.getPanel());
dialog.setSize(600, 600);
// show view
dialog.setVisible(true);
}
}
use of javax.swing.JCheckBoxMenuItem in project jabref by JabRef.
the class JabRefFrame method fillMenu.
private void fillMenu() {
mb.setBorder(null);
JMenu file = JabRefFrame.subMenu(Localization.menuTitle("File"));
JMenu edit = JabRefFrame.subMenu(Localization.menuTitle("Edit"));
JMenu search = JabRefFrame.subMenu(Localization.menuTitle("Search"));
JMenu groups = JabRefFrame.subMenu(Localization.menuTitle("Groups"));
JMenu bibtex = JabRefFrame.subMenu("&BibTeX");
JMenu quality = JabRefFrame.subMenu(Localization.menuTitle("Quality"));
JMenu view = JabRefFrame.subMenu(Localization.menuTitle("View"));
JMenu tools = JabRefFrame.subMenu(Localization.menuTitle("Tools"));
JMenu options = JabRefFrame.subMenu(Localization.menuTitle("Options"));
newSpec = JabRefFrame.subMenu(Localization.menuTitle("New entry by type..."));
JMenu helpMenu = JabRefFrame.subMenu(Localization.menuTitle("Help"));
file.add(newBibtexDatabaseAction);
file.add(newBiblatexDatabaseAction);
file.add(getOpenDatabaseAction());
file.add(mergeDatabaseAction);
file.add(save);
file.add(saveAs);
file.add(saveAll);
file.add(saveSelectedAs);
file.add(saveSelectedAsPlain);
file.addSeparator();
file.add(importNew);
file.add(importCurrent);
file.add(exportAll);
file.add(exportSelected);
file.addSeparator();
file.add(connectToSharedDatabaseAction);
file.add(pullChangesFromSharedDatabase);
file.addSeparator();
file.add(databaseProperties);
file.add(editModeAction);
file.addSeparator();
file.add(fileHistory);
file.addSeparator();
file.add(closeDatabaseAction);
file.add(quit);
mb.add(file);
edit.add(undo);
edit.add(redo);
edit.addSeparator();
edit.add(cut);
edit.add(copy);
edit.add(paste);
edit.addSeparator();
edit.add(copyTitle);
edit.add(copyKey);
edit.add(copyCiteKey);
edit.add(copyKeyAndTitle);
edit.add(copyKeyAndLink);
edit.add(copyPreview);
edit.add(exportToClipboard);
edit.add(sendAsEmail);
edit.addSeparator();
edit.add(mark);
for (int i = 0; i < EntryMarker.MAX_MARKING_LEVEL; i++) {
markSpecific.add(new MarkEntriesAction(this, i).getMenuItem());
}
edit.add(markSpecific);
edit.add(unmark);
edit.add(unmarkAll);
edit.addSeparator();
if (Globals.prefs.getBoolean(JabRefPreferences.SPECIALFIELDSENABLED)) {
boolean menuitem = false;
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_RANKING)) {
rankSubMenu = new JMenu();
RightClickMenu.populateSpecialFieldMenu(rankSubMenu, SpecialField.RANKING, this);
edit.add(rankSubMenu);
menuitem = true;
}
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_RELEVANCE)) {
edit.add(toggleRelevance);
menuitem = true;
}
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_QUALITY)) {
edit.add(toggleQualityAssured);
menuitem = true;
}
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_PRIORITY)) {
rankSubMenu = new JMenu();
RightClickMenu.populateSpecialFieldMenu(rankSubMenu, SpecialField.PRIORITY, this);
edit.add(rankSubMenu);
menuitem = true;
}
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_PRINTED)) {
edit.add(togglePrinted);
menuitem = true;
}
if (Globals.prefs.getBoolean(JabRefPreferences.SHOWCOLUMN_READ)) {
rankSubMenu = new JMenu();
RightClickMenu.populateSpecialFieldMenu(rankSubMenu, SpecialField.READ_STATUS, this);
edit.add(rankSubMenu);
menuitem = true;
}
if (menuitem) {
edit.addSeparator();
}
}
edit.add(getManageKeywords());
edit.add(getMassSetField());
edit.addSeparator();
edit.add(selectAll);
mb.add(edit);
search.add(normalSearch);
search.add(replaceAll);
search.addSeparator();
search.add(new JCheckBoxMenuItem(generalFetcher.getToggleAction()));
if (prefs.getBoolean(JabRefPreferences.WEB_SEARCH_VISIBLE)) {
sidePaneManager.register(generalFetcher);
sidePaneManager.show(GeneralFetcher.class);
}
mb.add(search);
groups.add(new JCheckBoxMenuItem(groupSidePane.getToggleAction()));
if (prefs.getBoolean(JabRefPreferences.GROUP_SIDEPANE_VISIBLE)) {
sidePaneManager.register(groupSidePane);
sidePaneManager.show(GroupSidePane.class);
}
groups.addSeparator();
groups.add(addToGroup);
groups.add(removeFromGroup);
groups.add(moveToGroup);
mb.add(groups);
view.add(getBackAction());
view.add(getForwardAction());
view.add(focusTable);
view.add(nextTab);
view.add(prevTab);
view.add(sortTabs);
view.addSeparator();
view.add(increaseFontSize);
view.add(decreseFontSize);
view.add(defaultFontSize);
view.addSeparator();
view.add(new JCheckBoxMenuItem(toggleToolbar));
view.add(new JCheckBoxMenuItem(enableToggle(generalFetcher.getToggleAction())));
view.add(new JCheckBoxMenuItem(groupSidePane.getToggleAction()));
view.add(new JCheckBoxMenuItem(togglePreview));
view.add(showPdvViewer);
view.add(getNextPreviewStyleAction());
view.add(getPreviousPreviewStyleAction());
mb.add(view);
bibtex.add(newEntryAction);
for (NewEntryAction a : newSpecificEntryAction) {
newSpec.add(a);
}
bibtex.add(newSpec);
bibtex.add(plainTextImport);
bibtex.addSeparator();
bibtex.add(editEntry);
bibtex.add(editPreamble);
bibtex.add(editStrings);
bibtex.addSeparator();
bibtex.add(customizeAction);
bibtex.addSeparator();
bibtex.add(deleteEntry);
mb.add(bibtex);
quality.add(dupliCheck);
quality.add(mergeEntries);
quality.addSeparator();
quality.add(resolveDuplicateKeys);
quality.add(checkIntegrity);
quality.add(cleanupEntries);
quality.add(massSetField);
quality.add(makeKeyAction);
quality.addSeparator();
quality.add(autoSetFile);
quality.add(findUnlinkedFiles);
quality.add(autoLinkFile);
for (IdFetcher fetcher : WebFetchers.getIdFetchers(Globals.prefs.getImportFormatPreferences())) {
lookupIdentifiers.add(new LookupIdentifierAction(this, fetcher));
}
quality.add(lookupIdentifiers);
quality.add(downloadFullText);
mb.add(quality);
tools.add(newSubDatabaseAction);
tools.add(writeXmpAction);
tools.add(new JCheckBoxMenuItem(openOfficePanel.getToggleAction()));
tools.add(pushExternalButton.getMenuAction());
tools.addSeparator();
tools.add(openFolder);
tools.add(openFile);
tools.add(openUrl);
tools.add(openConsole);
tools.addSeparator();
tools.add(abbreviateIso);
tools.add(abbreviateMedline);
tools.add(unabbreviate);
mb.add(tools);
options.add(showPrefs);
AbstractAction genFieldsCustomization = new GenFieldsCustomizationAction();
AbstractAction protectTerms = new ProtectedTermsAction();
options.add(genFieldsCustomization);
options.add(customImpAction);
options.add(customExpAction);
options.add(customFileTypesAction);
options.add(manageJournals);
options.add(keyBindingAction);
options.add(protectTerms);
options.add(manageSelectors);
mb.add(options);
helpMenu.add(help);
helpMenu.add(openForumAction);
helpMenu.addSeparator();
helpMenu.add(errorConsole);
helpMenu.addSeparator();
helpMenu.add(new SearchForUpdateAction());
JMenu webMenu = JabRefFrame.subMenu(Localization.menuTitle("JabRef resources"));
webMenu.add(jabrefWebPageAction);
webMenu.add(jabrefBlogAction);
webMenu.add(jabrefFacebookAction);
webMenu.addSeparator();
webMenu.add(forkMeOnGitHubAction);
webMenu.add(developmentVersionAction);
webMenu.add(changeLogAction);
webMenu.addSeparator();
webMenu.add(donationAction);
helpMenu.add(webMenu);
helpMenu.add(about);
mb.add(helpMenu);
createDisabledIconsForMenuEntries(mb);
}
use of javax.swing.JCheckBoxMenuItem in project JMRI by JMRI.
the class RpsPositionIcon method showPopUp.
/**
* Pop-up contents
*/
@Override
public boolean showPopUp(JPopupMenu popup) {
if (showIdItem == null) {
showIdItem = new JCheckBoxMenuItem("Show ID");
showIdItem.setSelected(false);
showIdItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleID(showIdItem.isSelected());
}
});
}
popup.add(showIdItem);
popup.add(new AbstractAction("Set Origin") {
@Override
public void actionPerformed(ActionEvent e) {
setRpsOrigin();
}
});
popup.add(new AbstractAction("Set Current Location") {
@Override
public void actionPerformed(ActionEvent e) {
setRpsCurrentLocation();
}
});
notify = new Notifier();
popup.add(notify);
popup.add(new AbstractAction("Set Filter") {
@Override
public void actionPerformed(ActionEvent e) {
setFilterPopup();
}
});
// add help item
JMenuItem item = new JMenuItem("Help");
jmri.util.HelpUtil.addHelpToComponent(item, "package.jmri.jmrit.display.RpsIcon");
popup.add(item);
// update position
notify.setPosition(getX(), getY());
return false;
}
use of javax.swing.JCheckBoxMenuItem in project JMRI by JMRI.
the class BeanTableDataModel method showTableHeaderPopup.
protected void showTableHeaderPopup(MouseEvent e, JTable table) {
JPopupMenu popupMenu = new JPopupMenu();
XTableColumnModel tcm = (XTableColumnModel) table.getColumnModel();
for (int i = 0; i < tcm.getColumnCount(false); i++) {
TableColumn tc = tcm.getColumnByModelIndex(i);
String columnName = table.getModel().getColumnName(i);
if (columnName != null && !columnName.equals("")) {
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(table.getModel().getColumnName(i), tcm.isColumnVisible(tc));
menuItem.addActionListener(new headerActionListener(tc, tcm));
popupMenu.add(menuItem);
}
}
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
Aggregations