private void display() {
    initModality(Modality.APPLICATION_MODAL);

    setTitle("Student Review");
    setMinWidth(250);
    setMinHeight(300);

    signOutButton = new Button("SignOut");
    signOutButton.setOnAction(event -> signOutInDB());
    buttonHBox = new HBox(signOutButton);
    buttonHBox.setAlignment(Pos.CENTER_RIGHT);

    studentInfo = new RegistrationStudentInfoEntryBox();
    // Disabling all fields
    setValue(studentInfo.getEmplIdTextField(), String.valueOf(student.getEmplId()));
    setValue(studentInfo.getFirstNameTextField(), student.getFirstName());
    setValue(studentInfo.getLastNameTextField(), student.getLastName());
    studentInfo.getYearChoiceBox().setValue(student.getYear());
    studentInfo.getYearChoiceBox().setDisable(true);

    theTutor = new ChoiceBox<>();
    theTutor.getItems().addAll(Tutor.values());
    theTutorLabel = new Label("Tutor ");
    theTutorLayout = new HBox();
    theTutorLayout.getChildren().addAll(theTutorLabel, theTutor);

    is135 = new CheckBox("Discussed 135 Topics? ");
    is135.setOnAction(event -> handleListView());

    // Hidden until is135 is checked
    levelOfLearning = new ChoiceBox<>();
    levelOfLearning.getItems().addAll(1, 2, 3, 4);
    levelOfLearningLabel = new Label("Level Of Learning ");
    levelOfLearningLayout = new HBox();
    levelOfLearningLayout.getChildren().addAll(levelOfLearningLabel, levelOfLearning);
    levelOfLearningLayout.setVisible(false);
    levelOfLearningLayout.setManaged(false);

    // Hidden until is135 is checked
    topicsListView = new ListView<>();
    topicsListView.getItems().addAll(Topics135.values());
    topicsListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    topicsListView.setVisible(false);
    topicsListView.setManaged(false);

    vertical135Layout = new VBox(10);
    vertical135Layout.getChildren().addAll(is135, levelOfLearningLayout, topicsListView);

    mainVBox = new VBox(20);
    mainVBox.getChildren().addAll(studentInfo, theTutorLayout, vertical135Layout, buttonHBox);
    mainVBox.setMargin(vertical135Layout, new Insets(0, 20, 0, 20));
    mainVBox.setMargin(buttonHBox, new Insets(20));
    mainVBox.setAlignment(Pos.TOP_CENTER);

    scene = new Scene(mainVBox);
    setScene(scene);
    showAndWait();
  }
  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();
  }
Ejemplo n.º 3
0
  @Override
  public void start(Stage primaryStage) throws Exception {

    // UI fields
    VBox mainBox = new VBox();
    sequenceField = new TextField(myLabels.TEXTAREA_SEQUENCE);
    bracketField = new TextField(myLabels.TEXTAREA_BRACKET);
    HBox buttonBox = new HBox();
    Button computeButton = new Button(myLabels.BUTTON_COMPUTE);
    Button drawButton = new Button(myLabels.BUTTON_DRAW);
    CheckBox animateChecker = new CheckBox(myLabels.CHECKBOX_ANIMATE);
    drawPane = new Pane();

    buttonBox.getChildren().addAll(computeButton, drawButton, animateChecker);
    mainBox.getChildren().addAll(sequenceField, bracketField, buttonBox, drawPane);

    // Compute Button disable
    sequenceField
        .textProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue.length() == 0) {
                computeButton.setDisable(true);
              } else {
                computeButton.setDisable(false);
              }
            });

    // Animate Checkbox
    animateChecker.setOnAction(
        (value) -> {
          if (animateChecker.isSelected() != isAnimated) {
            isAnimated = animateChecker.isSelected();
            // set Eventhandler für Drag & Drop
            for (Circle currentCircle : circleList) {
              currentCircle.setOnMousePressed(isAnimated ? circleOnMousePressedEventHandler : null);
              currentCircle.setOnMouseDragged(isAnimated ? circleOnMouseDraggedEventHandler : null);
              currentCircle.setOnMouseReleased(
                  isAnimated ? circleOnMouseReleasedEventHandler : null);
            }
          }
        });

    // computeButton
    computeButton.setOnAction(
        (value) -> {
          bracketField.setText(new Nussinov(sequenceField.getText()).getBracketNotation());
        });

    // drawButton
    drawButton.setOnAction(
        (value) -> {
          Graph myGraph = new Graph();
          try {
            myGraph.parseNotation(bracketField.getText());
          } catch (IOException e) {
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle(myLabels.ALERT_TITLE);
            alert.setHeaderText(myLabels.ALTERT_MESSAGE);
            alert.setContentText(bracketField.getText());
            alert.showAndWait();
          }
          coordsRepresentation[0] =
              SpringEmbedder.computeSpringEmbedding(
                  iterations, myGraph.getNumberOfNodes(), myGraph.getEdges(), null);
          SpringEmbedder.centerCoordinates(coordsRepresentation[0], 50, 550, 50, 550);
          drawShapes(
              drawPane, coordsRepresentation[0], myGraph.getEdges(), myGraph.getNumberOfNodes());
        });

    // prepare scene
    Scene scene = new Scene(mainBox, 600, 800);

    primaryStage.setScene(scene);
    primaryStage.setTitle(myLabels.CAPTION);

    // show scene
    primaryStage.show();
  }
Ejemplo n.º 4
0
 public void setAnimationCheckboxHandler(EventHandler<ActionEvent> handler) {
   animateCheckbox.setOnAction(handler);
 }