@FXML
  void actionComboBoxHandler(ActionEvent event) throws IOException {

    Parent parent;
    int selectedIndex = actionComboBox.getSelectionModel().getSelectedIndex();
    String title = actionComboBox.getSelectionModel().getSelectedItem();

    // Switch to a different scene based on choice selected by user
    switch (selectedIndex) {
      case 0:
        parent = FXMLLoader.load(getClass().getResource("/fxml/AddPlayer.fxml"));
        break;
      case 1:
        parent = FXMLLoader.load(getClass().getResource("/fxml/AddGame.fxml"));
        break;
      case 2:
        parent = FXMLLoader.load(getClass().getResource("/fxml/UpdatePlayer.fxml"));
        break;
      case 3:
        parent = FXMLLoader.load(getClass().getResource("/fxml/DisplayPlayerGame.fxml"));
        break;
      default:
        parent = FXMLLoader.load(getClass().getResource("/fxml/MainWindow.fxml"));
        break;
    }

    // Set scene
    super.setScreen(event, parent, title);
  }
 private void loadWorkflowProcessesComboBox() {
   workflowProcessesComboBox.getItems().clear();
   // workflowProcessesComboBox.getItems().add(WorkflowProcess.PROMPT);
   workflowProcessesComboBox.getItems().add(WorkflowProcess.REVIEW3);
   workflowProcessesComboBox.getItems().add(WorkflowProcess.DUAL_REVIEW);
   workflowProcessesComboBox.getSelectionModel().select(null);
 }
  public void resetOptions(String[] options) {
    xpicker.getItems().addAll(options);
    ypicker.getItems().addAll(options);
    colorpicker.getItems().addAll(options);

    System.out.println("asdfasd");
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {

    ImageView backImgBtnLayout =
        createImageBtnLayout(
            Constants.BACK_IMAGE_PATH, Constants.BACK_IMAGE_WIDTH, Constants.BACK_IMAGE_HEIGHT);
    backBtn.setGraphic(backImgBtnLayout);
    ImageView addImgBtnLayout =
        createImageBtnLayout(
            Constants.ADD_BUTTON_IMAGE_PATH, Constants.ADD_IMAGE_WIDTH, Constants.ADD_IMAGE_HEIGHT);
    addButton.setGraphic(addImgBtnLayout);

    cancelBtn.setOnAction(
        event -> {
          showWindow(true, false);
          setTitle(Constants.CHARACTER_SCENE_HEADER.toUpperCase());
        });

    levelField.setEditable(false);

    classBox.setItems(
        FXCollections.observableArrayList(
            "Guardin",
            "Assassin",
            "Archmage",
            "Necromancer",
            "Prophet",
            "Shaman",
            "Druid",
            "Ranger"));
    characterRaceBox.setItems(
        FXCollections.observableArrayList(
            "Human", "Gnome", "Dwarf", "Elf", "Eladin", "Tiefling", "Deva", "Goliath"));
  }
  public void btnAddAssistantOrProfessor_Pressed() {
    if (!chBxAssistantsOrProfessors.getSelectionModel().isEmpty()) {
      ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems();

      String valueSelected = chBxAssistantsOrProfessors.getSelectionModel().getSelectedItem();
      String rut = valueSelected.split("-")[valueSelected.split("-").length - 1];

      for (Professor professor : Manager.INSTANCE.professors) {
        if (rut.equals(professor.getRut())) {
          if (!((Lecture) Manager.INSTANCE.currentEditignICourse)
              .getProfessors()
              .contains(professor)) {
            ((Lecture) Manager.INSTANCE.currentEditignICourse).addProfessor(professor);
            updatedElements.add(valueSelected);
            listAssistantsOrProfessors.setItems(FXCollections.observableArrayList(updatedElements));
            break;
          } else {
            ViewUtilities.showAlert("El profesor ya se encuentra en ese curso");
            break;
          }
        }
      }
    } else {
      ViewUtilities.showAlert("Select a professor to add");
    }
  }
 public void setFromUnit(Unit unit) {
   if (unit != null) {
     fromCombo.getSelectionModel().select(unit);
   } else {
     fromCombo.getSelectionModel().clearSelection();
   }
 }
 private void setTableData(List<List<String>> data) {
   tableData = new ObservableListWrapper<>(data);
   int numberOfColumns = data.stream().map(List::size).reduce(Math::max).orElse(0);
   contentTable.getColumns().clear();
   colMapping = new ArrayList<>();
   for (int i = 0; i < numberOfColumns; i++) {
     colMapping.add(DONT_USE);
     TableColumn<List<String>, String> column = new TableColumn<>();
     final int index = i;
     ComboBox<String> selector = generateVariableSelector();
     selector
         .getSelectionModel()
         .selectedItemProperty()
         .addListener((prop, oldValue, newValue) -> colMapping.set(index, newValue));
     column.setGraphic(selector);
     column.setCellValueFactory(
         (TableColumn.CellDataFeatures<List<String>, String> param) -> {
           List<String> row = param.getValue();
           String value = row.size() > index ? row.get(index) : null;
           return new SimpleStringProperty(value);
         });
     contentTable.getColumns().add(column);
   }
   contentTable.setItems(tableData);
 }
  public void confirm(ActionEvent event) {
    String name = nameField.getText();
    if (S.isEmpty(name)) {
      tipsLabel.setText("错误:工具名字不能为空!");
      nameField.requestFocus();
      return;
    }
    String command = commandText.getText();
    String order = orderField.getText();
    ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem();
    Integer parentId = bandeja.getId();
    ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem();
    String type = toolType.getToolType();

    ToolsTray toolsTray = new ToolsTray();
    toolsTray.setTrayName(name);
    toolsTray.setCommand(command);
    toolsTray.setParentId(parentId);
    toolsTray.setToolOrder(order);
    toolsTray.setToolType(type);
    if (null == id) {
      dao.insert(toolsTray);
      id = toolsTray.getId();
      tipsLabel.setText("添加成功:" + name);
    } else {
      toolsTray.setId(id);
      dao.update(toolsTray);
      tipsLabel.setText("更新成功:" + name);
    }
    refresh(null);
  }
 public void setupBindings() {
   populateProdFreqValues();
   populateProdTypeValues();
   populateBillCategoryValues();
   refreshProdSpecialPriceTable();
   checkItems();
   dowTF
       .getItems()
       .addAll("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
   nameTF.setText(productRow.getName());
   typeTF.getSelectionModel().select(productRow.getType());
   priceTF.setText("" + productRow.getPrice());
   mondayTF.setText("" + productRow.getMonday());
   tuesdayTF.setText("" + productRow.getTuesday());
   wednesdayTF.setText("" + productRow.getWednesday());
   thursdayTF.setText("" + productRow.getThursday());
   fridayTF.setText("" + productRow.getFriday());
   saturdayTF.setText("" + productRow.getSaturday());
   sundayTF.setText("" + productRow.getSunday());
   codeTF.setText(productRow.getCode());
   dowTF.getSelectionModel().select(productRow.getDow());
   firstDeliveryDate.setValue(productRow.getFirstDeliveryDate());
   issueDate.setValue(productRow.getIssueDate());
   billCategoryTF.getSelectionModel().select(productRow.getBillCategory());
 }
 @FXML
 public void handleUpdateVideoRegionAttribute(ActionEvent e) {
   if (updateVideoRegionAttribute_row.getText().isEmpty()
       || updateVideoRegionAttribute_col.getText().isEmpty()
       || updateVideoRegionAttribute_height.getText().isEmpty()
       || updateVideoRegionAttribute_width.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .updateVideoRegionAttribute(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   updateVideoRegionAttribute_units.getSelectionModel().getSelectedItem()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   updateVideoRegionAttribute_function.getSelectionModel().getSelectedItem()),
               Integer.parseInt(updateVideoRegionAttribute_row.getText()),
               Integer.parseInt(updateVideoRegionAttribute_col.getText()),
               Integer.parseInt(updateVideoRegionAttribute_height.getText()),
               Integer.parseInt(updateVideoRegionAttribute_width.getText()),
               Integer.parseInt(updateVideoRegionAttribute_attribute.getText()));
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
 @FXML
 public void handleDrawBox(ActionEvent e) {
   if (drawBox_row.getText().isEmpty()
       || drawBox_column.getText().isEmpty()
       || drawBox_height.getText().isEmpty()
       || drawBox_width.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .drawBox(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   drawBox_units.getSelectionModel().getSelectedItem()),
               Integer.parseInt(drawBox_row.getText()),
               Integer.parseInt(drawBox_column.getText()),
               Integer.parseInt(drawBox_height.getText()),
               Integer.parseInt(drawBox_width.getText()),
               Integer.parseInt(drawBox_attribute.getText()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   drawBox_borderType.getSelectionModel().getSelectedItem()));
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
 @FXML
 public void handleSaveVideoRegion(ActionEvent e) {
   if (saveVideoRegion_row.getText().isEmpty()
       || saveVideoRegion_column.getText().isEmpty()
       || saveVideoRegion_height.getText().isEmpty()
       || saveVideoRegion_width.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .saveVideoRegion(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   saveVideoRegion_units.getSelectionModel().getSelectedItem()),
               Integer.parseInt(saveVideoRegion_row.getText()),
               Integer.parseInt(saveVideoRegion_column.getText()),
               Integer.parseInt(saveVideoRegion_height.getText()),
               Integer.parseInt(saveVideoRegion_height.getText()),
               saveVideoRegion_bufferID.getSelectionModel().getSelectedItem());
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
Example #13
0
  /**
   * shows the options to edit the selected shape
   *
   * @param selectedShape the shape currently selected
   */
  public void shapeSelected(ReactiveShape selectedShape) {
    shape = selectedShape;

    switch (shape.getShapeType()) {
      case ReactiveShape.RECTANGLE:
        type.setValue(TYPE_RECTANGLE);
        break;
      case ReactiveShape.CIRCLE:
        type.setValue(TYPE_CIRCLE);
        break;
      case ReactiveShape.TRIANGLE:
        type.setValue(TYPE_TRIANGLE);
        break;
    }

    backgroundPane.setVisible(false);
    shapePane.setVisible(true);

    color.setValue(shape.getColor());
    filled.setSelected(shape.isFilled());
    borderThickness.setText("" + shape.getBorderThickness());
    borderColor.setValue(shape.getBorderColor());
    width.setText("" + (int) shape.getWidth());
    height.setText("" + (int) shape.getHeight());
  }
 @FXML
 public void handleControlClock(ActionEvent e) {
   if (controlClock_hour.getText().isEmpty()
       || controlClock_min.getText().isEmpty()
       || controlClock_sec.getText().isEmpty()
       || controlClock_row.getText().isEmpty()
       || controlClock_column.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .controlClock(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   controlClock_units.getSelectionModel().getSelectedItem()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   controlClock_function.getSelectionModel().getSelectedItem()),
               controlClock_clockID.getSelectionModel().getSelectedItem(),
               Integer.parseInt(controlClock_hour.getText()),
               Integer.parseInt(controlClock_min.getText()),
               Integer.parseInt(controlClock_sec.getText()),
               Integer.parseInt(controlClock_row.getText()),
               Integer.parseInt(controlClock_column.getText()),
               Integer.parseInt(controlClock_attribute.getText()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   controlClock_mode.getSelectionModel().getSelectedItem()));
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
  private void eliminar() {

    if (comboListar.getSelectionModel().getSelectedIndex() == 0) {
      eliminar(
          5,
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
          6);
      txtfNombre.setText(null);
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 1) {
      eliminar(
          6,
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
          7);
      txtfNombre.setText(null);
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 2) {
      eliminar(
          7,
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
          8);
      txtfNombre.setText(null);
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 3) {
      eliminar(
          8,
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
          5);
      txtfNombre.setText(null);
    }
  }
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   cbst1.setItems(list1);
   cbst2.setItems(list1);
   cbst.setItems(list1);
   cbpp.setItems(list2);
 }
Example #17
0
  @FXML
  public void initialize(URL location, ResourceBundle resources) {
    for (String s : Main.settings.getSkins()) {
      skin.getItems().add(s);
    }
    skin.setValue(Main.settings.getSkin());

    skin.setOnAction(
        event -> {
          Main.settings.setSkin(skin.getSelectionModel().getSelectedItem());
          save();
        });

    for (String list : Main.settings.getLists().keySet()) {
      TextField k = new TextField(list);
      k.setId(list);

      String listName = Main.settings.getLists().get(list);
      TextField v = new TextField(listName);
      v.setId("V" + list);

      Button deleteButton = new Button();
      deleteButton.setText("Delete");

      addListListener(k, v, deleteButton);

      lists.getChildren().add(k);
      listsName.getChildren().add(v);
      deleteButtons.getChildren().add(deleteButton);
    }
  }
Example #18
0
  @Override
  public void refresh() {
    getRoot()
        .getScene()
        .addEventFilter(
            KeyEvent.KEY_PRESSED,
            new EventHandler<KeyEvent>() {

              @Override
              public void handle(KeyEvent event) {
                if (event.getCode().equals(KeyCode.ESCAPE)) {
                  cancel();
                } else if (event.getCode().equals(KeyCode.ENTER)) {
                  save();
                }
              }
            });
    languages.getItems().clear();
    languages.getItems().addAll(ResourceUtil.LOCALES);
    languages.setConverter(
        new StringConverter<Locale>() {

          @Override
          public Locale fromString(String string) {
            return null;
          }

          @Override
          public String toString(Locale object) {
            return object.getDisplayLanguage();
          }
        });
    languages.getSelectionModel().select(getPresenter().getLanguage());
  }
 /** Sets the CharacterSetComboBox Values corresponding to the allowed Values for this device. */
 private void setUpSelectCharacterSetCharacterSet() {
   selectCharacterSet_characterSet.getItems().clear();
   try {
     for (int i = 0;
         i < ((RemoteOrderDisplay) service).getCharacterSetList().split(",").length;
         i++) {
       selectCharacterSet_characterSet
           .getItems()
           .add(
               Integer.parseInt(
                   (((RemoteOrderDisplay) service).getCharacterSetList().split(","))[i]));
       if (i == 0) {
         selectCharacterSet_characterSet.setValue(
             Integer.parseInt(
                 (((RemoteOrderDisplay) service).getCharacterSetList().split(","))[i]));
       }
     }
   } catch (JposException e) {
     e.printStackTrace();
     JOptionPane.showMessageDialog(
         null,
         "Error occured when getting the CharacterSetList",
         "Error occured!",
         JOptionPane.WARNING_MESSAGE);
   }
 }
Example #20
0
  /**
   * Filters the list from "unfilteredList" based on the entered string and set the resultant list
   * to the combobox.
   *
   * @param newval
   */
  protected void filterBasedOnString(String newval) {
    if (newval == null || newval.equals("")) {
      super.getItems().setAll(unfilteredList);
    } else {
      int caretPosition = super.getEditor().getCaretPosition();
      super.getItems().clear();
      for (T item : unfilteredList) {
        String str = "";
        if (getConverter() == null) {
          str = item.toString().toLowerCase();
        } else {
          str = getConverter().toString(item).toLowerCase();
        }

        boolean containsParts = true;
        final String[] splitted = newval.toLowerCase().split("\\s+");
        for (final String splitPart : splitted) {
          if (!splitPart.isEmpty() && !str.contains(splitPart)) {
            containsParts = false;
          }
        }
        if (containsParts) {
          super.getItems().add(item);
        }
      }
      // if a value was selected and then removed the string is cleared which shouldn't happen
      super.getEditor().setText(newval);
      super.getEditor().positionCaret(caretPosition);
    }
  }
 private void clearTabGezinInvoer() {
   // todo opgave 3
   cbOuder1Invoer.getSelectionModel().clearSelection();
   cbOuder2Invoer.getSelectionModel().clearSelection();
   tfHuwelijkInvoer.clear();
   tfScheidingInvoer.clear();
 }
  private void showPersoon(Persoon persoon) {
    if (persoon == null) {
      clearTabPersoon();
    } else {
      tfPersoonNr.setText(persoon.getNr() + "");
      tfVoornamen.setText(persoon.getVoornamen());
      tfTussenvoegsel.setText(persoon.getTussenvoegsel());
      tfAchternaam.setText(persoon.getAchternaam());
      tfGeslacht.setText(persoon.getGeslacht().toString());
      tfGebDatum.setText(StringUtilities.datumString(persoon.getGebDat()));
      tfGebPlaats.setText(persoon.getGebPlaats());
      if (persoon.getOuderlijkGezin() != null) {
        cbOuderlijkGezin.getSelectionModel().select(persoon.getOuderlijkGezin());
      } else {
        cbOuderlijkGezin.getSelectionModel().clearSelection();
      }
      // todo opgave 3

      this.alsOuderBetrokkenIn =
          FXCollections.observableArrayList(persoon.getAlsOuderBetrokkenIn());

      ArrayList<Persoon> pList = new ArrayList<Persoon>();
      for (Gezin g : persoon.getAlsOuderBetrokkenIn()) {
        pList.addAll(g.getKinderen());
      }

      this.kinderen = FXCollections.observableArrayList(pList);

      lvAlsOuderBetrokkenBij.setItems(this.getAlsOuderBetrokkenIn());
    }
  }
 private void setUpCheckHealthLevel() {
   checkHealth_level.getItems().clear();
   checkHealth_level.getItems().add(CommonConstantMapper.JPOS_CH_INTERNAL.getConstant());
   checkHealth_level.getItems().add(CommonConstantMapper.JPOS_CH_EXTERNAL.getConstant());
   checkHealth_level.getItems().add(CommonConstantMapper.JPOS_CH_INTERACTIVE.getConstant());
   checkHealth_level.setValue(CommonConstantMapper.JPOS_CH_INTERNAL.getConstant());
 }
Example #24
0
  /**
   * Add filters according to the current emulation and chip model of the currently played tune.
   *
   * @param tune currently played tune
   * @param num SID chip number
   * @param filters resulting filter list to add matching filter names to
   * @param filter combo box to select currently selected filter
   */
  private void addFilters(
      final SidTune tune, int num, ObservableList<String> filters, ComboBox<String> filter) {
    EmulationSection emulationSection = util.getConfig().getEmulationSection();

    boolean filterEnable = emulationSection.isFilterEnable(num);

    Emulation emulation = Emulation.getEmulation(emulationSection, tune, num);
    ChipModel model = ChipModel.getChipModel(emulationSection, tune, num);
    String filterName = filterEnable ? emulationSection.getFilterName(num, emulation, model) : null;

    filters.clear();
    filters.add("");
    for (IFilterSection filterSection : util.getConfig().getFilterSection()) {
      if (emulation.equals(Emulation.RESIDFP)) {
        if (filterSection.isReSIDfpFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDfpFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      } else {
        if (filterSection.isReSIDFilter6581() && model == ChipModel.MOS6581) {
          filters.add(filterSection.getName());
        } else if (filterSection.isReSIDFilter8580() && model == ChipModel.MOS8580) {
          filters.add(filterSection.getName());
        }
      }
    }
    if (filterEnable) {
      filter.getSelectionModel().select(filterName);
    } else {
      filter.getSelectionModel().select(0);
    }
  }
  public void btnSaveCourse_Pressed() {
    Schedule schedule = Manager.INSTANCE.currentEditingSchedule;
    Classroom classroom = null;

    if (!chBxClassrooms.getSelectionModel().isEmpty()) {
      String classroomString = chBxClassrooms.getSelectionModel().getSelectedItem();
      for (Classroom classroomLocal : Manager.INSTANCE.classrooms) {
        if (classroomLocal.getInitials().equals(classroomString)) {
          classroom = classroomLocal;
          break;
        }
      }

      String alertMessage = "";

      String clashes = "";
      ICourse iCourse = Manager.INSTANCE.currentEditignICourse;
      for (Professor professor : ((Lecture) iCourse).getProfessors()) {
        String pClash = CourseModificationChecker.professorClash(professor, schedule, iCourse);
        if (!pClash.equals("")) {
          clashes +=
              professor.getName() + " " + professor.getLastnameFather() + ":" + pClash + "\n";
        }
      }

      if (!clashes.equals("")) {
        alertMessage +=
            "No se puede usar este horario, ya que tiene problemas de topes de horarios de profesores:\n"
                + clashes;
      }

      clashes =
          CourseModificationChecker.classroomClash(
              classroom, schedule, Manager.INSTANCE.currentEditignICourse);

      if (clashes != "") {
        alertMessage +=
            "No se puede crear la clase debido a que la sala esta ocupada en ese horario por otro(s) curso(s):\n"
                + clashes;
      }

      if (!alertMessage.equals("")) {
        ViewUtilities.showAlert(alertMessage);
      } else {
        Manager.INSTANCE.currentEditignICourse.setSchedule(schedule);
        Manager.INSTANCE.currentEditignICourse.setClassroom(classroom);

        if (isCreating) {
          Manager.INSTANCE.currentEditignCourse.addCourse(Manager.INSTANCE.currentEditignICourse);
        }

        Manager.INSTANCE.currentEditignICourse = null;
        Manager.INSTANCE.currentEditingSchedule = null;
        super.btnBack_Pressed();
      }
    } else {
      ViewUtilities.showAlert("Primero debes asignar una sala a la clase");
    }
  }
Example #26
0
  private boolean verificarCampos() {

    Validacao.voltarCampoAoNormal(this.txtNome);
    Validacao.voltarCampoAoNormal(this.txtEmail);
    Validacao.voltarCampoAoNormal(this.txtTelefone);
    Validacao.voltarCampoAoNormal(this.txtCelular);
    Validacao.voltarCampoAoNormal(this.txtCep);

    if (Validacao.valorVazio(this.txtNome.getText())) {
      Alerta.mostrarMensagemDeEsquecimentoDePreenchimentoDeCampo();
      Validacao.realcarCampo(this.txtNome);
      return false;
    } else if (Validacao.validarEmail(this.txtEmail.getText()) == false) {
      Alerta.mostrarMensagemErro("O e-mail digitado é inválido!", "E-mail Inválido");
      Validacao.realcarCampo(this.txtEmail);
      return false;
    } else if (this.txtTelefone.getText().length() != 10
        && Validacao.valorVazio(this.txtTelefone.getText()) == false) {
      Alerta.mostrarMensagemErro(
          "O Telefone não foi preenchido completamente!", "Telefone Incompleto");
      Validacao.realcarCampo(this.txtTelefone);
      return false;
    } else if (this.txtCelular.getText().length() != 11
        && Validacao.valorVazio(this.txtTelefone.getText()) == false) {
      Alerta.mostrarMensagemErro(
          "O Celular não foi preenchido completamente!", "Celular Incompleto");
      Validacao.realcarCampo(this.txtCelular);
      return false;
    } else if (this.txtCep.getText().length() != 8
        && Validacao.valorVazio(this.txtCep.getText()) == false) {
      Alerta.mostrarMensagemErro("O CEP não foi preenchido completamente", "CEP Incompleto");
      Validacao.realcarCampo(this.txtCep);
      return false;
    }

    boolean dataPreenchidaPelaMetade = false;

    try {
      this.getDataNascimentoPreenchida();
    } catch (Exception e) {
      dataPreenchidaPelaMetade = true;
    }

    if (dataPreenchidaPelaMetade) {
      Alerta.mostrarMensagemErro(
          "A data de nascimento não foi preenchida completamente!",
          "Data de Nascimento Incompleta");
      if (this.cmbDia.getSelectionModel().isEmpty()) {
        cmbDia.setStyle("-fx-border-color:red; -fx-border-width: 2px;");
      } else if (this.cmbMes.getSelectionModel().isEmpty()) {
        cmbMes.setStyle("-fx-border-color:red; -fx-border-width: 2px;");
      } else if (this.cmbAno.getSelectionModel().isEmpty()) {
        cmbAno.setStyle("-fx-border-color:red; -fx-border-width: 2px;");
      }
      return false;
    } else {
      return true;
    }
  }
 private ComboBox<String> generateVariableSelector() {
   Set vars = new TreeSet<>();
   actions.stream().map(Action::getVariableNames).forEach(vars::addAll);
   ComboBox<String> box = new ComboBox<>();
   vars.add(DONT_USE);
   box.getItems().addAll(vars);
   return box;
 }
  private ComboBox addMazeGeneratorComboBox() {
    ObservableList<String> mazeGenerationTypes =
        FXCollections.observableArrayList(Maze.DEFAULT_MAZE_TYPE, Maze.BRAID_MAZE_TYPE);

    final ComboBox mazeGenComboBox = new ComboBox(mazeGenerationTypes);
    mazeGenComboBox.setValue(Maze.DEFAULT_MAZE_TYPE);
    return mazeGenComboBox;
  }
  @Override
  public void removeFrom(Object sceneGraphObject) {
    assert sceneGraphObject != null;

    @SuppressWarnings("unchecked")
    final ComboBox<String> comboBox = (ComboBox<String>) sceneGraphObject;
    comboBox.getItems().clear();
  }
 @Override
 public void acaoFinalizar() {
   if (validarFormulario()) {
     String idContaOrigem = contaOrigem.getSelectionModel().getSelectedItem().getIdCategoria();
     String idContaDestino = contaDestino.getSelectionModel().getSelectedItem().getIdCategoria();
     if (acao == Acao.CADASTRAR) {
       Transferencia item =
           new Transferencia(
               null,
               idContaOrigem,
               idContaDestino,
               itemController.getIdItem(),
               descricao.getText(),
               valor.getText(),
               data.getValue(),
               Datas.getHoraAtual());
       item.cadastrar();
       new Conta().alterarSaldo(Operacao.DECREMENTAR, idContaOrigem, valor.getText());
       new Conta().alterarSaldo(Operacao.INCREMENTAR, idContaDestino, valor.getText());
       Kernel.principal.acaoTransferencia();
       Janela.showTooltip(Status.SUCESSO, idioma.getMensagem("operacao_sucesso"), Duracao.CURTA);
       Animacao.fadeInOutClose(formulario);
     } else {
       Boolean contaOrigemMudou = !(Modelo.getIdContaOrigem().equals(idContaOrigem));
       if (contaOrigemMudou) {
         new Conta()
             .alterarSaldo(Operacao.INCREMENTAR, Modelo.getIdContaOrigem(), Modelo.getValor());
         new Conta().alterarSaldo(Operacao.DECREMENTAR, idContaOrigem, Modelo.getValor());
       }
       Modelo.setIdContaOrigem(contaOrigem.getValue());
       Boolean contaDestinoMudou = !(Modelo.getIdContaDestino().equals(idContaDestino));
       if (contaDestinoMudou) {
         new Conta()
             .alterarSaldo(Operacao.DECREMENTAR, Modelo.getIdContaDestino(), Modelo.getValor());
         new Conta().alterarSaldo(Operacao.INCREMENTAR, idContaDestino, Modelo.getValor());
       }
       Modelo.setIdContaDestino(contaDestino.getValue());
       Boolean valorMudou = !(Modelo.getValor().equals(valor.getText()));
       if (valorMudou) {
         BigDecimal valorDiferenca = new BigDecimal(Modelo.getValor());
         valorDiferenca = valorDiferenca.subtract(new BigDecimal(valor.getText()));
         new Conta()
             .alterarSaldo(
                 Operacao.INCREMENTAR, Modelo.getIdContaOrigem(), valorDiferenca.toString());
         new Conta()
             .alterarSaldo(
                 Operacao.DECREMENTAR, Modelo.getIdContaDestino(), valorDiferenca.toString());
       }
       Modelo.setValor(valor.getText());
       Modelo.setDescricao(descricao.getText());
       Modelo.setData(data.getValue());
       Modelo.alterar();
       Kernel.principal.acaoTransferencia();
       Janela.showTooltip(Status.SUCESSO, idioma.getMensagem("operacao_sucesso"), Duracao.CURTA);
       Animacao.fadeInOutClose(formulario);
     }
   }
 }