Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.actions

public Class ActionFactory

extends Object
Class Inheritance
Imports
java.lang.reflect.InaccessibleObjectException, .InvocationTargetException, .Method, javafx.beans.binding.BooleanExpression, javafx.scene.control.Button, .ButtonBase, .CheckMenuItem, .Label, .Menu, .MenuItem, .Tooltip, org.jabref.gui.keyboard.KeyBindingRepository, org.jabref.logic.util.strings.StringUtil, com.airhacks.afterburner.injection.Injector, com.sun.javafx.scene.control.ContextMenuContent, com.tobiasdiez.easybind.EasyBind, de.saxsys.mvvmfx.utils.commands.Command, org.controlsfx.control.action.ActionUtils, org.slf4j.Logger, .LoggerFactory

Helper class to create and style controls according to an Action.

Field Summary

Modifier and TypeField and Description
private final KeyBindingRepository
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ButtonBase
configureIconButton(Action action, de.saxsys.mvvmfx.utils.commands.Command command, ButtonBase button)

public MenuItem
configureMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, MenuItem menuItem)

public CheckMenuItem
createCheckMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, boolean selected)

public CheckMenuItem
createCheckMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, BooleanExpression selectedBinding)

public MenuItem
createContextMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command)

An item for a context menu, carrying no accelerator.

public MenuItem
createCustomMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, String text)

public Button
createIconButton(Action action, de.saxsys.mvvmfx.utils.commands.Command command)

public Menu
public MenuItem
createMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command)

public Menu
createSubMenu(Action action, MenuItem... children)

private static void
enableTooltips(de.saxsys.mvvmfx.utils.commands.Command command, MenuItem menuItem)

private static Label
private static void
initButton(Action action, ButtonBase button)

private static void
setGraphic(MenuItem node, Action action)

For some reason the graphic is not set correctly by the ActionUtils class, so we have to fix this by hand

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyBindingRepositoryback to summary
private final KeyBindingRepository keyBindingRepository
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

ActionFactoryback to summary
public ActionFactory()

Method Detail

configureIconButtonback to summary
public ButtonBase configureIconButton(Action action, de.saxsys.mvvmfx.utils.commands.Command command, ButtonBase button)
configureMenuItemback to summary
public MenuItem configureMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, MenuItem menuItem)
createCheckMenuItemback to summary
public CheckMenuItem createCheckMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, boolean selected)
createCheckMenuItemback to summary
public CheckMenuItem createCheckMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, BooleanExpression selectedBinding)
createContextMenuItemback to summary
public MenuItem createContextMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command)

An item for a context menu, carrying no accelerator.

A MenuItem's accelerator is global: JavaFX keeps one entry per key combination for the whole scene, so an item in a context menu takes the keystroke away from the main menu's item for the same action — and then does nothing at all whenever its own command is disabled, because JavaFX skips a disabled item's accelerator rather than passing the event on.

That is how Ctrl+Z stopped working outside the entry editor: the search field's context menu claimed it for EditorContextAction, which is enabled only while that field has something to undo. A context menu is reached with the mouse, so it loses nothing by leaving the key combination to whoever owns it globally.

createCustomMenuItemback to summary
public MenuItem createCustomMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command, String text)
createIconButtonback to summary
public Button createIconButton(Action action, de.saxsys.mvvmfx.utils.commands.Command command)
createMenuback to summary
public Menu createMenu(Action action)
createMenuItemback to summary
public MenuItem createMenuItem(Action action, de.saxsys.mvvmfx.utils.commands.Command command)
createSubMenuback to summary
public Menu createSubMenu(Action action, MenuItem... children)
enableTooltipsback to summary
private static void enableTooltips(de.saxsys.mvvmfx.utils.commands.Command command, MenuItem menuItem)
getAssociatedNodeback to summary
private static Label getAssociatedNode(MenuItem menuItem)
initButtonback to summary
private static void initButton(Action action, ButtonBase button)
setGraphicback to summary
private static void setGraphic(MenuItem node, Action action)

For some reason the graphic is not set correctly by the ActionUtils class, so we have to fix this by hand