@FXML
 public void handleSaveButtonAction() {
   model.saveSettings(
       (settings) -> {
         if (!goldField.getText().isEmpty()) {
           settings.setGoldThreshold(Integer.parseInt(goldField.getText()));
         }
         if (!elixirField.getText().isEmpty()) {
           settings.setElixirThreshold(Integer.parseInt(elixirField.getText()));
         }
         if (!deField.getText().isEmpty()) {
           settings.setDarkElixirThreshold(Integer.parseInt(deField.getText()));
         }
         if (!maxThField.getText().isEmpty()) {
           settings.setMaxThThreshold(Integer.parseInt(maxThField.getText()));
         }
         settings.setDetectEmptyCollectors(detectEmptyCollectorsCheckBox.isSelected());
         settings.setMatchAllConditions(isMatchAllConditionsCheckBox.isSelected());
         settings.setCollectResources(collectResourcesCheckBox.isSelected());
         settings.setTrainMaxTroops(toInt(trainTroopsSlider.getValue()));
         settings.setLogLevel(logLevelComboBox.getValue());
         settings.setAttackStrategy(autoAttackComboBox.getValue());
         settings.getRaxInfo()[0] = rax1ComboBox.getValue();
         settings.getRaxInfo()[1] = rax2ComboBox.getValue();
         settings.getRaxInfo()[2] = rax3ComboBox.getValue();
         settings.getRaxInfo()[3] = rax4ComboBox.getValue();
         settings.getRaxInfo()[4] = rax5ComboBox.getValue();
         settings.getRaxInfo()[5] = rax6ComboBox.getValue();
         settings.setExtraFunctions(extraFuncCheckBox.isSelected());
       });
   showSettings(false);
 }
  @FXML
  public void flipCoin() {
    coin = new Coin();
    coin.flipCoin();
    String flipResult = coin.getFlipResult();
    String firstPlayer = "";
    hboxUserMessages.setVisible(true);
    hboxCoinFlip.setVisible(false);
    if (flipResult == "Heads") {
      if (chkHeads.isSelected()) {
        computerFirst = false;
        firstPlayer = "You go first";
      } else {
        computerFirst = true;
        firstPlayer = "I go first";
      }
    } else if (flipResult == "Tails") {
      if (chkTails.isSelected()) {
        computerFirst = false;
        firstPlayer = "You go first";
      } else {
        computerFirst = true;
        firstPlayer = "I go first";
      }
    }

    lblMessages.setText("It was: " + flipResult + "\n" + firstPlayer);

    // computerFirst=false;
    // Update display with winner
    setSpotStatus(false);
    if (computerFirst) {
      computerMove(true);
    }
  }
