Пример #1
0
  private StudentDialog(Image image, String text) {
    super(Consts.Paths.STUDENT_DIALOG, image, text);

    gradeField.setInputRestriction(grade -> grade.length() <= 3);
    gradeField.setSubmitRestriction(grade -> gradeMatcher.reset(grade).matches());

    addTextFields(new TextField[] {nameField, gradeField});
  }
Пример #2
0
 @Override
 protected Student getFormResult() {
   return new Student(nameField.getText(), gradeField.getText());
 }
Пример #3
0
 @Override
 protected boolean isFilled() {
   return !nameField.getText().trim().isEmpty() && gradeField.isSubmitRestrictionMet();
 }
Пример #4
0
  public StudentDialog(Student student) {
    this(Consts.Images.CHANGE_DIALOG_HEADER, Consts.Dialogs.CHANGE_STUDENT_TEXT);

    nameField.setText(student.getName());
    gradeField.setText(student.getGrade());
  }