|
@@ -142,8 +142,8 @@ public class EditMovieController extends Controller {
|
|
|
borderRight.setOnMouseDragged(new EventHandler<MouseEvent>() {
|
|
|
@Override
|
|
|
public void handle(MouseEvent event) {
|
|
|
- if (event.getScreenX() + xOffset >= stage.getMinWidth())
|
|
|
- stage.setWidth(event.getScreenX() + xOffset);
|
|
|
+ if (event.getScreenX() + xOffset >= stage.getMinWidth())
|
|
|
+ stage.setWidth(event.getScreenX() + xOffset);
|
|
|
else
|
|
|
stage.setWidth(stage.getMinWidth());
|
|
|
}
|
|
@@ -171,7 +171,15 @@ public class EditMovieController extends Controller {
|
|
|
descriptionTextBox.setText(editableMovie.description());
|
|
|
|
|
|
//TODO ADD ACTORS INFO
|
|
|
- addActor();
|
|
|
+ List<Role> Role = ((BrowserController) caller).getRolesFromConnection(editableMovie.id());
|
|
|
+
|
|
|
+ for (Role row : Role) {
|
|
|
+ moveFloatingElements(35);
|
|
|
+ addFilledRole(row);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((actorsGridAncor.getChildren().size()) == 1)
|
|
|
+ addActor();
|
|
|
}
|
|
|
|
|
|
public void addActor() {
|
|
@@ -221,7 +229,7 @@ public class EditMovieController extends Controller {
|
|
|
|
|
|
|
|
|
//TODO Сheck on id (if addMovie(...) = -1 movie not added)
|
|
|
- NewMovie.setId(((BrowserController)caller).my_connector.addMovie(NewMovie));
|
|
|
+ NewMovie.setId(((BrowserController) caller).my_connector.addMovie(NewMovie));
|
|
|
System.out.println("Added Movie with ID: " + NewMovie.id());
|
|
|
|
|
|
List<Role> newMovieRoles = fetchRoles(NewMovie);
|
|
@@ -291,4 +299,42 @@ public class EditMovieController extends Controller {
|
|
|
}
|
|
|
return roles;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void addFilledRole(Role filledRole) {
|
|
|
+ try {
|
|
|
+ //AnchorPane row = (AnchorPane) actorsGrid.getChildren().get(1);
|
|
|
+ addActor();
|
|
|
+ Node row = actorsGridAncor.getChildren().get(actorsGridAncor.getChildren().size()-1);
|
|
|
+
|
|
|
+ System.out.println("Type: " + row.toString());
|
|
|
+ if (row instanceof AnchorPane) {
|
|
|
+ for (Node hbox : ((AnchorPane) row).getChildren()) {
|
|
|
+ System.out.println("\t-Type: " + hbox.toString());
|
|
|
+
|
|
|
+ if (hbox instanceof HBox)
|
|
|
+ for (Node halfrow : ((HBox) hbox).getChildren()) {
|
|
|
+ System.out.println("\t\t-Type: " + halfrow.toString());
|
|
|
+
|
|
|
+ if (halfrow instanceof AnchorPane)
|
|
|
+ for (Node part : ((AnchorPane) halfrow).getChildren()) {
|
|
|
+ System.out.println("\t\t\t-Type: " + part.toString());
|
|
|
+
|
|
|
+ if (part instanceof TextField) {
|
|
|
+ System.out.println("\t\t\t\t Text: " + ((TextField) part).getText());
|
|
|
+ if (part.getId().equals("actorName")) {
|
|
|
+ ((TextField) part).setText(filledRole.actor());
|
|
|
+ }
|
|
|
+ if (part.getId().equals("actorRole")) {
|
|
|
+ ((TextField) part).setText(filledRole.role());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|