Merge pull request #4032 from millmanorama/timeline-menu-disabling

disable menus appropriately in timeline list view
This commit is contained in:
Richard Cordovano 2018-08-13 16:36:54 -04:00 committed by GitHub
commit e0ea55e558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2016 Basis Technology Corp.
* Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -31,10 +31,13 @@ import javax.swing.SwingUtilities;
* Allows creation of JavaFX menus with the same structure as Swing menus and
* which invoke the same actions.
*/
public class SwingFXMenuUtils extends MenuItem {
class SwingFXMenuUtils {
private SwingFXMenuUtils() {
}
/**
* Factory method that creates a JavaFX MenuItem backed by a MenuElement
* Factory method that creates a JavaFX MenuItem backed by a swing MenuElement
*
* @param jMenuElement The MenuElement to create a JavaFX menu for.
*
@ -60,6 +63,7 @@ public class SwingFXMenuUtils extends MenuItem {
private MenuItemAdapter(final JMenuItem jMenuItem) {
super(jMenuItem.getText());
setDisable(jMenuItem.isEnabled() == false);
setOnAction(actionEvent -> SwingUtilities.invokeLater(jMenuItem::doClick));
}
}
@ -77,6 +81,7 @@ public class SwingFXMenuUtils extends MenuItem {
*/
MenuAdapter(final JMenu jMenu) {
super(jMenu.getText());
setDisable(jMenu.isEnabled() == false);
populateSubMenus(jMenu);
}
@ -87,6 +92,7 @@ public class SwingFXMenuUtils extends MenuItem {
*/
MenuAdapter(JPopupMenu jPopupMenu) {
super(jPopupMenu.getLabel());
setDisable(jPopupMenu.isEnabled() == false);
populateSubMenus(jPopupMenu);
}
@ -114,4 +120,5 @@ public class SwingFXMenuUtils extends MenuItem {
}
}
}
}