/
Maksim_Shchelochok
/
Course_Work
Обзор
Документация
Войти
/
Maksim_Shchelochok
/
Course_Work
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/view/ReportView.java
57 строк
2 KB
Maksim
Создано представление центрального отчета
21 июн 2026, 17:47
21 июн 2026, 17:47
4895235
Код
Авторство
О чём код?
package view; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.VBox; import model.Report; import java.util.List; public class ReportView extends VBox { private final TableView<Report> table = new TableView<>(); private final ObservableList<Report> rows = FXCollections.observableArrayList(); private final Button refreshButton = new Button("Обновить отчёт"); public ReportView() { this.setSpacing(10); this.setPadding(new Insets(15)); Label title = new Label("Прайс-лист курсов (доступно по вашей роли)"); title.setStyle("-fx-font-weight: bold;"); TableColumn<Report, String> courseCol = new TableColumn<>("Курс"); courseCol.setCellValueFactory(new PropertyValueFactory<>("courseName")); TableColumn<Report, String> subjectCol = new TableColumn<>("Предмет"); subjectCol.setCellValueFactory(new PropertyValueFactory<>("subjectName")); TableColumn<Report, String> typeCol = new TableColumn<>("Вид занятия"); typeCol.setCellValueFactory(new PropertyValueFactory<>("lessonTypeName")); TableColumn<Report, Number> priceCol = new TableColumn<>("Цена, руб."); priceCol.setCellValueFactory(c -> new javafx.beans.property.SimpleDoubleProperty(c.getValue().getPrice())); table.getColumns().add(courseCol); table.getColumns().add(subjectCol); table.getColumns().add(typeCol); table.getColumns().add(priceCol); table.setItems(rows); this.getChildren().addAll(title, table, refreshButton); } public void setData(List<Report> reports) { rows.setAll(reports); } public Button getRefreshButton() { return refreshButton; } }