Exemple #3
0
  private void checkBoxMouseClicked(MouseEvent event, int index) {
    CheckBox cb = checkBoxArray[index];
    int y = (int) cb.getLayoutY() + radius;
    if (cb.isSelected() && index < 5) {

      // Reader selected
      Ball b = new Ball(minX, maxX, minCsX, maxCsX, y, balColor1, "reader");
      ballArray[index] = b;
      Thread t = new Thread(new BallRunnable(b, readWrite));
      threadArray[index] = t;
      circleArray[index].setVisible(true);
      t.start();

    } else if (cb.isSelected() && index >= 5) {
      // Writer selected
      Ball b = new Ball(minX, maxX, minCsX, maxCsX, y, balColor2, "writer");
      ballArray[index] = b;
      Thread t = new Thread(new BallRunnable(b, readWrite));
      threadArray[index] = t;
      circleArray[index].setVisible(true);
      t.start();

    } else {

      threadArray[index].interrupt();
      threadArray[index] = null;
      ballArray[index] = null;
      circleArray[index].setVisible(false);
      circleArray[index].setCenterX(minX);
    }
  }
  @FXML
  private void handleRefresh() {
    final Preferences preferences = getPreferences();

    preferences.putBoolean(RECURSIVE, subAccountCheckBox.isSelected());
    preferences.putBoolean(VERBOSE, longNameCheckBox.isSelected());

    if (refreshCallBackProperty().get() != null) {
      refreshCallBackProperty().get().run();
    }
  }
 private void updateGroupSumView(int groupId) {
   // if remain mode is not selected, view of group sum is never changed
   if (remainMode.isSelected()) {
     Group group = board.getGroup(groupId);
     boardView.updateGroupSum(group, true);
   }
 }
  public void sendRequest(String username, String password) {

    thisStage = (Stage) logInButton.getScene().getWindow();
    Response res =
        new Request("user/login").set("username", username).set("password", password).send();

    if (res.getSuccess()) {
      Main.setSessionID((String) res.get("sessionID"));
      System.out.println("Login successful.");
      Main.userNotLoggedIn.setValue(false);

      // Save the login option if checked
      if (keepMeLoggedInCheckBox.isSelected()) {
        pc.setProp("username", usernameTextField.getText());
        pc.setProp("password", passwordPasswordField.getText());
        pc.setProp("signInCheckbox", "true");
        pc.saveProps();
      }

      HomeController.userName = usernameTextField.getText();
      thisStage.close();
    } else {
      // incorrect password
    }
  }
  private void createNewStage(int level, Stage owner, boolean onTop) {
    Stage stage = new Stage();
    stage.initOwner(owner);
    stage.setTitle(level == 0 ? "Root" : "Child " + level);
    stage.setAlwaysOnTop(onTop);

    VBox root = new VBox(15);
    root.setPadding(new Insets(20));
    Scene scene = new Scene(root);
    stage.setScene(scene);

    ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP);
    onTopButton.setSelected(onTop);

    stage
        .alwaysOnTopProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              onTopButton.setSelected(newValue);
              onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP);
            });

    onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop()));

    CheckBox box = new CheckBox("Child stage always on top");
    box.setSelected(true);
    Button newStageButton = new Button("Open child stage");

    newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected()));

    root.getChildren().addAll(onTopButton, box, newStageButton);

    stage.show();
  }
  public OptionalEditor(PropertySheet.Item parameter) {

    if (!(parameter instanceof OptionalParameter)) throw new IllegalArgumentException();

    optionalParameter = (OptionalParameter<?>) parameter;
    embeddedParameter = optionalParameter.getEmbeddedParameter();

    // The checkbox
    checkBox = new CheckBox();

    setLeft(checkBox);

    // Add embedded editor
    try {
      Class<? extends PropertyEditor<?>> embeddedEditorClass =
          embeddedParameter.getPropertyEditorClass().get();
      embeddedEditor =
          embeddedEditorClass
              .getDeclaredConstructor(PropertySheet.Item.class)
              .newInstance(embeddedParameter);
      Node embeddedNode = embeddedEditor.getEditor();
      Boolean value = optionalParameter.getValue();
      if (value == null) value = false;
      embeddedNode.setDisable(!value);
      checkBox.setOnAction(
          e -> {
            embeddedNode.setDisable(!checkBox.isSelected());
          });

      setCenter(embeddedNode);
    } catch (Exception e) {
      throw (new IllegalStateException(e));
    }
  }
 @FXML
 private void setDigiBoost() {
   boolean boost8580Enabled = boosted8580.isSelected();
   util.getConfig().getEmulationSection().setDigiBoosted8580(boost8580Enabled);
   util.getPlayer()
       .getC64()
       .configureSIDs((num, sid) -> sid.input(boost8580Enabled ? sid.getInputDigiBoost() : 0));
 }
  private void setFont() {
    FontWeight weight;
    if (bold.isSelected()) {
      weight = FontWeight.BOLD;
    } else {
      weight = FontWeight.NORMAL;
    }

    FontPosture posture;
    if (italic.isSelected()) {
      posture = FontPosture.ITALIC;
    } else {
      posture = FontPosture.REGULAR;
    }

    newText.setFont(Font.font(fontChoice.getValue(), weight, posture, sizeChoice.getValue()));
  }
  @Override
  public void duringSave(Void model) {
    List<EntityExportSource<? extends AbstractPersistentObject>> entityExportSources =
        PersistentWork.read(
            em -> {
              @SuppressWarnings("unchecked")
              List<Class<? extends AbstractPersistentObject>> entityClasses =
                  em.getEntityManagerFactory()
                      .getMetamodel()
                      .getEntities()
                      .stream()
                      .map(e -> (Class<? extends AbstractPersistentObject>) e.getJavaType())
                      .collect(Collectors.toList());
              List<EntityExportSource<? extends AbstractPersistentObject>> exportSources =
                  entityClasses
                      .stream()
                      .map(c -> new EntityExportSource<>(PersistentWork.idsFrom(c), c))
                      .collect(Collectors.toList());
              return exportSources;
            });

    XlsxExporter exporter = new XlsxExporter(controller.getExecutorService());

    File file = exportFile.get();
    try {
      if (file.exists()) {
        log.info("Deleting existing file {}", file);
        file.delete();
      }
      Files.createDirectories(file.toPath());
      file.createNewFile();
    } catch (IOException e) {
      log.error("Could not create file {}", file, e);
    }
    List<EntityExportSource<?>> bla = entityExportSources;
    exporter.export(file, bla);

    controller
        .getJavaFXExecutor()
        .submit(
            () -> {
              Dialogs.create()
                  .message(Localized.get("export.successfully", file))
                  .showInformation();
              if (openAfterExport.isSelected()) {
                controller
                    .getExecutorService()
                    .submit(
                        () -> {
                          try {
                            desktop.edit(file);
                          } catch (IOException e) {
                            log.error("Could not open {}", file, e);
                          }
                        });
              }
            });
  }
  private void updateEntireView() {

    // upadte board view entirely
    boardView.update(board, remainMode.isSelected());

    // redraw combination view
    Group group = board.getGroup(board.getCurrentCell().getGroupId());
    combinationView.update(group);
  }
 private SearchMatcher getSearchMatcher() {
   if (defaultSearch.isSelected()) {
     return new SimplePayloadMatcher(searchField.getText(), caseSensitiveCheckBox.isSelected());
   } else if (inlineScriptSearch.isSelected()) {
     return new InlineScriptMatcher(scriptManager, searchField.getText());
   } else {
     final Script script = ((Script) searchMethod.getSelectedToggle().getUserData());
     return new ScriptMatcher(scriptManager, script);
   }
 }
 @Override
 public void onChanged(
     final ListChangeListener.Change<? extends SubscriptionTopicSummaryProperties> c) {
   logger.info("New data available");
   if (autoRefreshCheckBox.isSelected()) {
     synchronized (pieChartData) {
       logger.info("New data available");
       refreshFromList(observableList);
     }
   }
 }
  public void setFddObjectModel(FddObjectModel fddObjectModel) {
    logger.entry();
    if (fddObjectModel != null) {
      fddObjectModel
          .getInteractionClasses()
          .values()
          .stream()
          .forEach(
              (value) -> {
                interactions.add(new InteractionState(value));
              });
      InteractionTableView.setItems(interactions);
      interactions.forEach(
          (interaction) -> {
            interaction
                .onProperty()
                .addListener(
                    (observable, oldValue, newValue) -> {
                      if (!newValue) {
                        cb.setSelected(false);
                      } else if (interactions.stream().allMatch(a -> a.isOn())) {
                        cb.setSelected(true);
                      }
                    });
          });
      InteractionTableColumn.setCellValueFactory(new PropertyValueFactory<>("interactionName"));
      CheckTableColumn.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<InteractionState, Boolean>, ObservableValue<Boolean>>() {
            @Override
            public ObservableValue<Boolean> call(
                TableColumn.CellDataFeatures<InteractionState, Boolean> param) {
              return param.getValue().onProperty();
            }
          });

      CheckTableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(CheckTableColumn));
      cb.setUserData(CheckTableColumn);
      cb.setOnAction(
          (ActionEvent event) -> {
            CheckBox cb1 = (CheckBox) event.getSource();
            TableColumn tc = (TableColumn) cb1.getUserData();
            InteractionTableView.getItems()
                .stream()
                .forEach(
                    (item) -> {
                      item.setOn(cb1.isSelected());
                    });
          });
      CheckTableColumn.setGraphic(cb);
    }
    logger.exit();
  }
  @FXML
  private void search() {
    clearMessages();

    processMessages(store.getMessages());

    updateTabTitle();
    messagePaneController.setSearchOptions(
        new SearchOptions(searchField.getText(), caseSensitiveCheckBox.isSelected()));

    eventManager.navigateToFirst(foundMessageStore);
  }
  @FXML
  public void InsertUser() throws SQLException {

    int selectedOption =
        JOptionPane.showConfirmDialog(
            null, "هل انت متاكد من هذة العملية  ؟", "Choose", JOptionPane.YES_NO_OPTION);
    if (selectedOption == JOptionPane.YES_OPTION) {
      boolean value1 = CB1.isSelected();
      boolean value2 = CB2.isSelected();

      DB.rs =
          DB.statemen.executeQuery(
              "SELECT * FROM users WHERE user_name ='" + User_name.getText() + "'");
      if (User_name.getText().equals("")) {
        Erromassage.setText("من فضلك ادخل البياناتالمطلوبة");
        User_name.requestFocus();
      } else if (DB.rs.next()) {
        Erromassage.setText("هذا الاسم موجود مسبقا");
        User_name.requestFocus();
      } else {

        DB.statemen.executeUpdate(
            "INSERT INTO users( user_name, pass, note, permission1, permission2) VALUES ('"
                + User_name.getText()
                + "','"
                + pass.getText()
                + "','"
                + note.getText()
                + "','"
                + value1
                + "','"
                + value2
                + "')");

        FillTable();
        clear();
      }
    }
  }
  @FXML
  public void saveLinkAction(ActionEvent event) throws Exception {
    Map<String, Page> pageMap = Pages.getMap();

    String[] list = Pages.getSiteList();

    if (ch1.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[0]));
    }
    if (ch2.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[1]));
    }
    if (ch3.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[2]));
    }
    if (ch4.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[3]));
    }
    if (ch5.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[4]));
    }
    if (ch6.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[5]));
    }
    if (ch7.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[6]));
    }
    if (ch8.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[7]));
    }
    if (ch9.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[8]));
    }
    if (ch10.isSelected()) {
      Pages.addPage(_pageName, pageMap.get(list[9]));
    }

    returnToAddLink(event);
  }
  @Override
  public void start(Stage primaryStage) throws Exception {
    Button button = new Button("Open Root stage with child");
    CheckBox box = new CheckBox("Root is always on top");
    box.setSelected(true);
    VBox root = new VBox(15, box, button);
    root.setPadding(new Insets(20));
    Scene scene = new Scene(root);

    button.setOnAction(event -> createNewStage(0, null, box.isSelected()));

    primaryStage.setScene(scene);
    primaryStage.show();
  }
 @FXML
 private void perfromTransfer() {
   BigDecimal transferAmount = new BigDecimal(0);
   String dealer = "";
   try {
     String amount = amountTextField.getText();
     transferAmount = new BigDecimal(amount);
     dealer = recipientTextField.getText();
     if (amount.equals("")) throw new IllegalArgumentException("Must supply a transfer amount");
     if (!InputConstraints.validateMsisdn(dealer))
       throw new IllegalArgumentException("Dealer Id not in correct msisdn format");
     boolean sendSms = sendSmsBox.isSelected();
     FundTransferRequest fundTransferRequest = new FundTransferRequest();
     fundTransferRequest.setAmount(Integer.parseInt(amount));
     fundTransferRequest.setRecipientMsisdn(dealer);
     fundTransferRequest.setSendSms(sendSms);
     FundTransferResponse transferResponse =
         mainApp.getSmartloadInterface().performFundsTransfer(fundTransferRequest);
     SubmissionStatus submissionStatus =
         DataAccess.loadSubmissionStatus(transferResponse.getResponseCode().name());
     String status =
         transferResponse.getError() == null
             ? transferResponse.getResponseCode().name()
             : transferResponse.getError().getMessage();
     saveTransaction(submissionStatus, status, transferAmount, dealer);
     if (transferResponse.getResponseCode().equals(ResponseCode.SUCCESS)) {
       NumberFormat currency = NumberFormat.getCurrencyInstance();
       String message =
           "Successful Transfer of  "
               + currency.format(transferAmount)
               + " New balance "
               + currency.format(transferResponse.getCurrentDealerBalance());
       log.info(message + " new Dealer balance " + transferResponse.getNewDealerBalance());
       DialogFactory.createDialogInformation(DESCRIPTION, "Transfer successful", message);
       recipientTextField.setText("");
       amountTextField.setText("");
     } else {
       DialogFactory.createDialogError(
           "Transfer error",
           "Error performing transfer",
           transferResponse.getError().getMessage());
     }
     mainApp.refresh();
   } catch (Exception e) {
     DialogFactory.createDialogException("Transfer error", "Error performing transfer", e);
     SubmissionStatus submissionStatus =
         DataAccess.loadSubmissionStatus(ResponseCode.SYS_ERROR.name());
     saveTransaction(submissionStatus, e.getMessage(), transferAmount, dealer);
   }
 }
