|
@@ -25,6 +25,9 @@ import javafx.stage.Stage;
|
|
|
import java.time.chrono.AbstractChronology;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.Map;
|
|
|
+//For reading properties from .properties file
|
|
|
+import com.moviesdb.ConnectionParams;
|
|
|
+
|
|
|
|
|
|
public class Controller {
|
|
|
@FXML
|
|
@@ -60,14 +63,32 @@ public class Controller {
|
|
|
Movie[] movies;
|
|
|
Movie my_movie;
|
|
|
DataBaseConnector my_connector;
|
|
|
+ ConnectionParams workParams;
|
|
|
|
|
|
double xOffset;
|
|
|
double yOffset;
|
|
|
|
|
|
public void initialize(Stage primaryStage){
|
|
|
- my_connector = new DataBaseConnector();
|
|
|
- my_connector.initConnection("d","1");
|
|
|
+ /*
|
|
|
+ FileInputStream fis;
|
|
|
+ Properties property = new Properties();
|
|
|
+
|
|
|
+ try {
|
|
|
+ fis = new FileInputStream("src/main/resources/config.properties");
|
|
|
+ property.load(fis);
|
|
|
+
|
|
|
+ String host = property.getProperty("db.host");
|
|
|
+ String login = property.getProperty("db.login");
|
|
|
+ String password = property.getProperty("db.password");
|
|
|
+
|
|
|
+ System.out.println("HOST: " + host
|
|
|
+ + ", LOGIN: " + login
|
|
|
+ + ", PASSWORD: " + password);
|
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
+ System.err.println("ОШИБКА: Файл свойств отсуствует!");
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
ImageView minimizeImageView = new ImageView(new Image(getClass().getResourceAsStream("media\\minimize.png")));
|
|
|
minimizeImageView.setFitHeight(16);
|
|
@@ -111,6 +132,17 @@ public class Controller {
|
|
|
primaryStage.setY(event.getScreenY() + yOffset);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ //TODO change path to connection.properties
|
|
|
+ workParams = new ConnectionParams("src/com/moviesdb/connection.properties");
|
|
|
+ if (!workParams.initilized())
|
|
|
+ //TODO this is temporaly handler
|
|
|
+ System.out.println(workParams.getInitilizeErrCause().toString());
|
|
|
+ else {
|
|
|
+ my_connector = new DataBaseConnector();
|
|
|
+ my_connector.initConnection(workParams);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void loadPosters()
|