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);
    }
  }
  @FXML
  private void onTempModificationButtonClicked(MouseEvent event) throws IOException {
    PreparedStatement statement;
    ResultSet result;
    Connection connection;

    String insertStatement =
        "UPDATE ATRACAO SET DESCRICAO = \'"
            + textArea2.getText()
            + "\', CLASSIFICACAOETARIA = "
            + textField3.getText()
            + ",DATA = TO_DATE(\'"
            + textField6.getText()
            + "\',\'MM/DD/YYYY\')"
            + "WHERE ATRACAO.IDATRACAO = "
            + textField1.getText();
    System.out.println(insertStatement);
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      connection =
          DriverManager.getConnection(
              "jdbc:oracle:thin:@grad.icmc.usp.br:15215:orcl", "7960690", "a");
      System.out.println(insertStatement);
      statement = connection.prepareStatement(insertStatement);
      statement.executeUpdate();

      statement.close();
      connection.close();
      atracoes.get(currentSelectedRow).setDescricao(textArea2.getText());
      atracoes.get(currentSelectedRow).setClassificacaoEtaria(textField3.getText());
      atracoes.get(currentSelectedRow).setData(textField6.getText());
    } catch (SQLException | ClassNotFoundException ex) {
      Logger.getLogger(IncludeTupleController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
예제 #3
0
  // wyœwietla wszystkie albumy
  private void drawAlbums() {
    for (int i = 0; i < albumList.size(); i++) {
      VBox vBox = new VBox(5);

      // ok³adka albumu
      Song tempSong = new Song(albumList.get(i).albumSongList.get(0));
      ImageView albumCover = new ImageView(tempSong.getAlbumCover());
      albumCover.setFitWidth(130);
      albumCover.setPreserveRatio(true);
      albumCover.setSmooth(true);
      albumCover.imageProperty().bind(tempSong.albumCoverProperty());

      // tytu³ albumu
      Text albumTitle = new Text(albumList.get(i).getAlbumTitle());
      albumTitle.getStyleClass().add("text");
      vBox.getChildren().addAll(albumCover, albumTitle);
      vBox.setAlignment(Pos.CENTER);

      // dodaje do ka¿dego albumu listener którym otwiera listê z piosenkami
      vBox.setOnMouseClicked(
          e -> {
            Text tempText = (Text) vBox.getChildren().get(1);
            for (int j = 0; j < albumList.size(); j++) {
              if (albumList.get(j).getAlbumTitle().equals(tempText.getText())) {
                showCurrentAlbum(albumList.get(j));
                break;
              }
            }
          });

      flowPane.getChildren().add(vBox);
    }
  }
예제 #4
0
  // wyœwietla wszystkie playlisty
  private void drawPlaylists() {
    for (int i = 0; i < playlistList.size(); i++) {
      VBox vBox = new VBox(5);

      ImageView playlistCover =
          new ImageView(new Image(new File("temp_cover.png").toURI().toString()));
      playlistCover.setFitWidth(130);
      playlistCover.setPreserveRatio(true);
      playlistCover.setSmooth(true);

      int ext = playlistList.get(i).getName().lastIndexOf('.');
      Text playlistTitle = new Text(playlistList.get(i).getName().substring(0, ext));
      playlistTitle.getStyleClass().add("text");
      vBox.getChildren().addAll(playlistCover, playlistTitle);
      vBox.setAlignment(Pos.CENTER);

      vBox.setOnMouseClicked(
          e -> {
            Text tempText = (Text) vBox.getChildren().get(1);
            showCurrentPlaylist(new File("Playlists/" + tempText.getText() + ".fpl"));
          });

      flowPane.getChildren().add(vBox);
    }
  }
  @FXML
  public void mapearDatos() {

    if (tablaResultados.getSelectionModel().getSelectedItem() != null) {
      txtfNombre.setText(
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getNombreAutor());
      txtfNombre.setDisable(false);
      nombre =
          listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getNombreAutor();
    }
  }
예제 #6
0
  void generateBackupPaths() {
    ObservableList restorePaths = FXCollections.observableArrayList();
    restorePaths.clear();
    vBarBDirs.getChildren().clear();
    //        cbRestoreDirectory.getItems().clear();
    String[] backupArr = constants.getValue("s_dumpDir").split(";");
    for (final String dir : backupArr) {
      restorePaths.add(dir);
      HBox hbox = new HBox();
      Label lbl = new Label(dir);
      Button btn = new Button("Delete");
      btn.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
              String nString = constants.getValue("s_dumpDir");
              nString = nString.replaceAll(";" + dir, "");
              nString = nString.replaceAll(dir, "");
              constants.addValue("s_dumpDir", nString);
              System.out.println(constants.getValue("s_dumpDir"));
              txtDir.setText(nString);
              generateBackupPaths();
            }
          });
      hbox.getChildren().add(lbl);
      hbox.getChildren().add(btn);
      vBarBDirs.getChildren().add(hbox);
    }

    try {

      cbRestoreDirectory.setItems(restorePaths);
      cbRestoreDirectory.setValue(restorePaths.get(0));
      generateRestore(restorePaths.get(0).toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
    cbRestoreDirectory
        .valueProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(ObservableValue ov, String t, String t1) {
                //                System.out.println(ov);
                //                System.out.println(t);
                //                System.out.println(t1);
                generateRestore(t1);
              }
            });
  }
  @Override
  protected ObservableList<Wordnet> call() throws Exception {

    // using executorService to ensure that database upload is a background
    // progress, so that all the parsing and comparing is done, while
    // database upload is probably still running. only supposed to run one
    // uploading process at a time, the
    // rest is in queue.
    ExecutorService executor =
        new ThreadPoolExecutor(
            1, 1, 10, TimeUnit.HOURS, new ArrayBlockingQueue<Runnable>(inList.size(), true));

    for (int i = 0; i < inList.size(); i++) {

      WordnetParser rspParser = chosenParser.getClass().newInstance();
      rspParser.setSourcePath(inList.get(i).getAbsolutePath());

      Wordnet wordnet = rspParser.callCall();
      // System.out.println(getProgress() + (1.0 / (double)
      // inList.size()) + " / " + "1" + "\n");
      // updateProgress(1/i, 1); //TODO reimplement progressbar
      // Platform.runLater(new Runnable() {
      //
      // @Override
      // public void run() {
      partialResults.get().add(wordnet);

      if (exportXml)
        Output.outToFileXmlFile(
            wordnet.getSynsetList(),
            wordnet.getLang(),
            "D:\\Programmierung\\git repo\\wdntxml\\out");

      if (outData) {
        // add database-upload-process to executorService
        executor.submit(
            new Runnable() {

              @Override
              public void run() {

                try {
                  Output.outToDB(
                      wordnet, dbUrl, dbUser, dbPassword, dbPort, sshUser, sshPassword, sshPort);
                  progress++;
                  updateProgress(((double) progress) / ((double) maxProgress), 1);

                } catch (ClassNotFoundException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            });
      }
    }
    return getPartialResults();
  }
  private void setupStageLocation(Stage stage) {
    ObservableList<Screen> screens = Screen.getScreens();
    Screen screen =
        screens.size() <= screenNumber ? Screen.getPrimary() : screens.get(screenNumber);

    Rectangle2D bounds = screen.getBounds();
    boolean primary =
        screen.equals(
            Screen.getPrimary()); // WORKAROUND: this doesn't work nice in combination with full
    // screen, so this hack is used to prevent going fullscreen when
    // screen is not primary

    if (primary) {
      stage.setX(bounds.getMinX());
      stage.setY(bounds.getMinY());
      stage.setWidth(bounds.getWidth());
      stage.setHeight(bounds.getHeight());
      stage.setFullScreen(true);
    } else {
      stage.setX(bounds.getMinX());
      stage.setY(bounds.getMinY());
      stage.setWidth(bounds.getWidth());
      stage.setHeight(bounds.getHeight());
      stage.toFront();
    }
  }
  public static boolean writeFile(ObservableList<XYChart.Data> list, String path)
      throws FileNotFoundException {
    try {
      boolean newFile = false;
      File file = new File(path);
      System.out.println(file.exists());
      newFile = file.createNewFile();
      System.out.println(newFile);
      System.out.println(file.exists());
      PrintWriter printWriter;
      try {
        printWriter = new PrintWriter(new FileOutputStream(file));

        for (int i = 0; i < list.size(); i++) {
          String x = list.get(i).getXValue().toString();
          String y = list.get(i).getYValue().toString();
          String line = x + "\t" + y;
          printWriter.println(line);
        }
        printWriter.close();
      } catch (Exception ex) {
        return false;
      }
    } catch (IOException ex) {
      return false;
    }

    return true;
  }
예제 #10
0
  // wczytywanie playlisty
  public static ObservableList<Song> loadPlaylist(File playlistFile) {
    ObservableList<Song> songList = FXCollections.observableArrayList();
    BufferedReader br = null;
    int id = 0;

    try {
      String line;
      // Otwieranie pliku
      br = new BufferedReader(new FileReader(playlistFile));

      // pêtla pobieraj¹ca wszystkie linie pliku
      while ((line = br.readLine()) != null) {
        songList.add(new Song(line));
        songList.get(id).setNr(++id);
      }
    } catch (IOException ioe) {
      System.out.println("ERROR");
    } finally {
      // zamykanie pliku
      if (br != null)
        try {
          br.close();
        } catch (IOException ioe2) {
          System.out.println("ERROR");
        }
    }
    return songList;
  }
예제 #11
0
  // Adding functionality to the forward button
  public String goForward() {
    final WebHistory history = browser.getEngine().getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();

    Platform.runLater(() -> history.go(1));
    if (currentIndex < entryList.size() - 2) {
      entryList.get(currentIndex + 1);
      forwardButton.setDisable(false);
    } else {
      entryList.get(history.getCurrentIndex());
      forwardButton.setDisable(true);
      backButton.setDisable(false);
    }
    return entryList.get(currentIndex).getUrl();
  }
  public void edicion() {

    ConfirmarUsuario verificar = new ConfirmarUsuario();
    validarCampo();

    if (comboListar.getSelectionModel().getSelectedIndex() == 0) {
      if (verificar.confirmarCurso(txtfNombre.getText())) {
        editar(
            1,
            listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
            txtfNombre.getText(),
            6);
        resetear();
      }
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 1) {
      if (verificar.confirmarCurso(txtfNombre.getText())) {
        editar(
            2,
            listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
            txtfNombre.getText(),
            7);
        resetear();
      }
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 2) {
      if (verificar.confirmarCurso(txtfNombre.getText())) {
        editar(
            3,
            listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
            txtfNombre.getText(),
            8);
        resetear();
      }
    }
    if (comboListar.getSelectionModel().getSelectedIndex() == 3) {
      if (verificar.confirmarCurso(txtfNombre.getText())) {
        editar(
            4,
            listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(),
            txtfNombre.getText(),
            5);
        resetear();
      }
    }
  }
예제 #13
0
 @Test
 public void testItemsRemovedAtAndBetween() {
   int[] indices = new int[] {1, 3, 5, 7};
   indicesList.addIndices(indices);
   report.clear();
   //        new PrintingListChangeListener("Items removed at 2/4", indicesList);
   items.removeAll(items.get(3), items.get(6));
   indices = new int[] {1, 4, 5};
   assertEquals(indices.length, indicesList.size());
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced but was" + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
 }
예제 #14
0
  @Override
  public Music getMusic(int nr) {
    if (nr < 0 || nr >= music.size()) {
      return null;
    }

    return music.get(nr);
  }
 private int getIndexOfComponentInParent(Node component) {
   Parent parent = component.getParent();
   if (parent == null) return -1;
   ObservableList<Node> components = parent.getChildrenUnmodifiable();
   for (int i = 0; i < components.size(); i++) {
     if (components.get(i) == component) return i;
   }
   return -1;
 }
예제 #16
0
  @Test
  public void getNext3() throws Exception {

    ObservableList<Appointment> appointments = AppointmentHelper.getNextAppointments(3);

    assertEquals(3, appointments.size());

    assertEquals(a0.getId(), appointments.get(0).getId());
  }
예제 #17
0
 /**
  * Método utilizado para testar o encontro de uma evidência pelas autoridades. Método de teste
  * apenas
  */
 public void testEvidenceInvestigation() {
   if (!evidences.isEmpty()) {
     if (successTest(opRisk, 0)) {
       Evidence evi = evidences.get(0);
       evi.getCause().getPlayer().setHeat(true, evi.getHeatInc());
       evidences.remove(evi);
     }
   }
 }
예제 #18
0
파일: PainelFx.java 프로젝트: sonis/novosga
 private void detectScreen() {
     Screen screen = Screen.getPrimary();
     ObservableList<Screen> screens = Screen.getScreens();
     Integer screenId = main.getConfig().get(PainelConfig.KEY_MONITOR_ID, Integer.class).getValue();
     if (screenId > 0 && screens.size() > screenId) {
         screen = screens.get(screenId);
     }
     display = new Display(screen);
 }
 public void deleteMarker(Waypoint point) {
   int listSize = waypointList.size();
   for (int index = 0; index < listSize; index++) {
     Waypoint current = waypointList.get(index);
     if (current.getPointNo() == point.getPointNo()) {
       waypointList.remove(index);
       break;
     }
   }
 }
  @FXML
  private void initialize() {
    ObservableList<String> kunden =
        FXCollections.observableArrayList(KundeSession.getAllKundenNamen());
    kunden.add(0, "Alle");
    kundenChoiceBox.setItems(kunden);
    kundenChoiceBox.setValue("Alle");

    String dm = now.getDayOfMonth() + "." + now.getMonthValue() + ".";
    day1Label.setText("1.1. - " + dm);
    day2Label.setText("1.1. - " + dm);

    List<Auftrag> auftraege = AuftragSession.getAllAuftraege();
    auftraege.sort(Comparator.comparing(Auftrag::getErstellung));
    LocalDate oldestAuftrag = auftraege.get(0).getErstellung();

    ObservableList<Number> years = FXCollections.observableArrayList();
    for (int i = now.getYear(); i >= oldestAuftrag.getYear(); i--) {
      years.add(i);
    }
    year1ChoiceBox.setItems(years);
    year1ChoiceBox.setValue(years.get(1));
    year2ChoiceBox.setItems(years);
    year2ChoiceBox.setValue(years.get(0));

    calculate();

    pNrColumn.setCellValueFactory(cellData -> cellData.getValue().produktNr);
    bezColumn.setCellValueFactory(cellData -> cellData.getValue().bezeichnung);
    bildColumn.setCellValueFactory(cellData -> cellData.getValue().bild);
    bildColumn.setCellFactory(imageCellFactory);
    s1Column.setCellValueFactory(cellData -> cellData.getValue().stuckzahl1);
    u1Column.setCellValueFactory(cellData -> cellData.getValue().umsatz1);
    s2Column.setCellValueFactory(cellData -> cellData.getValue().stuckzahl2);
    u2Column.setCellValueFactory(cellData -> cellData.getValue().umsatz2);
    pInfoTable.setItems(dataShow);

    kundenChoiceBox.valueProperty().addListener(observable -> calculate());
    year1ChoiceBox.valueProperty().addListener(observable -> calculate());
    year2ChoiceBox.valueProperty().addListener(observable -> calculate());
  }
예제 #21
0
 @Override
 public void acaoAlterar(int tabela) {
   if (tabela == 1) {
     itens = tabelaLista.getSelectionModel().getSelectedItems();
     if (Validar.alteracao(itens, cenaController.getBotaoAlterar())) {
       DespesaFormularioControlador Controlador = Janela.abrir(Despesa.FXML_FORMULARIO, TITULO);
       Controlador.alterar(itens.get(0));
     }
   } else if (tabela == 2) {
     cenaController.alterarConta(TITULO);
   }
 }
예제 #22
0
 /** Remove items in between selected. */
 @Test
 public void testItemsRemovedBetweenReally() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   items.removeAll(items.get(2), items.get(4));
   assertEquals(indices.length, indicesList.size());
   indices = new int[] {1, 2, 3};
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced but was" + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
   Change c = report.getLastChange();
   c.next();
   assertEquals(2, c.getAddedSize());
   assertEquals(c.getAddedSize(), c.getRemovedSize());
   //        report.prettyPrint();
 }
예제 #23
0
 @Test
 public void testItemsRemovedBeforeAndWithFirst() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   //        new PrintingListChangeListener("Items removed at 0/1", indicesList);
   items.removeAll(items.get(0), items.get(1));
   assertEquals(indices.length - 1, indicesList.size());
   Arrays.sort(indices);
   indices = Arrays.copyOfRange(indices, 1, 3);
   for (int i = 0; i < indices.length; i++) {
     indices[i] = indices[i] - 2;
   }
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced, but was " + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
 }
