@Override public void init() { // allow multiple rows selection tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // listener for items selection change tableView .getSelectionModel() .getSelectedIndices() .addListener( (ListChangeListener<Integer>) change -> { if (change.getList().size() > 0) { setContextMenuState(true, true, true, true); } else { setContextMenuState(false, false, false, false); } }); // prevent table columns reordering tableView .getColumns() .addListener( (ListChangeListener<TableColumn<FileItem, ?>>) change -> { change.next(); if (change.wasReplaced()) { tableView.getColumns().clear(); tableView.getColumns().addAll(selectColumn, filenameColumn, filepathColumn); } }); // set column as a CheckBox column selectColumn.setCellFactory( cellData -> { CheckBoxTableCell<FileItem, Boolean> checkBoxTableCell = new CheckBoxTableCell<>(); // set value changed listener checkBoxTableCell.setSelectedStateCallback( index -> tableView.getItems().get(index).selectedProperty()); return checkBoxTableCell; }); // add checkbox to column heading selectFilesCheckBox = new CheckBox(); selectFilesCheckBox.setDisable(true); selectColumn.setGraphic(selectFilesCheckBox); selectFilesCheckBox .selectedProperty() .addListener( (observable, oldValue, newValue) -> { synchronized (LOCK) { tableView.getItems().forEach(fileItem -> fileItem.setSelected(newValue)); } }); // set value of cells in column selectColumn.setCellValueFactory(cellData -> cellData.getValue().selectedProperty()); filenameColumn.setCellValueFactory(cellData -> cellData.getValue().filenameProperty()); filepathColumn.setCellValueFactory(cellData -> cellData.getValue().filepathProperty()); }
@FXML void loadSelectedPlaylist() { Playlist p = (Playlist) playlistsView.getSelectionModel().getSelectedItem(); if (p == null) return; tracksView.setPlaceholder(offlinePlaceHolder); Platform.runLater( () -> { List<Track> tracks = p.getTracks(); tracksView.getItems().clear(); for (int i = tracks.size() - 1; i >= 0; i--) { tracksView.getItems().add(tracks.get(i)); } if (findTrack) { Platform.runLater( () -> { tracksView.getSelectionModel().select(currentTrack); tracksView.scrollTo(currentTrack); tracksView.requestFocus(); findTrack = false; }); } else { if (tracksView.getItems().size() > 0) { tracksView.scrollTo(0); } } }); }
private void aandacht() { if (table.getSelectionModel().getSelectedItem() != null) { aandachtBtn.setText("Toegevoegd!"); aandachtBtn.setStyle("-fx-background-color: GREEN;"); llnController.setAandachtsPunt(table.getSelectionModel().getSelectedItem().getCommentaar()); } }
/** This handles the deletion of a meter or multiple meters */ @FXML private void handleDeleteMeter() { int selectedIndex = meterTable.getSelectionModel().getSelectedIndex(); consumptionHeatMap.removeHeatMap(); generationHeatMap.removeHeatMap(); // if something is selected if (selectedIndex >= 0) { meterTable.getItems().remove(selectedIndex); meterTable.getSelectionModel().clearSelection(selectedIndex); } else { // nothing is selected Dialogs.create() .title("No selection") .masthead("No meter selected") .message("Please select a meter in the table") .showError(); } // TODO: handles whenever there are no meters left, there is a glitch // with the columns being fixed intervalGraphPanel.removeMeter(selectedIndex); barChartPanel.removeMeter(selectedIndex); }
@FXML private void handleDeleteDepartment() { int selectedIndex = departmentTable.getSelectionModel().getSelectedIndex(); if (selectedIndex >= 0) { for (int i = main.getEmployees().size() - 1; i >= 0; i--) { ViewEmployee vEmp = main.getEmployees().get(i); if (vEmp.getDepartment() .equals(departmentTable.getSelectionModel().getSelectedItem().getName())) { for (ViewDepartment vDep : main.getDepartments()) { if (vDep.getDirectorName().equals(vEmp.getLastName() + " " + vEmp.getFirstName())) { vDep.setDirectorName("-"); } } main.getEmployees().remove(vEmp); } } con.deleteDepartment(departmentTable.getSelectionModel().getSelectedItem().getId()); departmentTable.getItems().remove(selectedIndex); } else { Alert alert = new Alert(AlertType.WARNING); alert.initOwner(main.getPrimaryStage()); alert.setTitle("Ничего не выбрано"); alert.setHeaderText("Не выбран отдел"); alert.setContentText("Пожалуйста, выберите отдел"); alert.showAndWait(); } }
private void eliminar() { if (comboListar.getSelectionModel().getSelectedIndex() == 0) { eliminar( 5, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 6); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 1) { eliminar( 6, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 7); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 2) { eliminar( 7, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 8); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 3) { eliminar( 8, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 5); txtfNombre.setText(null); } }
public void actionButtonPressed(ActionEvent actionEvent) { Object source = actionEvent.getSource(); // если нажата не кнопка - выходим из метода if (!(source instanceof Button)) { return; } Button clickedButton = (Button) source; // System.out.println(clickedButton.getId()); switch (clickedButton.getId()) { case "btnAddSite": System.out.println("Here 1"); editDialogSites.setSites(new Sites()); showDialog(); collectionSiteBook.add(editDialogSites.getSite()); break; case "btnUpdateSite": System.out.println("Here 2"); editDialogSites.setSites((Sites) tableSiteBook.getSelectionModel().getSelectedItem()); showDialog(); break; case "btsDeleteSite": System.out.println("Here 3"); collectionSiteBook.delete((Sites) tableSiteBook.getSelectionModel().getSelectedItem()); break; } }
private void deleteSelectedSkillFilter() { SkillFilter selectedItem = skillFiltersTableView.getSelectionModel().getSelectedItem(); if (selectedItem != null) { skillFiltersTableView.getItems().remove(selectedItem); skillFiltersTableView.getSelectionModel().clearSelection(); updateOfficialFiltersResult(); } }
private Boolean validateInput() { Boolean validation = true; // Check if inputs are null or empty if (_durationTextField.getText().length() == 0) { _durationTextField.setStyle("-fx-text-box-border: red;"); validation = false; } else { _durationTextField.setStyle("-fx-text-box-border: lightgrey;"); } if (_datePicker.getValue() == null) { _datePicker.setStyle("-fx-date-picker-border: red;"); validation = false; } else { _datePicker.setStyle("-fx-date-picker-border: lightgrey;"); } if (_startTimeTextField.getText().length() == 0) { _startTimeTextField.setStyle("-fx-text-box-border: red;"); validation = false; } else { _startTimeTextField.setStyle("-fx-text-box-border: lightgrey;"); } // check if inputs are matching the given regex if (validation) { if (_durationTextField.getText().matches("(\\d*)")) { _duration = Integer.parseInt(_durationTextField.getText()); _durationTextField.setStyle("-fx-text-box-border: lightgrey;"); } else { _durationTextField.setStyle("-fx-text-box-border: red;"); validation = false; } // define Regex: 0-24h, 0-59min, 0-69sek if (_startTimeTextField.getText().matches("([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])")) { _localDate = _datePicker.getValue(); String[] times = _startTimeTextField.getText().split(":"); _localTime = LocalTime.of( Integer.parseInt(times[0]), Integer.parseInt(times[1]), Integer.parseInt(times[2])); _startTimeTextField.setStyle("-fx-text-box-border: lightgrey;"); } else { _startTimeTextField.setStyle("-fx-text-box-border: red;"); validation = false; } } if (_allTeamsTableView.getSelectionModel().getSelectedItem() == null || _allTeamsOpponentTableView.getSelectionModel().getSelectedItem() == null) { validation = false; } return validation; }
void playRandom() { List<Track> tracks = tracksView.getItems(); Random random = new Random(); int size = tracks.size(); int r = random.nextInt(size - 1); tracksView.getSelectionModel().select(r); tracksView.scrollTo(tracksView.getSelectionModel().getSelectedIndex()); Track nextTrack = (Track) tracksView.getSelectionModel().getSelectedItem(); playTrack(nextTrack); }
@FXML public void mapearDatos() { if (tablaResultados.getSelectionModel().getSelectedItem() != null) { txtfNombre.setText( listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getNombreAutor()); txtfNombre.setDisable(false); nombre = listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getNombreAutor(); } }
void playNext() { List<Track> tracks = tracksView.getItems(); int selected = tracksView.getSelectionModel().getSelectedIndex(); int next = selected + 1; if (next >= tracks.size()) { next = 0; } tracksView.getSelectionModel().select(next); tracksView.scrollTo(tracksView.getSelectionModel().getSelectedIndex()); Track nextTrack = (Track) tracksView.getSelectionModel().getSelectedItem(); playTrack(nextTrack); }
private void initSuccessAlert() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText("Saving successful!"); alert.setTitle("Saving successful"); alert.setContentText( "A new Match between " + _allTeamsTableView.getSelectionModel().getSelectedItem().getName() + " and " + _allTeamsOpponentTableView.getSelectionModel().getSelectedItem().getName() + " was saved successfully!"); alert.showAndWait(); }
/* * Initializing method */ @FXML private void initialize() { showProgramsDetails(null); titleColumn.setCellValueFactory(new PropertyValueFactory<Programs, String>("title")); progsTable .getSelectionModel() .selectedItemProperty() .addListener( (observable, oldValue, newValue) -> showProgramsDetails(progsTable.getSelectionModel().getSelectedItem())); }
void playPrevious() { if (playStack.size() < 2) return; System.out.println("------------"); for (PlaylistAndTrack pnt : playStack) { System.out.println(pnt.track.getTitle()); } playStack.removeFirst(); PlaylistAndTrack prevPlaylistAndTrack = playStack.removeFirst(); playlistsView.getSelectionModel().select(prevPlaylistAndTrack.playlist); tracksView.getSelectionModel().select(prevPlaylistAndTrack.track); tracksView.scrollTo(tracksView.getSelectionModel().getSelectedIndex()); playTrack(prevPlaylistAndTrack.track); }
void findPlayingTrack() { if (currentPlaylist == playlistsView.getSelectionModel().getSelectedItem()) { tracksView.getSelectionModel().select(currentTrack); tracksView.scrollTo(currentTrack); tracksView.requestFocus(); } else { findTrack = true; Platform.runLater( () -> { playlistsView.getSelectionModel().select(currentPlaylist); playlistsView.scrollTo(currentPlaylist); }); } }
@Override protected void activate() { FilteredList<Dispute> filteredList = new FilteredList<>(disputeManager.getDisputesAsObservableList()); setFilteredListPredicate(filteredList); SortedList<Dispute> sortedList = new SortedList<>(filteredList); sortedList.setComparator((o1, o2) -> o2.getOpeningDate().compareTo(o1.getOpeningDate())); disputesTable.setItems(sortedList); disputesTable.getSelectionModel().selectedItemProperty().addListener(disputeChangeListener); Dispute selectedItem = disputesTable.getSelectionModel().getSelectedItem(); if (selectedItem != null) disputesTable.getSelectionModel().select(selectedItem); scrollToBottom(); }
@Override public void initialize(URL url, ResourceBundle rb) { table = new TableView<>(); data = new ProjectData(); TableColumn idProjectCol = new TableColumn("ID"); idProjectCol.setCellValueFactory( new PropertyValueFactory<ProjectDataItem, String>("IDProject")); idProjectCol.setCellFactory(new EditableCell()); TableColumn nameCol = new TableColumn("Name"); nameCol.setCellValueFactory(new PropertyValueFactory<ProjectDataItem, String>("Name")); nameCol.setCellFactory(new EditableCell()); TableColumn descriptionCol = new TableColumn("Description"); descriptionCol.setCellValueFactory( new PropertyValueFactory<ProjectDataItem, String>("Description")); descriptionCol.setCellFactory(new EditableCell()); table.setItems(data.getData()); table.getColumns().addAll(idProjectCol, nameCol, descriptionCol); table.setEditable(true); table.setTableMenuButtonVisible(true); table.setContextMenu(new ProjectFormController.ProjectContextMenu()); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); paneTable.getChildren().add(table); AnchorPane.setTopAnchor(table, 0.0); AnchorPane.setLeftAnchor(table, 0.0); AnchorPane.setRightAnchor(table, 0.0); AnchorPane.setBottomAnchor(table, 50.0); }
@FXML private void initialize() { personTableNameColumn.setCellValueFactory( (dataFeatures) -> dataFeatures.getValue().nameProperty()); personTableNameColumn.setCellFactory(TextFieldTableCell.forTableColumn()); personTableNameColumn.setOnEditCommit( (cellEditEvent) -> { int row = cellEditEvent.getTablePosition().getRow(); Person person = cellEditEvent.getTableView().getItems().get(row); person.setName(cellEditEvent.getNewValue()); }); personTableEmailColumn.setCellValueFactory( (dataFeatures) -> dataFeatures.getValue().emailProperty()); personTableEmailColumn.setCellFactory(TextFieldTableCell.forTableColumn()); personTableNameColumn.setOnEditCommit( (cellEditEvent) -> { int row = cellEditEvent.getTablePosition().getRow(); Person person = cellEditEvent.getTableView().getItems().get(row); person.setEmail(cellEditEvent.getNewValue()); }); ReadOnlyObjectProperty<Person> selectionProperty = personTableView.getSelectionModel().selectedItemProperty(); selectionProperty.addListener( (observable, oldValue, newValue) -> { personPaneController.setModel(newValue); }); personList = personTableView.getItems(); }
private void initListeners() { txPesquisa.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (!txPesquisa.getText().equals("")) { tbVitrine.setItems(findItems()); } else { tbVitrine.setItems(listItens); } } }); tbVitrine .getSelectionModel() .selectedItemProperty() .addListener( new ChangeListener<ItensProperty>() { @Override public void changed( ObservableValue<? extends ItensProperty> value, ItensProperty oldItem, ItensProperty newItem) { ItemApp.produto = new Produto(newItem.getProduto(), newItem.getPreco()); ItemApp.index = tbVitrine.getSelectionModel().getSelectedIndex(); try { new ItemApp().start(new Stage()); } catch (Exception e) { e.printStackTrace(); } } }); }
/** * 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; }
public void editar(int opcion, int codigo, String campo, int lista) { if (tablaResultados.getSelectionModel().getSelectedItem() != null) { if (!nombre.equalsIgnoreCase(campo)) { consulta.editarGCJT(opcion, codigo, campo); if (consulta.getMensaje() != null) { Utilidades.mensajeAdvertencia( null, consulta.getMensaje(), "Error al editar la selección", "Error Guardar Cambios"); } else { Utilidades.mensaje( null, "Los cambios se han guardado correctamente", "Editando Selección", "Actualización Exitosa"); listaDatos.clear(); listaDatos.addAll(consulta.llenarLista2(lista)); } } else { Utilidades.mensaje( null, "No se han presentado cambios", "Editando Selección", "Editar Selección"); } } else { Utilidades.mensaje( null, "Debe seleccionar un item de la lista", "Editando Selección", "Editar Selección"); } }
// Kustutab listist tehtud sündmuse public void kustutaButtonVajutatud() { ObservableList<Kodut66.Input> inputM22ratud, k6ikInputs; k6ikInputs = table.getItems(); inputM22ratud = table.getSelectionModel().getSelectedItems(); inputM22ratud.forEach(k6ikInputs::remove); }
/** * Initializes the controller class. * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { setupTable(); inflateTable(); atracaoTableView.setRowFactory( (TableView<Atracao> atracaoTablewView) -> { final TableRow<Atracao> row = new TableRow<>(); row.addEventFilter( MouseEvent.MOUSE_PRESSED, (MouseEvent event) -> { final int index = row.getIndex(); this.currentSelectedRow = index; if (index >= 0 && index < atracaoTablewView.getItems().size()) { atracaoTableView.getSelectionModel().select(index); textField1.setText(atracaoTableView.getItems().get(index).getIdAtracao()); textArea2.setText(atracaoTableView.getItems().get(index).getDescricao()); textField3.setText( atracaoTableView.getItems().get(index).getClassificacaoEtaria()); textField4.setText(atracaoTableView.getItems().get(index).getLocal()); textField5.setText(atracaoTableView.getItems().get(index).getEvento()); textField6.setText(atracaoTableView.getItems().get(index).getData()); event.consume(); } }); return row; }); }
// Handler for MenuItem[fx:id="assignOfficialMenuItem"] onAction public void assignOfficial(ActionEvent event) { // TODO add assertions to be sure that no null value are passed to the // controller officialsController.assignOfficialTo( officialsFilteredTableView.getSelectionModel().getSelectedItem(), assigmentsListView.getSelectionModel().getSelectedItem()); }
public SQLHistorySearchCtrl( SQLTextAreaServices sqlTextAreaServices, Session session, ObservableList<SQLHistoryEntry> items) { _sqlTextAreaServices = sqlTextAreaServices; FxmlHelper<SQLHistorySearchView> fxmlHelper = new FxmlHelper<>(SQLHistorySearchView.class); _view = fxmlHelper.getView(); _dialog = new Stage(); _dialog.setTitle( new I18n(getClass()) .t("SQLHistorySearchCtrl.title", session.getMainTabContext().getSessionTabTitle())); _dialog.initModality(Modality.WINDOW_MODAL); _dialog.initOwner(AppState.get().getPrimaryStage()); Region region = fxmlHelper.getRegion(); _dialog.setScene(new Scene(region)); GuiUtils.makeEscapeClosable(region); new StageDimensionSaver( "sqlhistorysearch", _dialog, new Pref(getClass()), region.getPrefWidth(), region.getPrefHeight(), _dialog.getOwner()); _view.cboFilterType.setItems( FXCollections.observableList(Arrays.asList(SqlHistoryFilterType.values()))); _view.cboFilterType.getSelectionModel().selectFirst(); _view.btnApply.setOnAction(e -> onApply()); _view.chkFiltered.setOnAction(e -> onChkFiltered()); _view.split.getItems().add(_tblHistory); _view.split.getItems().add(_txtSqlPreview); _originalTableLoader = new RowObjectTableLoader<>(); _originalTableLoader.initColsByAnnotations(SQLHistoryEntry.class); _originalTableLoader.addRowObjects(items); _currentLoader = _originalTableLoader.cloneLoader(); _currentLoader.load(_tblHistory); _tblHistory .getSelectionModel() .selectedItemProperty() .addListener((observable, oldValue, newValue) -> onTableSelectionChanged()); _tblHistory.setOnMouseClicked(e -> onTblHistoryClicked(e)); _txtSqlPreview.setEditable(false); _dialog.setOnCloseRequest(e -> close()); _view.txtFilter.requestFocus(); _splitPositionSaver.apply(_view.split); _dialog.showAndWait(); }
@Override public void initialize() { disputesTable = new TableView<>(); VBox.setVgrow(disputesTable, Priority.SOMETIMES); disputesTable.setMinHeight(150); root.getChildren().add(disputesTable); TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn(); disputesTable.getColumns().add(tradeIdColumn); TableColumn<Dispute, Dispute> roleColumn = getRoleColumn(); disputesTable.getColumns().add(roleColumn); TableColumn<Dispute, Dispute> dateColumn = getDateColumn(); disputesTable.getColumns().add(dateColumn); TableColumn<Dispute, Dispute> contractColumn = getContractColumn(); disputesTable.getColumns().add(contractColumn); TableColumn<Dispute, Dispute> stateColumn = getStateColumn(); disputesTable.getColumns().add(stateColumn); disputesTable.getSortOrder().add(dateColumn); disputesTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); Label placeholder = new Label("There are no open tickets"); placeholder.setWrapText(true); disputesTable.setPlaceholder(placeholder); disputesTable.getSelectionModel().clearSelection(); disputeChangeListener = (observableValue, oldValue, newValue) -> onSelectDispute(newValue); }
public FileInfoTablePanel() { tableItems = FXCollections.observableArrayList(); tableView = new TableView<>(tableItems); final TableColumn<FileInfoPath, String> col0 = new TableColumn<>("Name"); col0.setCellValueFactory( p -> new ReadOnlyObjectWrapper<>(p.getValue().getFileInfo().getFilename())); col0.prefWidthProperty().bind(tableView.widthProperty().multiply(0.3)); tableView.getColumns().add(col0); final TableColumn<FileInfoPath, String> col1 = new TableColumn<>("Path"); col1.setCellValueFactory(p -> new ReadOnlyObjectWrapper<>(p.getValue().getPath())); col1.prefWidthProperty().bind(tableView.widthProperty().multiply(0.6)); tableView.getColumns().add(col1); final TableColumn<FileInfoPath, String> col2 = new TableColumn<>("Size"); col2.setCellValueFactory( p -> new ReadOnlyObjectWrapper<>( BackupUtil.humanReadableByteCount(p.getValue().getFileInfo().getSize()))); col2.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tableView.getColumns().add(col2); final TableColumn<FileInfoPath, String> col3 = new TableColumn<>("Alg"); col3.setCellValueFactory( p -> new ReadOnlyObjectWrapper<>(p.getValue().getFileInfo().getDigestAlg().name())); col3.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tableView.getColumns().add(col3); final TableColumn<FileInfoPath, String> col4 = new TableColumn<>("Digest"); col4.setCellValueFactory( p -> new ReadOnlyObjectWrapper<>(p.getValue().getFileInfo().getDigest())); col4.prefWidthProperty().bind(tableView.widthProperty().multiply(0.2)); tableView.getColumns().add(col4); final TableColumn<FileInfoPath, String> col5 = new TableColumn<>("Timestamp"); col5.setCellValueFactory( p -> new ReadOnlyObjectWrapper<>(p.getValue().getFileInfo().getLastModifiedStr())); col5.prefWidthProperty().bind(tableView.widthProperty().multiply(0.2)); tableView.getColumns().add(col5); final TableColumn<FileInfoPath, Integer> col6 = new TableColumn<>("Path Len"); col6.setCellValueFactory(p -> new ReadOnlyObjectWrapper<>(p.getValue().getPath().length())); col6.prefWidthProperty().bind(tableView.widthProperty().multiply(0.1)); tableView.getColumns().add(col6); tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // pathList.setVisibleRowCount(4); tableView.setPrefHeight(100); label = new Label(); final ScrollPane scrollPane = GuiUtils.createScrollPane(tableView); setCenter(scrollPane); setBottom(label); setFileInfo(null, null); }
public MainStageController(Controller controller) { this.controller = controller; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainStage.fxml")); fxmlLoader.setController(this); try { root = fxmlLoader.load(); } catch (IOException e) { e.printStackTrace(); } currentUserMenuButton.setText(controller.getCurrentUser().getName()); collectAccountTable(); accountsTable .getSelectionModel() .selectedItemProperty() .addListener( new ChangeListener<Account>() { @Override public void changed( ObservableValue<? extends Account> observable, Account oldValue, Account newValue) { controller.setCurrentAccount(accountsTable.getSelectionModel().getSelectedItem()); showRecords(controller.getCurrentAccount()); showBalanceLabel(); } }); showRecords(controller.getCurrentAccount()); showBalanceLabel(); }
public void edicion() { ConfirmarUsuario verificar = new ConfirmarUsuario(); validarCampo(); if (comboListar.getSelectionModel().getSelectedIndex() == 0) { if (verificar.confirmarCurso(txtfNombre.getText())) { editar( 1, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), txtfNombre.getText(), 6); resetear(); } } if (comboListar.getSelectionModel().getSelectedIndex() == 1) { if (verificar.confirmarCurso(txtfNombre.getText())) { editar( 2, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), txtfNombre.getText(), 7); resetear(); } } if (comboListar.getSelectionModel().getSelectedIndex() == 2) { if (verificar.confirmarCurso(txtfNombre.getText())) { editar( 3, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), txtfNombre.getText(), 8); resetear(); } } if (comboListar.getSelectionModel().getSelectedIndex() == 3) { if (verificar.confirmarCurso(txtfNombre.getText())) { editar( 4, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), txtfNombre.getText(), 5); resetear(); } } }