/** * Sets up the add button, which is used to add filters to the graph and to the table view. * * @return The fully configured add button. */ private Button setAddButton() { final Button addButton = new ImageButton("add.png"); addButton.setOnAction(actionEvent -> filterEditingMenu.showMenu()); addButton.setScaleX(0.5); addButton.setScaleY(0.5); return addButton; }
/** * Set up the edit button. This button is used to edit existing filters. * * @param tableView The table view needed to get the currently selected filter. * @return The fully configured edit button. */ private Button setEditButton(TableView tableView) { final Button editButton = new ImageButton("edit.png"); editButton.setOnAction( actionEvent -> { final FilterInput filterInput = (FilterInput) tableView.getSelectionModel().getSelectedItem(); if (!data.isEmpty() && filterInput != null) { filterEditingMenu.showMenu(filterInput); } }); editButton.setScaleX(0.45); editButton.setScaleY(0.45); return editButton; }
/** * Set up the selection button used to create a filter from a selection. * * @return The fully configured selection button. */ private Button setSelectionButton() { final Button selectionButton = new ImageButton("select.png"); selectionButton.setScaleX(0.5); selectionButton.setScaleY(0.5); selectionButton.setOnAction( actionEvent -> { final Set<INode> selected = new HashSet<>(pickedState.getPicked()); final List<String> filterStringList = selected .stream() .map(node -> node.getAddress().toString()) .collect(Collectors.toList()); filterEditingMenu.showMenu(filterStringList); }); return selectionButton; }