src/main/java/net/christophermerrill/FancyFxTree/FancyTreeOperationHandler.java
protected MenuItem[] createEditMenuItems(ObservableList<TreeItem<T>> selected_items, EditType... types)
        {
        MenuItem[] items = new MenuItem[types.length];
        int index = 0;
        for (EditType type : types)
            {
            MenuItem item = new MenuItem(type.name());
            item.setId(type.getMenuId());
            items[index++] = item;
            switch (type)
                {
                case Cut:
                    item.setOnAction(event -> handleCut(selected_items));
                    break;
                case Copy:
                    item.setOnAction(event -> handleCopy(selected_items));
                    break;
                case Delete:
                    item.setOnAction(event -> handleDelete(selected_items));
                    break;
                case Paste:
                    item.setOnAction(event -> handlePaste(selected_items));
                    break;
                }
            }
        return items;
        }
/**
     * Creates context menu items for the EditTypes provided. Call this from the
     * #getContextMenu() method to easily add them to the menu.
     */
Creates context menu items for the EditTypes provided. Call this from the
#getContextMenu() method to easily add them to the menu.
Creates context menu items for the EditTypes provided . Call this from the #getContextMenu () method to easily add them to the menu .
protected MenuItem[] createEditMenuItems(ObservableList<TreeItem<T>> selected_items, EditType... types)
        {
        MenuItem[] items = new MenuItem[types.length];
        int index = 0;
        for (EditType type : types)
            {
            MenuItem item = new MenuItem(type.name());
            item.setId(type.getMenuId());
            items[index++] = item;
            switch (type)
                {
                case Cut:
                    item.setOnAction(event -> handleCut(selected_items));
                    break;
                case Copy:
                    item.setOnAction(event -> handleCopy(selected_items));
                    break;
                case Delete:
                    item.setOnAction(event -> handleDelete(selected_items));
                    break;
                case Paste:
                    item.setOnAction(event -> handlePaste(selected_items));
                    break;
                }
            }
        return items;
        }
protected MenuItem [ ] createEditMenuItems ( ObservableList < TreeItem < T > > selected_items , EditType ... types ) { MenuItem [ ] items = new MenuItem [ types . length ] ; int index = 0 ; for ( EditType type : types ) { MenuItem item = new MenuItem ( type . name ( ) ) ; item . setId ( type . getMenuId ( ) ) ; items [ index ++ ] = item ; switch ( type ) { case Cut : item . setOnAction ( event -> handleCut ( selected_items ) ) ; break ; case Copy : item . setOnAction ( event -> handleCopy ( selected_items ) ) ; break ; case Delete : item . setOnAction ( event -> handleDelete ( selected_items ) ) ; break ; case Paste : item . setOnAction ( event -> handlePaste ( selected_items ) ) ; break ; } } return items ; }
Creates context menu items for the EditTypes provided.
Creates context menu items for the EditTypes provided .