Search in sources :

Example 1 with SimpleListProperty

use of javafx.beans.property.SimpleListProperty in project Challenger4SysAdmins by fvarrui.

the class MenuBuilder method getMenu.

/**
 * @param itemSelected elemento que tengamos seleccionado.
 *
 * @return menu contextual correspondiente al tipo del objeto seleccionado.
 */
public static ContextMenu getMenu(TreeItem<Object> itemSelected) {
    ContextMenu contextMenu = new ContextMenu();
    ListProperty<MenuItem> menuItems = new SimpleListProperty<>(FXCollections.observableArrayList());
    if (itemSelected.getParent() == null) {
        menuItems.add(new MenuItem("A�adir Goal", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/mas-16x16.png"))));
        menuItems.add(new MenuItem("Eliminar Goal", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/menos-16x16.png"))));
        contextMenu.getItems().addAll(menuItems);
    } else {
        menuItems.add(new MenuItem("A�adir Test", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/mas-16x16.png"))));
        menuItems.add(new MenuItem("Eliminar Test", new ImageView(new Image("/fvarrui/sysadmin/editor/ui/resources/menos-16x16.png"))));
        contextMenu.getItems().addAll(menuItems);
    }
    return contextMenu;
}
Also used : SimpleListProperty(javafx.beans.property.SimpleListProperty) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Aggregations

SimpleListProperty (javafx.beans.property.SimpleListProperty)1 ContextMenu (javafx.scene.control.ContextMenu)1 MenuItem (javafx.scene.control.MenuItem)1 Image (javafx.scene.image.Image)1 ImageView (javafx.scene.image.ImageView)1