|
@@ -0,0 +1,90 @@
|
|
|
+package com.moviesdb;
|
|
|
+
|
|
|
+import javafx.fxml.FXML;
|
|
|
+import javafx.fxml.FXMLLoader;
|
|
|
+import javafx.scene.Node;
|
|
|
+import javafx.scene.control.Button;
|
|
|
+import javafx.scene.control.TextArea;
|
|
|
+import javafx.scene.control.TextField;
|
|
|
+import javafx.scene.layout.AnchorPane;
|
|
|
+import javafx.scene.layout.FlowPane;
|
|
|
+import javafx.scene.text.Text;
|
|
|
+import javafx.scene.text.TextFlow;
|
|
|
+import javafx.stage.Modality;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+//For reading properties from .properties file
|
|
|
+
|
|
|
+public class AddMovieController extends Controller {
|
|
|
+
|
|
|
+ @FXML
|
|
|
+ Button addActorButton;
|
|
|
+
|
|
|
+ @FXML
|
|
|
+ FlowPane actorsGrid;
|
|
|
+
|
|
|
+ @FXML
|
|
|
+ TextField urlTextBox;
|
|
|
+ @FXML
|
|
|
+ TextField nameTextBox;
|
|
|
+ @FXML
|
|
|
+ TextField genreTextBox;
|
|
|
+ @FXML
|
|
|
+ TextArea descriptionTextBox;
|
|
|
+
|
|
|
+ Object caller;
|
|
|
+
|
|
|
+ public void open(Object caller) {
|
|
|
+ prepare();
|
|
|
+ stage.initModality(Modality.WINDOW_MODAL);
|
|
|
+ stage.initOwner(((BrowserController)caller).stage.getScene().getWindow());
|
|
|
+ this.caller = caller;
|
|
|
+ stage.setTitle("Log in");
|
|
|
+ stage.show();
|
|
|
+ descriptionTextBox.setWrapText(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addActor(){
|
|
|
+ try {
|
|
|
+ AnchorPane row = FXMLLoader.load(getClass().getResource("ActorRoleSegment.fxml"));
|
|
|
+ actorsGrid.getChildren().add(row);
|
|
|
+ }
|
|
|
+ catch (IOException ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ //System.out.println("LoginForm closed");
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addMovie(){
|
|
|
+ //read all textboxes
|
|
|
+ Movie NewMovie = new Movie();
|
|
|
+ NewMovie.movie_ImageLink = urlTextBox.getText();
|
|
|
+ NewMovie.movie_Name = nameTextBox.getText();
|
|
|
+ NewMovie.movie_Genre = genreTextBox.getText();
|
|
|
+ NewMovie.movie_Description = descriptionTextBox.getText();
|
|
|
+
|
|
|
+ try{
|
|
|
+ //AnchorPane row = (AnchorPane) actorsGrid.getChildren().get(1);
|
|
|
+ for (Node row : actorsGrid.getChildren()) {
|
|
|
+ System.out.println("Id: " + row.getId());
|
|
|
+ if (row instanceof AnchorPane) {
|
|
|
+ // clear
|
|
|
+ for (Node node : ((AnchorPane)row).getChildren()) {
|
|
|
+ System.out.println("Id: " + node.getId());
|
|
|
+ if (node instanceof TextField) {
|
|
|
+ // clear
|
|
|
+ ((TextField)node).setText("I have access");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ ((BrowserController)caller).my_connector.addMovie(NewMovie);
|
|
|
+ }
|
|
|
+}
|