예제 #24
0
  @Override
  public Pane getVisSettings() {

    GridPane pane = new GridPane();
    pane.setPadding(new Insets(10, 0, 0, 0));
    pane.setHgap(5);
    pane.setVgap(5);

    // Dimension selection box
    ComboBox<String> dimCombo = new ComboBox<>();
    ObservableList<String> dimensions = FXCollections.observableArrayList();
    dimensions.add("X");
    dimensions.add("Y");
    dimensions.add("Z");
    dimCombo.setItems(dimensions);
    dimCombo.setValue(dimensions.get(2));
    dimCombo
        .valueProperty()
        .addListener(
            (ov, oldStr, newStr) -> {
              if (newStr.equals("X")) {
                renderer.setViewingDimension(0);
              } else if (newStr.equals("Y")) {
                renderer.setViewingDimension(1);
              } else {
                renderer.setViewingDimension(2);
              }
              renderer.render();
              Controller.getInstance().updateHistogram();
            });

    Label dimLabel = new Label();
    dimLabel.setText("Projection dimension: ");
    dimLabel.setLabelFor(dimCombo);

    pane.add(dimLabel, 0, 0);
    pane.add(dimCombo, 1, 0);

    // Scale checkbox
    CheckBox scaleBox = new CheckBox("Scale: ");
    scaleBox.setSelected(true);
    scaleBox
        .selectedProperty()
        .addListener(
            (ov, old_val, new_val) -> {
              renderer.setScaling(new_val);
              renderer.render();
            });
    pane.add(scaleBox, 0, 1);

    return pane;
  }
