-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
489 additions
and
16 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...plication/src/main/java/javafxapplication/Controller/District/ListDistrictController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
|
||
} | ||
} | ||
|
62 changes: 62 additions & 0 deletions
62
JavaFXApplication/src/main/java/javafxapplication/Controller/House/ListHouseController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<House, String>("user")); | ||
district.setCellValueFactory(new PropertyValueFactory<House, String>("district")); | ||
price.setCellValueFactory(new PropertyValueFactory<House, String>("price")); | ||
adress.setCellValueFactory(new PropertyValueFactory<House, String>("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<House> houses = Arrays.asList(houseProxy.getHouseInfo()); | ||
tableView.getItems().setAll(houses); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ public void initialize(URL url, ResourceBundle resourceBundle) { | |
|
||
} | ||
} | ||
|
34 changes: 34 additions & 0 deletions
34
JavaFXApplication/src/main/java/javafxapplication/Model/District.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
JavaFXApplication/src/main/java/javafxapplication/Model/House.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
JavaFXApplication/src/main/java/javafxapplication/Proxy/DistrictProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
JavaFXApplication/src/main/java/javafxapplication/Proxy/HouseProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
JavaFXApplication/src/main/resources/View/ListHousesControl.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.lang.*?> | ||
<?import javafx.collections.*?> | ||
<?import javafx.geometry.*?> | ||
<?import javafx.scene.control.*?> | ||
<?import javafx.scene.layout.*?> | ||
|
||
<FlowPane prefHeight="500.0" prefWidth="496.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="javafxapplication.Controller.House.ListHouseController"> | ||
<children> | ||
<TableView prefHeight="200.0" prefWidth="378.0"> | ||
<columns> | ||
<TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="105.0" text="Колдонуучу" fx:id="user"/> | ||
<TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="130.0" text="Жайгашкан район" fx:id="district" /> | ||
<TableColumn prefWidth="75.0" text="Баасы" fx:id="price" /> | ||
<TableColumn prefWidth="75.0" text="Адрес" fx:id="adress"/> | ||
</columns> | ||
</TableView> | ||
<Button mnemonicParsing="false" onAction="#handleButtonAction" text="Фильтрлөө" /> | ||
<ComboBox fx:id="districComboBox" prefHeight="21.0" prefWidth="123.0" promptText="Район тандоо"> | ||
</ComboBox> | ||
<Button mnemonicParsing="false" onAction="#textTolukta" text="Толукта" /> | ||
</children> | ||
</FlowPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
server/src/main/java/hello/Controller/DistrictController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package hello.Controller; | ||
|
||
import hello.Config; | ||
import hello.Model.District; | ||
import hello.Model.Repository.DistrictRepository; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
import org.springframework.context.support.AbstractApplicationContext; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
@Component | ||
@Controller | ||
public class DistrictController { | ||
@RequestMapping(value = "/districts") | ||
public @ResponseBody | ||
Iterable<District> listDistricts() { | ||
|
||
return getRepository().findAll(); | ||
} | ||
|
||
public DistrictRepository getRepository() { | ||
AbstractApplicationContext context = new AnnotationConfigApplicationContext(Config.class); | ||
return context.getBean(DistrictRepository.class); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
server/src/main/java/hello/Controller/HouseController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hello.Controller; | ||
|
||
import hello.Config; | ||
import hello.Model.House; | ||
import hello.Model.Repository.HouseRepository; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
import org.springframework.context.support.AbstractApplicationContext; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
@Component | ||
@Controller | ||
public class HouseController { | ||
@RequestMapping(value = "/houses") | ||
public @ResponseBody | ||
Iterable<House> listHouses() { | ||
|
||
return getRepository().findAll(); | ||
} | ||
|
||
public HouseRepository getRepository() { | ||
AbstractApplicationContext context = new AnnotationConfigApplicationContext(Config.class); | ||
return context.getBean(HouseRepository.class); | ||
} | ||
} | ||
|
Oops, something went wrong.