Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package org.openjfx;
- //////
- //////import java.net.URL;
- //////import java.sql.*;
- //////import java.util.ArrayList;
- //////import java.util.ResourceBundle;
- //////import org.openjfx.AuthController;
- //////import javafx.collections.FXCollections;
- //////import javafx.collections.ObservableList;
- //////import javafx.event.ActionEvent;
- //////import javafx.fxml.FXML;
- //////import javafx.scene.control.Button;
- //////import javafx.scene.control.TableColumn;
- //////import javafx.scene.control.TableView;
- //////import javafx.scene.control.cell.PropertyValueFactory;
- //////import javafx.scene.image.ImageView;
- //////import org.openjfx.ListTests;
- //////public class MainWindowController {
- //////
- ////// @FXML
- ////// private ResourceBundle resources;
- //////
- ////// @FXML
- ////// private URL location;
- //////
- ////// @FXML
- ////// private Button btnSearchtest1;
- //////
- ////// @FXML
- ////// private Button btnCreatetest;
- //////
- ////// @FXML
- ////// private Button btnEdittest;
- //////
- ////// @FXML
- ////// private Button btnDeletetest;
- //////
- ////// @FXML
- ////// private Button btnSearchtest;
- //////
- ////// @FXML
- ////// private TableView<ListTests> tableTest;
- //////
- ////// @FXML
- ////// private TableColumn<ListTests, String> title;// = new TableColumn<Listtests,String>("title");
- //////
- ////// @FXML
- ////// private TableColumn<ListTests, String> disp;// = new TableColumn<Listtests,String>("disp");
- //////
- ////// @FXML
- ////// private TableColumn<ListTests, String> author;// = new TableColumn<Listtests,String>("author");
- //////
- ////// @FXML
- ////// private Button btnCreateuser;
- //////
- ////// @FXML
- ////// private Button btnEdituser;
- //////
- ////// @FXML
- ////// private Button btnDeleteuser;
- //////
- ////// @FXML
- ////// private Button btnSearchuser;
- //////
- ////// @FXML
- ////// private TableView<?> tableUser;
- //////
- ////// @FXML
- ////// private Button btnCreatepermission;
- //////
- ////// @FXML
- ////// private Button btnEditpermission;
- //////
- ////// @FXML
- ////// private Button btnDeletepermission;
- //////
- ////// @FXML
- ////// private Button btnSearchpermission;
- //////
- ////// @FXML
- ////// private TableView<?> tablePermission;
- //////
- ////// @FXML
- ////// private Button btnEditresult;
- //////
- ////// @FXML
- ////// private ImageView btnEditpermission1;
- //////
- ////// @FXML
- ////// private Button btnDeleteresult;
- //////
- ////// @FXML
- ////// private ImageView btnDeletepermission1;
- //////
- ////// @FXML
- ////// private Button btnSearchresult;
- //////
- ////// @FXML
- ////// private ImageView btnSearchpermission1;
- //////
- ////// @FXML
- ////// private TableView<?> tableResult;
- //////// @FXML
- //////// private TableView<Listtests> tablehaha;
- //////
- ////// @FXML
- ////// void btnCreatetest(ActionEvent event) {
- //////
- ////// }
- ////// Statement statement = Server.getStatement();
- //////
- ////// private ObservableList<ListTests> listData = FXCollections.observableArrayList();
- ////// private ObservableList<User> usersData = FXCollections.observableArrayList();
- //////
- ////// UserAccount user = AuthController.getUser();
- ////// private void getlist(){
- ////// String sqlquery = "Select testname, disciplinename,creator From alltests INNER JOIN permissions on alltests.idtest = permissions.idtest where permissions.login = \"" + user.getLogin() +"\"";
- ////// String t,d,a;
- ////// try{
- ////// ResultSet resultSet = statement.executeQuery(sqlquery);
- ////// while(resultSet.next()){
- ////// t = resultSet.getString(1);
- ////// d = resultSet.getString(2);
- ////// a = resultSet.getString(3);
- ////// System.out.println(t + d + a);
- ////// listData.add(new ListTests(t,d,a));
- ////// }
- ////// }catch (SQLException e){e.printStackTrace();}
- ////// }
- ////// private void initData() {
- ////// usersData.add(new User(1, "Alex", "qwerty", "alex@mail.com"));
- ////// usersData.add(new User(2, "Bob", "dsfsdfw", "bob@mail.com"));
- ////// usersData.add(new User(3, "Jeck", "dsfdsfwe", "Jeck@mail.com"));
- ////// usersData.add(new User(4, "Mike", "iueern", "mike@mail.com"));
- ////// usersData.add(new User(5, "colin", "woeirn", "colin@mail.com"));
- ////// }
- //////
- ////// @FXML
- ////// void initialize() {
- ////// String sqlquery = "select* from users";
- ////// try {
- ////// ResultSet resultSet = statement.executeQuery(sqlquery);
- ////// while (resultSet.next())
- ////// listData.add(new ListTests(resultSet.getString(1),resultSet.getString(2),resultSet.getString(3)));
- ////// } catch (SQLException e) {
- ////// e.printStackTrace();
- ////// }
- ////// //getlist();
- ////// title.setCellValueFactory(new PropertyValueFactory<>("Название"));
- ////// disp.setCellValueFactory(new PropertyValueFactory<>("Дисциплина"));
- ////// author.setCellValueFactory(new PropertyValueFactory<>("Автор"));
- ////// tableTest.setItems(listData);
- //////
- //////
- //////
- //////
- ////// for(ListTests t : listData){
- ////// t.display();
- ////// }
- ////// //initData();
- //////// title.setCellValueFactory(new PropertyValueFactory<Listtests, String>("Название"));
- //////// disp.setCellValueFactory(new PropertyValueFactory<Listtests, String>("Дисциплина"));
- //////// author.setCellValueFactory(new PropertyValueFactory<Listtests, String>("Автор"));
- //////// //tableTest.getColumns().addAll(title,disp,author);
- //////// if(!listData.isEmpty()) tableTest.setItems(listData);
- //////// else System.out.println("list is empty");
- //////
- //////
- //////// ObservableList<Listtests> list = FXCollections.observableArrayList(
- //////// new Listtests("q","w","e"),
- //////// new Listtests("r","t","y")
- //////// );
- //////// tablehaha.setItems(list);// = new TableView<Listtests>(list);
- //////// TableColumn<Listtests, String> nameColumn = new TableColumn<Listtests, String>("Name");
- //////// nameColumn.setCellValueFactory(new PropertyValueFactory<Listtests, String>("name"));
- //////// tablehaha.getColumns().add(nameColumn);
- //////// TableColumn<Listtests, String> discColumn = new TableColumn<Listtests, String>("Discipline");
- //////// nameColumn.setCellValueFactory(new PropertyValueFactory<Listtests, String>("discipline"));
- //////// tablehaha.getColumns().add(discColumn);
- //////// TableColumn<Listtests, String> authColumn = new TableColumn<Listtests, String>("Author");
- //////// nameColumn.setCellValueFactory(new PropertyValueFactory<Listtests, String>("author"));
- //////// tablehaha.getColumns().add(authColumn);
- //////// title = new TableColumn<Listtests,String>("Title");
- //////// disp = new TableColumn<Listtests,String>("Discipline");
- //////// author = new TableColumn<Listtests,String>("Author");
- ////// //title = new TableColumn<>("Title");
- ////// //disp = new TableColumn<>("disp");
- ////// // author = new TableColumn<>("author");
- //////// System.out.println("q");
- //////// title.setCellValueFactory(new PropertyValueFactory<Listtests, String>("title"));
- //////// System.out.println("q");
- //////// disp.setCellValueFactory(new PropertyValueFactory<Listtests, String>("disc"));
- //////// System.out.println("q");
- //////// author.setCellValueFactory(new PropertyValueFactory<Listtests, String>("author"));
- //////// System.out.println("q");
- ////// //list.add(new Listtests("q","q","q"));
- ////// //title.setCellValueFactory(new PropertyValueFactory<>("название"));
- ////// //disp.setCellValueFactory(new PropertyValueFactory<>("дисциплина"));
- ////// //author.setCellValueFactory(new PropertyValueFactory<>("автор"));
- //////
- //////
- ////// //tablehaha.setItems(list);// = new TableView<>(list);
- ////// //tablehaha.getColumns().addAll(title,disp,author);
- //////
- ////// assert btnSearchtest1 != null : "fx:id=\"btnSearchtest1\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnCreatetest != null : "fx:id=\"btnCreatetest\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnEdittest != null : "fx:id=\"btnEdittest\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnDeletetest != null : "fx:id=\"btnDeletetest\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnSearchtest != null : "fx:id=\"btnSearchtest\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert tableTest != null : "fx:id=\"tableTest\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert title != null : "fx:id=\"title\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert disp != null : "fx:id=\"disp\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert author != null : "fx:id=\"author\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnCreateuser != null : "fx:id=\"btnCreateuser\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnEdituser != null : "fx:id=\"btnEdituser\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnDeleteuser != null : "fx:id=\"btnDeleteuser\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnSearchuser != null : "fx:id=\"btnSearchuser\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert tableUser != null : "fx:id=\"tableUser\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnCreatepermission != null : "fx:id=\"btnCreatepermission\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnEditpermission != null : "fx:id=\"btnEditpermission\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnDeletepermission != null : "fx:id=\"btnDeletepermission\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnSearchpermission != null : "fx:id=\"btnSearchpermission\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert tablePermission != null : "fx:id=\"tablePermission\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnEditresult != null : "fx:id=\"btnEditresult\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnEditpermission1 != null : "fx:id=\"btnEditpermission1\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnDeleteresult != null : "fx:id=\"btnDeleteresult\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnDeletepermission1 != null : "fx:id=\"btnDeletepermission1\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnSearchresult != null : "fx:id=\"btnSearchresult\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert btnSearchpermission1 != null : "fx:id=\"btnSearchpermission1\" was not injected: check your FXML file 'MainWindow.fxml'.";
- ////// assert tableResult != null : "fx:id=\"tableResult\" was not injected: check your FXML file 'MainWindow.fxml'.";
- //////
- ////// }
- ////// public class User {
- //////
- ////// private int id;
- ////// private String login;
- ////// private String password;
- ////// private String email;
- //////
- ////// public User(int id, String login, String password, String email) {
- ////// this.id = id;
- ////// this.login = login;
- ////// this.password = password;
- ////// this.email = email;
- ////// }
- //////
- ////// public User() {
- ////// }
- //////
- ////// public int getId() {
- ////// return id;
- ////// }
- //////
- ////// public void setId(int id) {
- ////// this.id = id;
- ////// }
- //////
- ////// public String getLogin() {
- ////// return login;
- ////// }
- //////
- ////// public void setLogin(String login) {
- ////// this.login = login;
- ////// }
- //////
- ////// public String getPassword() {
- ////// return password;
- ////// }
- //////
- ////// public void setPassword(String password) {
- ////// this.password = password;
- ////// }
- //////
- ////// public String getEmail() {
- ////// return email;
- ////// }
- //////
- ////// public void setEmail(String email) {
- ////// this.email = email;
- ////// }
- ////// }
- //////}
- //////
- ///////*
- //////
- //////
- ////// */
- package org.openjfx;
- import java.io.IOException;
- import java.net.URL;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.ResourceBundle;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.scene.control.*;
- import javafx.scene.control.cell.PropertyValueFactory;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.AnchorPane;
- import org.xml.sax.SAXException;
- public class MainWindowController {
- @FXML
- private Label labelName;
- @FXML
- private ResourceBundle resources;
- @FXML
- private URL location;
- @FXML
- private TableView<ListTests> tableTest;
- @FXML
- private TableColumn<ListTests, String> titletest;
- @FXML
- private TableColumn<ListTests,String> disc;
- @FXML
- private TableColumn<ListTests,String> author;
- @FXML
- private TableColumn<ListTests, String> idtest;
- @FXML
- private Button btnCreatetest;
- @FXML
- private Button btnEditTest;
- @FXML
- private Button btnDeleteTest;
- @FXML
- private Button btnSetPerm;
- @FXML
- private AnchorPane anchCreate;
- @FXML
- private TextField txtTitleTest;
- @FXML
- private TextField txtDiscTest;
- @FXML
- private Button btnContinue;
- @FXML
- private Button btnBackFromCreate;
- @FXML
- private AnchorPane anchPerm;
- @FXML
- private ComboBox<String> cmbGroupList;
- @FXML
- private Button btnAgreePerm;
- @FXML
- private Label labelPerm;
- @FXML
- private Button btnBackFromPerm;
- @FXML
- private Button btnCreatepermission;
- @FXML
- private Button btnEditpermission;
- @FXML
- private Button btnDeletepermission;
- @FXML
- private Button btnSearchpermission;
- @FXML
- private TableView<?> tablePermission;
- @FXML
- private Button btnEditresult;
- @FXML
- private ImageView btnEditpermission1;
- @FXML
- private Button btnDeleteresult;
- @FXML
- private ImageView btnDeletepermission1;
- @FXML
- private Button btnSearchresult;
- @FXML
- private ImageView btnSearchpermission1;
- @FXML
- private Button btnCreateuser;
- @FXML
- private Button btnEdituser;
- @FXML
- private Button btnDeleteuser;
- @FXML
- private Button btnSearchuser;
- @FXML
- private TableView<?> tableUser;
- @FXML
- private Tab tabTest;
- @FXML
- private Tab tabResult;
- @FXML
- private TableView<ResultTest> tableResult;
- @FXML
- private TableColumn<ResultTest, String> colLName;
- @FXML
- private TableColumn<ResultTest, String> colFName;
- @FXML
- private TableColumn<ResultTest, Integer> colScore;
- @FXML
- private TableColumn<ResultTest, Integer> colPercent;
- @FXML
- private TableColumn<ResultTest, Integer> colRating;
- @FXML
- private ComboBox<String> cmbGroupListResult;
- @FXML
- private ComboBox<String> cmbListTest;
- @FXML
- private Button btnClose;
- @FXML
- void btnClose(ActionEvent event)throws IOException {
- App.setRoot("auth",432,340);
- }
- Statement statement = Server.getStatement();
- ObservableList<ListTests> oblist = FXCollections.observableArrayList();
- ObservableList<ResultTest> resultTests = FXCollections.observableArrayList();
- UserAccount user = AuthController.getUser();
- private static ListTests selected;
- public static ListTests getSelected(){
- return selected;
- }
- private int idtestForPerm;
- String selectedGroupFromResult = "";
- int selectedIdTestFromResult = 0;
- @FXML
- void onActionSetPerm(ActionEvent event) {
- idtestForPerm = tableTest.getSelectionModel().getSelectedItem().getId();
- System.out.println(idtestForPerm);
- String sql = "SELECT DISTINCT users.group from users";
- ObservableList<String> grouplist = FXCollections.observableArrayList();
- try{
- ResultSet resultSet = statement.executeQuery(sql);
- while (resultSet.next())
- grouplist.add(resultSet.getString(1));
- }catch (SQLException e) {e.printStackTrace();}
- cmbGroupList.setItems(grouplist);
- anchPerm.setVisible(true);
- cmbGroupList.setPromptText("Группа");
- btnBackFromPerm.setVisible(true);
- tableTest.setDisable(true);
- btnCreatetest.setDisable(true);
- btnEditTest.setDisable(true);
- btnDeleteTest.setDisable(true);
- btnSetPerm.setDisable(true);
- tabResult.setDisable(true);
- }
- @FXML
- void onActionSelectGroup(ActionEvent event) {
- String selectedGroup = cmbGroupList.getSelectionModel().getSelectedItem();
- //String sql = "SELECT login from permissions Inner Join users u on permissions.login = permissions.login where idtest = \""+idtestForPerm+"\" And users.group =\""+
- // selectedGroup + "\"";
- String sql = "select permissions.login from permissions inner join users on permissions.login=users.login where idtest = \""+idtestForPerm+"\" and users.group = \""+selectedGroup+"\"";
- System.out.println(sql);
- try{
- ResultSet resultSet = statement.executeQuery(sql);
- resultSet.next();
- System.out.println(resultSet.getString(1));
- labelPerm.setText("Выбранная группа обладает доступом!");
- btnAgreePerm.setDisable(true);
- }catch (SQLException e) {
- System.out.println("vse nais");
- labelPerm.setText("");
- }
- }
- @FXML
- void onActionAgreePerm(ActionEvent event) {
- String selectedGroup = cmbGroupList.getSelectionModel().getSelectedItem();
- String sqlSel = "Select login from users where users.group = \"" + selectedGroup + "\"";
- String sqlUpd;
- List<String> listLogins = new ArrayList<>();
- try {
- ResultSet resultSet = statement.executeQuery(sqlSel);
- while (resultSet.next()){
- listLogins.add(resultSet.getString(1));
- }
- Iterator iterator = listLogins.iterator();
- while (iterator.hasNext()){
- sqlUpd = "Insert Into permissions (idtest,login) VALUES (\""+idtestForPerm+"\",\"" + iterator.next()+"\")";
- System.out.println(sqlUpd);
- statement.executeUpdate(sqlUpd);
- }
- }catch (SQLException e) {e.printStackTrace();}
- }
- @FXML
- void onActionBackCreate(ActionEvent event) {
- setVisAndDis();
- }
- void setVisAndDis(){
- anchPerm.setVisible(false);
- btnBackFromPerm.setVisible(false);
- tableTest.setDisable(false);
- btnCreatetest.setDisable(false);
- btnEditTest.setDisable(false);
- btnDeleteTest.setDisable(false);
- btnSetPerm.setDisable(false);
- tableResult.setDisable(false);
- tabResult.setDisable(false);
- }
- @FXML
- void onActionBackPerm(ActionEvent event) {
- setVisAndDis();
- }
- @FXML
- void onActionContinue(ActionEvent event) throws IOException {
- String title = txtTitleTest.getText();
- String disc = txtDiscTest.getText();
- String sql = "Insert into alltests (testname, disciplinename, creator) VALUES (\""+title+"\",\""+disc+"\",\""+user.getLogin()+"\")";
- try{
- statement.executeUpdate(sql);
- }catch (SQLException e) {e.printStackTrace();}
- sql = "SELECT idtest FROM alltests where testname = \""+title+"\" and disciplinename = \""+disc+"\"";
- selected = new ListTests(title, disc, user.getLogin());
- try{
- ResultSet resultSet = statement.executeQuery(sql);
- resultSet.next();
- selected.setId(resultSet.getInt(1));
- }catch (SQLException e) {e.printStackTrace();}
- App.setRoot("TestEditor",1200,1000);
- }
- @FXML
- void onActionEditTest(ActionEvent event) throws IOException {
- String t = tableTest.getSelectionModel().getSelectedItem().getName();
- String d = tableTest.getSelectionModel().getSelectedItem().getDisc();
- selected = new ListTests(t,d);
- System.out.println(t+d);
- String sql = "SELECT idtest FROM alltests where testname = \""+t+"\" and disciplinename = \""+d+"\"";
- try{
- ResultSet resultSet = statement.executeQuery(sql);
- resultSet.next();
- selected.setId(resultSet.getInt(1));
- }catch (SQLException e) {}
- System.out.println(selected.getId());
- System.out.println(sql);
- App.setRoot("TestEditor",1200,1000);
- }
- @FXML
- void onActionDeleteTest(ActionEvent event) {
- int i = tableTest.getSelectionModel().getSelectedItem().getId();
- String sql = "Delete From alltests where idtest = \"" + i + "\"";
- try{
- statement.executeUpdate(sql);
- }catch (SQLException e) {e.printStackTrace();}
- oblist.clear();
- getlist();
- }
- @FXML
- void btnCreatetest(ActionEvent event) throws IOException {
- tableTest.setDisable(true);
- btnCreatetest.setDisable(true);
- btnEditTest.setDisable(true);
- btnDeleteTest.setDisable(true);
- btnSetPerm.setDisable(true);
- tabResult.setDisable(true);
- anchCreate.setVisible(true);
- btnBackFromCreate.setVisible(true);
- }
- @FXML
- void onActionSelectGroupResult(ActionEvent event) {
- selectedGroupFromResult = cmbGroupListResult.getSelectionModel().getSelectedItem();
- if(selectedIdTestFromResult != 0){
- getResultList();
- System.out.println("naisGroup");
- }
- }
- @FXML
- void onActionSelectTest(ActionEvent event) {
- String selectedTestFromResult = cmbListTest.getSelectionModel().getSelectedItem();
- String sql = "select idtest from alltests where testname = \""+ selectedTestFromResult + "\"";
- try {
- ResultSet resultSet = statement.executeQuery(sql);
- resultSet.next();
- selectedIdTestFromResult = resultSet.getInt(1);
- }catch (SQLException e){e.printStackTrace();}
- if(!selectedGroupFromResult.equals("")) {
- getResultList();
- System.out.println("naisTest");
- }
- }
- void fillCmbResult(){
- String sqlGroup = "SELECT DISTINCT users.group from users";
- String sqlTest = "Select testname from alltests";
- ObservableList<String> listGroup = FXCollections.observableArrayList();
- ObservableList<String> listTest = FXCollections.observableArrayList();
- try{
- ResultSet resultSet = statement.executeQuery(sqlGroup);
- while(resultSet.next()){
- listGroup.add(resultSet.getString(1));
- }
- }catch (SQLException e) { e.printStackTrace();}
- try{
- ResultSet resultSet = statement.executeQuery(sqlTest);
- while (resultSet.next()){
- listTest.add(resultSet.getString(1));
- }
- }catch (SQLException e) { e.printStackTrace();}
- cmbGroupListResult.setItems(listGroup);
- cmbListTest.setItems(listTest);
- }
- private void getlist(){
- String sqlquery = "Select testname, disciplinename,idtest From alltests where creator = \"" + user.getLogin() +"\"";
- String t,d;
- int i;
- try{
- ResultSet resultSet = statement.executeQuery(sqlquery);
- while(resultSet.next()){
- t = resultSet.getString(1);
- d = resultSet.getString(2);
- i = resultSet.getInt(3);
- System.out.println(t + d);
- oblist.add(new ListTests(t,d,i));
- }
- }catch (SQLException e){e.printStackTrace();}
- }
- void getResultList(){
- String sql = "Select users.lastname, users.firstname, results.points, results.percents, results.score From results Inner Join users on results.login = users.login Where users.group = \""+selectedGroupFromResult +
- "\" And results.idtest = \""+selectedIdTestFromResult+"\"";
- System.out.println("sql = " + sql);
- try{
- ResultSet resultSet = statement.executeQuery(sql);
- while (resultSet.next())
- resultTests.add(new ResultTest(resultSet.getString(1),resultSet.getString(2),resultSet.getInt(3),resultSet.getInt(4),resultSet.getInt(5)));
- //resultTests.add(new ResultTest(resultSet.getString(1)));
- }catch (SQLException e) {e.printStackTrace();}
- for (ResultTest r: resultTests){
- System.out.println(r);
- }
- colLName.setCellValueFactory(new PropertyValueFactory<>("lastnamer"));
- colFName.setCellValueFactory(new PropertyValueFactory<>("firstnamer"));
- colScore.setCellValueFactory(new PropertyValueFactory<>("ratingr"));
- colPercent.setCellValueFactory(new PropertyValueFactory<>("percentr"));
- colRating.setCellValueFactory(new PropertyValueFactory<>("scorer"));
- tableResult.setItems(resultTests);
- }
- @FXML
- public void initialize() {
- //fill tab tests
- getlist();
- titletest.setCellValueFactory(new PropertyValueFactory<>("name"));
- disc.setCellValueFactory(new PropertyValueFactory<>("disc"));
- author.setCellValueFactory(new PropertyValueFactory<>("author"));
- idtest.setCellValueFactory(new PropertyValueFactory<>("id"));
- titletest.setText("Название");
- disc.setText("Дисциплина");
- tableTest.setItems(oblist);
- labelName.setText(user.getLastname() + " " + user.getFirstname() + " " + user.getMiddlename());
- //fill tab result
- fillCmbResult();
- }
- }
- class ResultTest{
- public ResultTest(String lastnamer, String firstnamer, Integer scorer, Integer percentr, Integer ratingr) {
- this.lastnamer = lastnamer;
- this.firstnamer = firstnamer;
- this.scorer = scorer;
- this.percentr = percentr;
- this.ratingr = ratingr;
- }
- public ResultTest(){}
- private String lastnamer, firstnamer;
- private Integer scorer;
- private Integer percentr;
- public String getLastnamer() {
- return lastnamer;
- }
- public void setLastnamer(String lastnamer) {
- this.lastnamer = lastnamer;
- }
- public String getFirstnamer() {
- return firstnamer;
- }
- public void setFirstnamer(String firstnamer) {
- this.firstnamer = firstnamer;
- }
- public Integer getScorer() {
- return scorer;
- }
- public void setScorer(Integer scorer) {
- this.scorer = scorer;
- }
- public Integer getPercentr() {
- return percentr;
- }
- public void setPercentr(Integer percentr) {
- this.percentr = percentr;
- }
- public Integer getRatingr() {
- return ratingr;
- }
- public void setRatingr(Integer ratingr) {
- this.ratingr = ratingr;
- }
- private Integer ratingr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement