Beispiel #1
0
  public FamilyForm() {

    getStylesheets().add("/CSS/familyFormCss.css");

    save = new Button("Save");
    cancel = new Button("Cancel");

    Title.setFontSmoothingType(FontSmoothingType.LCD);
    Title.setFont(javafx.scene.text.Font.font(20));

    scrollPane = new ScrollPane(getSubGrid());
    scrollPane.setFitToWidth(true);

    save.setPrefWidth(80);
    cancel.setPrefWidth(80);

    clientID = Controller.getInstance().getStaffInfo().getAccountID();

    /////////////////////////////////// MAIN PANE ///////////////////////////////////

    setConstraints(Title, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER);
    setConstraints(scrollPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);

    getChildren().addAll(Title, scrollPane);

    save.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            if (Validate()) {
              String name = Name.getText().trim();

              if (Controller.isNotified && orginalName.equals("")) {
                orginalName = name;
              } else if (Controller.isNotified && !(orginalName.equals(""))) {
                if (!orginalName.equals(name)) {
                  orginalName = name;
                  Controller.isNotified = false;
                }
              }
              Save();
            }
          }
        });

    cancel.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            clear();
          }
        });
  }