private void setCaracteristicasAlContenedorPrincipal() { Button botonJuegosExistentes = new Button("Juegos existentes"); botonJuegosExistentes.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonJuegosExistentes.setTextFill(Color.WHITE); BackgroundFill fondoDeColorJuegosExistentes = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonJuegosExistentes.setBackground(new Background(fondoDeColorJuegosExistentes)); botonJuegosExistentes.setOnMouseEntered( e -> { botonJuegosExistentes.setScaleX(1.3); botonJuegosExistentes.setScaleY(1.3); }); botonJuegosExistentes.setOnMouseExited( e -> { botonJuegosExistentes.setScaleX(1); botonJuegosExistentes.setScaleY(1); }); botonJuegosExistentes.setOnAction( e -> { VistaJuegosExistentes nuevaVista = new VistaJuegosExistentes(this); nuevaVista.mostrar(); }); Button botonNuevoJuego = new Button("Nuevo juego"); botonNuevoJuego.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonNuevoJuego.setTextFill(Color.WHITE); BackgroundFill fondoDeColorNuevoJuego = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonNuevoJuego.setBackground(new Background(fondoDeColorNuevoJuego)); botonNuevoJuego.setOnMouseEntered( e -> { botonNuevoJuego.setScaleX(1.3); botonNuevoJuego.setScaleY(1.3); }); botonNuevoJuego.setOnMouseExited( e -> { botonNuevoJuego.setScaleX(1); botonNuevoJuego.setScaleY(1); }); botonNuevoJuego.setOnAction( e -> { VistaEleccionVarianteFlor nuevaVista = new VistaEleccionVarianteFlor(this); nuevaVista.mostrar(); }); this.contenedor.getChildren().addAll(botonJuegosExistentes, botonNuevoJuego); }
/** * 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; }
/** * Sets up the remove button, which is used to remove filters from the table view and the graph. * * @param tableView The table view needed to get the currently selected filter. * @return The fully configured remove button. */ private Button setRemoveButton(TableView tableView) { final Button removeButton = new ImageButton("remove.png"); removeButton.setOnAction( actionEvent -> { final FilterInput filterInput = (FilterInput) tableView.getSelectionModel().getSelectedItem(); if (!data.isEmpty() && filterInput != null) { // Update model final IUserCommand updateGraphFilterCommand = interactionMap.get(FilterInteraction.REMOVE); if (updateGraphFilterCommand != null) { filterInput.setDeleted(); updateGraphFilterCommand.setSelection(filterInput); notifyListeners(updateGraphFilterCommand); logger.debug( "Removed FilterInput: " + filterInput.getName() + " from table view and database."); } else { logger.warn("no remove command mapped"); } } }); removeButton.setScaleX(0.5); removeButton.setScaleY(0.5); return removeButton; }
/** * 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; }