예제 #25
0
  // adding event handler for newToDoListTextField and addTodoListButton in the function
  // event handlers will help the user to add new Task to the program
  private void setAddTaskButtonAndFieldHandler() {

    // add new task to the program if newTaskTextField has focus and enter is pressed
    // new task added has the same name as the newTaskTextField's Text property
    newTaskTextField.addEventHandler(
        KEY_PRESSED,
        event -> {
          if (event.getCode().equals(KeyCode.ENTER)) {

            if (!newTaskTextField.getText().isEmpty()) {

              incompleteTaskListView.getSelectionModel().clearSelection();
              int selectedToDoListIndex = todoListView.getSelectionModel().getSelectedIndex();
              toDoListModel
                  .get(selectedToDoListIndex)
                  .getIncompleteTaskList()
                  .add(0, new Task(newTaskTextField.getText()));
              incompleteTaskListView.getSelectionModel().select(0);
              newTaskTextField.clear();
            }
          }
        });

    // if addTaskButton clicked, add the ew event to the program
    addTaskButton.setOnAction(
        event -> {
          if (!newTaskTextField.getText().isEmpty()) {

            incompleteTaskListView.getSelectionModel().clearSelection();
            int selectedToDoListIndex = todoListView.getSelectionModel().getSelectedIndex();
            toDoListModel
                .get(selectedToDoListIndex)
                .getIncompleteTaskList()
                .add(0, new Task(newTaskTextField.getText()));
            incompleteTaskListView.getSelectionModel().select(0);
            newTaskTextField.clear();
          }
        });
  }
예제 #26
0
  private void onListChanged() {
    Log.traceCall();
    list.clear();
    list.addAll(
        tradeManager
            .getTrades()
            .stream()
            .map(PendingTradesListItem::new)
            .collect(Collectors.toList()));

    // we sort by date, earliest first
    list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));

    // TODO improve selectedItem handling
    // selectedItem does not get set to null if we dont have the view visible
    // So if the item gets removed form the list, and a new item is added we need to check if the
    // old
    // selectedItem is in the new list, if not we know it is an invalid one
    if (list.size() == 1) onSelectTrade(list.get(0));
    else if (list.size() > 1 && (selectedItem == null || !list.contains(selectedItem)))
      onSelectTrade(list.get(0));
    else if (list.size() == 0) onSelectTrade(null);
  }
예제 #27
0
 /**
  * Incorrect test assumption: updates to the items don't change the indices, no event to fire from
  * the indices. They are immutable, anyway.
  *
  * <p>The assumption had some meaning as long as IndexMappedList didn't get the real change from
  * the backing list - now it doesn't and can fire on its own as needed.
  *
  * @see IndexMappedListTest#testItemsUpdate()
  */
 @Test
 @Ignore
 public void testItemsUpdate() {
   ObservableList<Person> base = Person.persons();
   ObservableList<Person> persons =
       FXCollections.observableList(base, p -> new Observable[] {p.firstNameProperty()});
   IndicesBase<Person> indicesList = new IndicesList<>(persons);
   int[] indices = new int[] {1, 3, 5};
   indicesList.addIndices(indices);
   ListChangeReport report = new ListChangeReport(indicesList);
   //        new PrintingListChangeListener("Set item at 3", indicesList);
   persons.get(3).setFirstName("newName");
   assertEquals(1, report.getEventCount());
 }
예제 #28
0
  // adding setOnMouseClicked event handler for incompleteTaskListView and completeTaskListView so
  // that a task can be marked as
  // complete or incomplete
  // if a task in the incompleteTaskListView is double clicked, it will be marked as completed and
  // moved to completeTaskListView and vice versa
  private void setTaskCompleteOrIncomplete() {

    incompleteTaskListView.setOnMouseClicked(
        event -> {
          if (event.getClickCount() >= 2) {

            int selectedToDoList_Index = todoListView.getSelectionModel().getSelectedIndex();
            int selectedTaskEvent_Index =
                incompleteTaskListView.getSelectionModel().getSelectedIndex();

            if (selectedToDoList_Index >= 0 && selectedTaskEvent_Index >= 0) {

              Task selectedTask =
                  toDoListModel
                      .get(selectedToDoList_Index)
                      .getIncompleteTaskList()
                      .get(selectedTaskEvent_Index);
              toDoListModel
                  .get(selectedToDoList_Index)
                  .getIncompleteTaskList()
                  .remove(selectedTaskEvent_Index);

              selectedTask.setComplete(true);
              toDoListModel.get(selectedToDoList_Index).getCompleteTaskList().add(0, selectedTask);
            }
          }
        });

    completeTaskListView.setOnMouseClicked(
        event -> {
          if (event.getClickCount() >= 2) {

            int selectedToDoList_Index = todoListView.getSelectionModel().getSelectedIndex();
            int selectedTaskEvent_Index =
                completeTaskListView.getSelectionModel().getSelectedIndex();

            if (selectedToDoList_Index >= 0 && selectedTaskEvent_Index >= 0) {

              Task selectedTask =
                  toDoListModel
                      .get(selectedToDoList_Index)
                      .getCompleteTaskList()
                      .get(selectedTaskEvent_Index);
              toDoListModel
                  .get(selectedToDoList_Index)
                  .getCompleteTaskList()
                  .remove(selectedTaskEvent_Index);

              selectedTask.setComplete(false);
              toDoListModel
                  .get(selectedToDoList_Index)
                  .getIncompleteTaskList()
                  .add(0, selectedTask);
            }
          }
        });
  }
예제 #29
0
  public static DefaultBoxAndWhiskerCategoryDataset getDatasetForBoxAndWhiskers(
      ObservableList<EvaluationHelper> allEvaluationHelper, ArrayList<Bereich> bereiche) {

    int categoryCount = bereiche.size();
    int entityCount = allEvaluationHelper.size();

    final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

    for (int j = 0; j < categoryCount; j++) {
      final List<Double> list = new ArrayList<Double>();
      for (int k = 0; k < entityCount; k++) {

        int valCount = 0;
        double avValue = 0;

        for (Item item : allEvaluationHelper.get(k).getItems()) {
          if (bereiche.get(j).equals(item.getBereich())) {
            if (!allEvaluationHelper.get(k).getItemWertung().get(valCount).isEmpty()) {
              avValue +=
                  Double.parseDouble(allEvaluationHelper.get(k).getItemWertung().get(valCount));
            }
            valCount++;
          }
        }
        if (valCount != 0) {
          avValue /= valCount;
        }

        list.add(new Double(avValue));
      }
      dataset.add(
          list,
          SeCatResourceBundle.getInstance().getString("scene.chart.all.averagevalues"),
          bereiche.get(j).getName());
    }
    return dataset;
  }
예제 #30
0
  public static DefaultCategoryDataset createDatasetForEvaluationItemCompare(
      List<Fragebogen> fragebogenList) {
    DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
    ObservableList<EvaluationHelper> ehListinit =
        EvaluationHelper.createEvaluationHelperList(fragebogenList.get(0).getBewertungen(), null);
    List<Item> items = ehListinit.get(0).getItems();

    for (Fragebogen f : fragebogenList) {
      ObservableList<EvaluationHelper> ehList =
          EvaluationHelper.createEvaluationHelperList(f.getBewertungen(), null);

      for (Item item : items) {
        double ret = 0;
        int i = 0;
        if (ehList.get(0).getItems().contains(item)) {
          for (EvaluationHelper eh : ehList) {

            String s = eh.getItemWertung().get(eh.getItems().indexOf(item));
            if (s.isEmpty()) {
              ret += 0;
            } else {
              ret += Double.parseDouble(eh.getItemWertung().get(eh.getItems().indexOf(item)));
              i++;
            }
          }
        }
        if (i > 0) {
          ret /= i;
        }

        defaultcategorydataset.addValue(ret, f.getPerspektive().getName(), item.getName());
      }
    }

    return defaultcategorydataset;
  }