title: Passing an argument to a controller with an initialize method
body: <p>I have a tableView in that specific controller which i want to initialize with the passed argument's values. 
  The problem is, the initialize method is being executed before the controller sets The argument to a varaible.
  Any suggestions would be great. </p>
  
  <p>I am refering to the Location argument just to be clear.</p>
  
  <p><strong>here is the call method for the controller:</strong></p>
  
  <pre><code>protected static void openReservationNewDialog(Location loc){
      try{
           FXMLLoader loader = new FXMLLoader();
  
              loader.setLocation(viewLogic.class.getResource("openNewReservations.fxml"));
  
              AnchorPane page = (AnchorPane) loader.load();
              Stage dialogStage = new Stage();
              dialogStage.setTitle("New Reservation");
              dialogStage.setResizable(false);
              Scene scene = new Scene(page);
              dialogStage.setScene(scene);
              openReservationNewDialogController controller=loader.getController();
  
                  controller.setDialogStage(dialogStage);
                  controller.setSelectedLocation(loc);
              dialogStage.showAndWait();
  
      } catch(Exception e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p><strong>here is the relevant controller part:</strong></p>
  
  <pre><code>public class openReservationNewDialogController implements Initializable{
  
      @FXML
      private  TextField reservationId;
      /**Reservation's member*/
      @FXML
      private  ComboBox&lt;String&gt; member=new ComboBox&lt;String&gt;();
      @FXML
      private ComboBox&lt;String&gt; sMinutes= new ComboBox&lt;String&gt;(); 
      @FXML
      private ComboBox&lt;String&gt; eMinutes= new ComboBox&lt;String&gt;(); 
      @FXML
      private ComboBox&lt;String&gt; sHours= new ComboBox&lt;String&gt;();
      @FXML
      private ComboBox&lt;String&gt; eHours= new ComboBox&lt;String&gt;();
      private ArrayList&lt;String&gt; minutes=new ArrayList&lt;&gt;();
      private ArrayList&lt;String&gt; hours= new ArrayList&lt;String&gt;();
      @FXML
      /**Reservation's pick'n'drop locations (the same)*/
      private  Location loc;
      /**Reservation's start time*/
      @FXML
      private  DatePicker startTimeAndDate;
      /**Reservation's end time*/
      @FXML
      private DatePicker endTimeAndDate;
      private Stage dialogStage;
      @FXML
      private ObservableList&lt;Reservation&gt; loca=FXCollections.observableArrayList();
      @FXML
      private TableView&lt;Reservation&gt; table;
      @FXML
      private TableColumn&lt;Reservation, String&gt; reservationID;
      @FXML
      private TableColumn&lt;Reservation, String&gt; startTimeAndDateRes;
      @FXML
      private TableColumn&lt;Reservation, String&gt; endTimeAndDateREs;
  
      public void setSelectedLocation(Location selectedLocation){
  
          this.loc=selectedLocation;
      }
  
          @FXML
          private void handleCancel(){
              dialogStage.close();    
          }
          public void setDialogStage(Stage dialogStage) {
              this.dialogStage=dialogStage;
  
          }
  
          @Override
          public void initialize(URL location, ResourceBundle resources) {
               reservationId.addEventFilter(KeyEvent.KEY_TYPED , TextFilters.numeric_Validation(4));
  
                  for(Member mem : viewLogic.sData.getMembers().values()){
                      member.getItems().add(mem.getMemIdp().get());
                  }
                  //set combo boxes for time
                  initializeMinutes();
                  sMinutes.getItems().addAll(minutes);
                  eMinutes.getItems().addAll(minutes);
                  initializeHours();
                  sHours.getItems().addAll(hours);
                  eHours.getItems().addAll(hours);
  
  
  
  
                  if(!loc.getReservations().isEmpty()){
                  loca.addAll((viewLogic.sData.getLocations().get(loc.getIdP().get()).getReservations().values()));
                  reservationID.setCellValueFactory(cellData -&gt; cellData.getValue().getReservationIdp());
                  startTimeAndDateRes.setCellValueFactory(cellData -&gt; cellData.getValue().getStartTimeAndDateP());
                  endTimeAndDateREs.setCellValueFactory(cellData -&gt; cellData.getValue().getEndTimeAndDateP());
                  table.setItems(loca);}
  
          }
  </code></pre>