Exemple #21
0
  public void marker() {

    List<String> kompetence = new ArrayList<>();
    ObservableList<Node> boxes = analyse.getChildren();
    for (Node n : boxes) {
      CheckBox c = (CheckBox) n;
      if (c.isSelected()) {
        kompetence.add(c.getText());
      }
    }

    boxes = afdeling.getChildren();
    for (Node n : boxes) {
      CheckBox c = (CheckBox) n;
      if (c.isSelected()) {
        kompetence.add(c.getText());
      }
    }

    boxes = design.getChildren();
    for (Node n : boxes) {
      CheckBox c = (CheckBox) n;
      if (c.isSelected()) {
        kompetence.add(c.getText());
      }
    }
    boxes = programering.getChildren();
    for (Node n : boxes) {
      CheckBox c = (CheckBox) n;
      if (c.isSelected()) {
        kompetence.add(c.getText());
      }
    }

    ObservableList<Medarbejder> updateretList = dbs.refresh(kompetence);
    putInTable(updateretList);
  }
 private void handleListView() {
   if (is135.isSelected()) {
     topicsListView.setVisible(true);
     topicsListView.setManaged(true);
     levelOfLearningLayout.setVisible(true);
     levelOfLearningLayout.setManaged(true);
     setHeight(600);
   } else {
     topicsListView.setVisible(false);
     topicsListView.setManaged(false);
     levelOfLearningLayout.setVisible(false);
     levelOfLearningLayout.setManaged(false);
     setHeight(400);
   }
 }
        @Override
        public void handle(ActionEvent event) {
          if (event.getSource() instanceof CheckBox) {
            for (Entry<String, CheckBox> entry : propertiesCb.entrySet()) {
              CheckBox cb = entry.getValue();
              String propertyName = entry.getKey();

              if (cb.isSelected()) {
                propertiesTf.get(propertyName).setDisable(false);
              } else {
                propertiesTf.get(propertyName).setDisable(true);
              }
            }
          }
        }
  /** Called when the user clicks ok. */
  @FXML
  private void handleOk() {
    if (isInputValid()) {
      order.setTime(timeOrderField.getText());
      order.setEmployee(employeeOrderField.getText());
      order.setClient(clientOrderField.getText());
      order.setPrice(priceOrderField.getText());
      order.setPaid(paidOrderCheckBox.isSelected());

      DBHelper.update(order);

      okClicked = true;
      dialogStage.close();
    }
  }
  @FXML
  public void UpdataUser() throws SQLException {
    int selectedOption =
        JOptionPane.showConfirmDialog(
            null, "هل انت متاكد من هذة العملية  ؟", "Choose", JOptionPane.YES_NO_OPTION);
    if (selectedOption == JOptionPane.YES_OPTION) {
      TuserPermission InsertData =
          (TuserPermission) tableUser.getSelectionModel().getSelectedItem();
      boolean value1 = CB1.isSelected();
      boolean value2 = CB2.isSelected();

      Erromassage.setText("");
      System.out.println(selected);
      if (User_name.getText().equals("")) {
        Erromassage.setText("من فضلك ادخل البياناتالمطلوبة");
        User_name.requestFocus();
      } else {
        DB.statemen.executeUpdate(
            "UPDATE users SET user_name='"
                + User_name.getText()
                + "',pass='******',note='"
                + note.getText()
                + "',permission1='"
                + value1
                + "',permission2='"
                + value2
                + "'  WHERE id = "
                + selected
                + "");
        FillTable();
        clear();
      }
    }
  }
  public void onMessageAdded(final FormattedMqttMessage message) {
    // TODO: is that ever deregistered?
    if (autoRefreshCheckBox.isSelected()) {
      final boolean matchingSearch = processMessage(message, getSearchMatcher());
      if (matchingSearch) {
        if (messageNavigationPaneController.showLatest()) {
          eventManager.navigateToFirst(foundMessageStore);
        } else {
          eventManager.incrementMessageIndex(foundMessageStore);
        }
      }

      updateTabTitle();
    }
  }
  @FXML
  void saveSettings() {
    //        AUTOUPLOAD
    if (chckboxautoUpload.isSelected()) {
      ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
      nvp.add(new BasicNameValuePair("value", "1"));
      tblsettings.save(nvp, "1");
      constants.addValue("s_autoupload", "1");
      Main.timer = new Timer();
      Main.timer.schedule(new Uploader(), 0, 15000);
    } else {
      ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
      nvp.add(new BasicNameValuePair("value", "0"));
      tblsettings.save(nvp, "1");
      constants.addValue("s_autoupload", "0");
      try {
        Main.timer.cancel();
      } catch (Exception e) {

      }
    }

    //        NRALCODE
    constants.addValue("s_nralcode", txtnralcode.getText());
    ArrayList<NameValuePair> nvp2 = new ArrayList<NameValuePair>();
    nvp2.add(new BasicNameValuePair("value", txtnralcode.getText()));
    tblsettings.save(nvp2, "2");

    //     ARCHIVE DIR
    constants.addValue("s_dumpDir", txtDir.getText());
    ArrayList<NameValuePair> nvp3 = new ArrayList<NameValuePair>();
    nvp2.add(new BasicNameValuePair("value", txtDir.getText()));
    tblsettings.save(nvp2, "3");

    //     ARCHIVE INTERVAL
    constants.addValue("s_backupInterval", txtinterval.getText());
    ArrayList<NameValuePair> nvp4 = new ArrayList<NameValuePair>();
    nvp2.add(new BasicNameValuePair("value", txtinterval.getText()));
    tblsettings.save(nvp2, "4");

    //     ARCHIVE COUNT
    constants.addValue("s_archiveCount", txtfiles.getText());
    ArrayList<NameValuePair> nvp5 = new ArrayList<NameValuePair>();
    nvp2.add(new BasicNameValuePair("value", txtfiles.getText()));
    tblsettings.save(nvp2, "5");

    closeSettings();
  }
  public void updateComponents() {
    Context context = getMainApplication().getContext();
    errorBox.setVisible(false);

    if (smallPCB.isSelected()) context.setPcbSize(PCBSize.Small);
    else if (largePCB.isSelected()) context.setPcbSize(PCBSize.Large);
    ApplicationValues applicationValues = SettingsFactory.getApplicationValues();
    applicationValues.getPcbSize().setValue(context.getPcbSize());
    applicationValues.save();

    continueButton.setDisable(
        radioButtonsBox.isVisible() && !smallPCB.isSelected() && !largePCB.isSelected());
    if (context.getPcbSize() != null && !checkSelectedPcbSize()) {
      errorBox.setVisible(true);
      continueButton.setDisable(!ignoreErrorCheckbox.isSelected());
    }
  }
  private void checkAllFieldsHandled() {
    if (theTutor.getValue() == null) {
      PopUp.display("Error", "Please select a tutor");
      throw new IllegalArgumentException("Tutor was not selected");
    } else if (is135.isSelected()) {
      if (levelOfLearning.getValue() == null) {
        PopUp.display("Error", "Please select a level of learning for the student");
        throw new IllegalArgumentException("Level of Learning was not selected");
      }

      if (topicsListView.getSelectionModel().getSelectedItems().size() == 0) {
        PopUp.display(
            "Error",
            "Select at least one topic of discussion\n\n"
                + "If you are unsure, please select \'Other\'");
        throw new IllegalArgumentException("No class topic was selected");
      }
    }
  }
  /** Testet den Zustand der Steuerelemente nach Öffnen des Dialogs. */
  @Test
  public final void testInitialState() {
    final TextField hoursTextField = (TextField) scene.lookup("#hoursTextField");

    // Alarm vorgeben
    controller.setAlarm(
        new Alarm(DateTimeUtil.getLocalDateTimeForString("24.12.2014 12:00:00"), "Test"));
    FXTestUtils.awaitEvents();

    // sicherstellen, dass Formularfelder korrekt gefüllt sind
    assertTrue(alarmEnabledCheckbox.isSelected());
    assertEquals(DateTimeUtil.getLocalDateForString("24.12.2014"), alarmDatePicker.getValue());
    assertEquals(DateTimeUtil.getLocalTimeForString("12:00:00"), alarmTimePicker.getValue());
    assertEquals("12", hoursTextField.getText());
    assertEquals("Test", alarmDescriptionTextField.getText());

    assertEquals("kein Klingelton gewählt", alarmSelectSoundButton.getText());
    assertTrue(alarmNoSoundButton.isDisabled());
    assertTrue(alarmPlaySoundButton.isDisabled());
  }