diff --git a/JavaFXApplication/src/main/java/javafxapplication/Controller/District/ListDistrictController.java b/JavaFXApplication/src/main/java/javafxapplication/Controller/District/ListDistrictController.java new file mode 100644 index 0000000..8d558ae --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Controller/District/ListDistrictController.java @@ -0,0 +1,15 @@ +package javafxapplication.Controller.District; + +import javafx.fxml.Initializable; + +import java.net.URL; +import java.util.ResourceBundle; + +public class ListDistrictController implements Initializable { + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + + } +} + diff --git a/JavaFXApplication/src/main/java/javafxapplication/Controller/House/ListHouseController.java b/JavaFXApplication/src/main/java/javafxapplication/Controller/House/ListHouseController.java new file mode 100644 index 0000000..8774b5a --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Controller/House/ListHouseController.java @@ -0,0 +1,62 @@ +package javafxapplication.Controller.House; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.ComboBox; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.cell.PropertyValueFactory; +import javafxapplication.Model.District; +import javafxapplication.Model.House; +import javafxapplication.Proxy.HouseProxy; + +import java.net.URL; +import java.util.Arrays; +import java.util.List; +import java.util.ResourceBundle; + +/** + * Created with IntelliJ IDEA. + * User: admin + * Date: 12/26/13 + * Time: 6:04 PM + * To change this template use File | Settings | File Templates. + */ +public class ListHouseController implements Initializable { + public TableColumn user; + public TableColumn district; + public TableColumn price; + public TableColumn adress; + public TableView tableView; + public ComboBox districComboBox; + HouseProxy houseProxy = new HouseProxy(); + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + user.setCellValueFactory(new PropertyValueFactory("user")); + district.setCellValueFactory(new PropertyValueFactory("district")); + price.setCellValueFactory(new PropertyValueFactory("price")); + adress.setCellValueFactory(new PropertyValueFactory("adress")); + } + + + @FXML + private void handleButtonAction(ActionEvent event) { + District district = (District)districComboBox.getValue(); +// Integer count = Integer.valueOf(text3.getText()); +// Double price = product.getPrice(); + long districtId = (district!=null)? (long) district.getId() :0; + + //WrittingOffProductRequest request = new WrittingOffProductRequest(productId,null,count,price); + + //soldProductsProxy.writtingOffProduct(request); + } + + public void textTolukta(ActionEvent actionEvent) { + List houses = Arrays.asList(houseProxy.getHouseInfo()); + tableView.getItems().setAll(houses); + } + + +} diff --git a/JavaFXApplication/src/main/java/javafxapplication/Controller/MainController.java b/JavaFXApplication/src/main/java/javafxapplication/Controller/MainController.java index cf45936..e9a9c5b 100644 --- a/JavaFXApplication/src/main/java/javafxapplication/Controller/MainController.java +++ b/JavaFXApplication/src/main/java/javafxapplication/Controller/MainController.java @@ -32,4 +32,8 @@ private void openControl(String controlPath) throws IOException { public void listSeller(ActionEvent actionEvent) throws IOException { openControl("/View/ListUserControl.fxml"); } + + public void listHouses(ActionEvent actionEvent) throws IOException { + openControl("/View/ListHousesControl.fxml"); + } } diff --git a/JavaFXApplication/src/main/java/javafxapplication/Controller/User/ListUserController.java b/JavaFXApplication/src/main/java/javafxapplication/Controller/User/ListUserController.java index 4be416f..c358b7d 100644 --- a/JavaFXApplication/src/main/java/javafxapplication/Controller/User/ListUserController.java +++ b/JavaFXApplication/src/main/java/javafxapplication/Controller/User/ListUserController.java @@ -16,3 +16,4 @@ public void initialize(URL url, ResourceBundle resourceBundle) { } } + diff --git a/JavaFXApplication/src/main/java/javafxapplication/Model/District.java b/JavaFXApplication/src/main/java/javafxapplication/Model/District.java new file mode 100644 index 0000000..14a17bb --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Model/District.java @@ -0,0 +1,34 @@ +package javafxapplication.Model; + +public class District { + private long id; + private String districtName; + + protected District() {} + + public District(String districtName) { + this.districtName = districtName; + } + + + public long getId() { + return id; + } + public void setId(long Id) + { + this.id = Id; + } + + public String getDistrictName() { + return districtName; + } + public String toString() + { + return getDistrictName(); + + } + + public void setDistrictName(String districtName) { + this.districtName = districtName; + } +} diff --git a/JavaFXApplication/src/main/java/javafxapplication/Model/House.java b/JavaFXApplication/src/main/java/javafxapplication/Model/House.java new file mode 100644 index 0000000..51c7c28 --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Model/House.java @@ -0,0 +1,61 @@ +package javafxapplication.Model; + +public class House { + private long id; + private String adress; + private Double price; + private District district; + private User user; + + protected House() {} + + public House(String adress, Double price, District district, User user) { + this.adress = adress; + this.price = price; + this.district = district; + this.user = user; + } + + + public String getAdress() { + return adress; + } + + public void setAdress(String adress) { + this.adress = adress; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public long getId() { + return id; + } + public void setId(long Id) + { + this.id = Id; + } + + + public District getDistrict() { + return district; + } + + public void setDistrict(District district) { + this.district = district; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } +} + diff --git a/JavaFXApplication/src/main/java/javafxapplication/Model/User.java b/JavaFXApplication/src/main/java/javafxapplication/Model/User.java index d69f9a6..39d8220 100644 --- a/JavaFXApplication/src/main/java/javafxapplication/Model/User.java +++ b/JavaFXApplication/src/main/java/javafxapplication/Model/User.java @@ -13,33 +13,39 @@ public class User { private long id; - private String fullName; - private String login; + private String username; + private String email; private String password; protected User() {} - public User(String firstName, String lastName, String password) { - this.fullName = firstName; - this.login = lastName; + public User(String username, String email, String password) { + this.username = username; + this.email = email; this.password = password; } - public String getFullName() { - return fullName; + public String getUsername() { + return username; } - public void setFullName(String fullName) { - this.fullName = fullName; + public void setUsername(String username) { + this.username = username; } - public String getLogin() { - return login; + public String toString() + { + return getUsername(); + + } + + public String getEmail() { + return email; } - public void setLogin(String login) { - this.login = login; + public void setEmail(String email) { + this.email = email; } public long getId() { diff --git a/JavaFXApplication/src/main/java/javafxapplication/Proxy/DistrictProxy.java b/JavaFXApplication/src/main/java/javafxapplication/Proxy/DistrictProxy.java new file mode 100644 index 0000000..3d5e831 --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Proxy/DistrictProxy.java @@ -0,0 +1,9 @@ +package javafxapplication.Proxy; + +import javafxapplication.Model.District; + +public class DistrictProxy extends Proxy { + public District[] getSellers() { + return restTemplate.getForObject(urlService.GetServerUrl("/districts/"), District[].class); + } +} diff --git a/JavaFXApplication/src/main/java/javafxapplication/Proxy/HouseProxy.java b/JavaFXApplication/src/main/java/javafxapplication/Proxy/HouseProxy.java new file mode 100644 index 0000000..e0416d3 --- /dev/null +++ b/JavaFXApplication/src/main/java/javafxapplication/Proxy/HouseProxy.java @@ -0,0 +1,10 @@ +package javafxapplication.Proxy; + +import javafxapplication.Model.House; + +public class HouseProxy extends Proxy { + public House[] getHouseInfo() { + return restTemplate.getForObject(urlService.GetServerUrl("/houses/"), House[].class); + } +} + diff --git a/JavaFXApplication/src/main/java/javafxapplication/Proxy/UserProxy.java b/JavaFXApplication/src/main/java/javafxapplication/Proxy/UserProxy.java index 35602ae..91b7ac1 100644 --- a/JavaFXApplication/src/main/java/javafxapplication/Proxy/UserProxy.java +++ b/JavaFXApplication/src/main/java/javafxapplication/Proxy/UserProxy.java @@ -9,6 +9,10 @@ * Time: 2:03 * To change this template use File | Settings | File Templates. */ -public class UserProxy extends Proxy { +public class UserProxy extends Proxy { + public User[] getSellers() { + return restTemplate.getForObject(urlService.GetServerUrl("/users/"), User[].class); + } } + diff --git a/JavaFXApplication/src/main/resources/View/ListHousesControl.fxml b/JavaFXApplication/src/main/resources/View/ListHousesControl.fxml new file mode 100644 index 0000000..8774ea0 --- /dev/null +++ b/JavaFXApplication/src/main/resources/View/ListHousesControl.fxml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + +