/**
   * Sets up the remove button, which is used to remove filters from the table view and the graph.
   *
   * @param tableView The table view needed to get the currently selected filter.
   * @return The fully configured remove button.
   */
  private Button setRemoveButton(TableView tableView) {
    final Button removeButton = new ImageButton("remove.png");
    removeButton.setOnAction(
        actionEvent -> {
          final FilterInput filterInput =
              (FilterInput) tableView.getSelectionModel().getSelectedItem();
          if (!data.isEmpty() && filterInput != null) {

            // Update model
            final IUserCommand updateGraphFilterCommand =
                interactionMap.get(FilterInteraction.REMOVE);

            if (updateGraphFilterCommand != null) {

              filterInput.setDeleted();
              updateGraphFilterCommand.setSelection(filterInput);
              notifyListeners(updateGraphFilterCommand);
              logger.debug(
                  "Removed FilterInput: "
                      + filterInput.getName()
                      + " from table view and database.");
            } else {
              logger.warn("no remove command mapped");
            }
          }
        });
    removeButton.setScaleX(0.5);
    removeButton.setScaleY(0.5);
    return removeButton;
  }
 /**
  * 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);
     }
   }
 }
示例#3
0
 @FXML
 private void deleteList(ActionEvent event) {
   if (mp != null) {
     mp.dispose();
   }
   if (!fileList.isEmpty() || !listName.isEmpty()) {
     fileList.clear();
     listName.clear();
     listView.setItems(listName);
   }
 }
  @Override
  public ObservableList<PlayerAchievement> getPlayerAchievements(String username) {
    if (userService.getUsername().equals(username)) {
      if (readOnlyPlayerAchievements.isEmpty()) {
        updatePlayerAchievementsFromServer();
      }
      return readOnlyPlayerAchievements;
    }

    int playerId = playerService.getPlayerForUsername(username).getId();
    return FXCollections.observableList(fafApiAccessor.getPlayerAchievements(playerId));
  }
 @FXML
 private void handleRoomSelect() {
   if (!chatrooms.isEmpty()
       && chatRoomList.getSelectionModel().getSelectedItem().toString() != null) {
     roomName.setText(
         "Chatroom: " + chatRoomList.getSelectionModel().getSelectedItem().toString());
     connectionManager.joinRoom(
         model.getClientUser().getUsername(),
         chatRoomList.getSelectionModel().getSelectedItem().toString());
     roomsPane.setExpanded(false);
     usersPane.setExpanded(true);
   }
 }
 /**
  * Set up the edit button. This button is used to edit existing filters.
  *
  * @param tableView The table view needed to get the currently selected filter.
  * @return The fully configured edit button.
  */
 private Button setEditButton(TableView tableView) {
   final Button editButton = new ImageButton("edit.png");
   editButton.setOnAction(
       actionEvent -> {
         final FilterInput filterInput =
             (FilterInput) tableView.getSelectionModel().getSelectedItem();
         if (!data.isEmpty() && filterInput != null) {
           filterEditingMenu.showMenu(filterInput);
         }
       });
   editButton.setScaleX(0.45);
   editButton.setScaleY(0.45);
   return editButton;
 }
  /**
   * Load up the systematic reviews from the database.
   *
   * @return
   * @throws NamingException
   * @throws ClassNotFoundException
   * @throws SQLException
   */
  @Bean
  protected ObservableList<SystematicReview> reviews()
      throws NamingException, ClassNotFoundException, SQLException {
    String sql = "select t from SystematicReview t";
    Query q = MainController.EM.createQuery(sql);
    List<SystematicReview> list = q.getResultList();

    System.out.println("# systematic reviews: " + list.size());

    ObservableList<SystematicReview> reviews = FXCollections.observableArrayList(list);

    if (!reviews.isEmpty()) {
      Collections.sort(reviews);
    }

    return reviews;
  }
示例#8
0
 private void optimize(Node node) {
   ObservableList<Transform> transforms = node.getTransforms();
   Iterator<Transform> iterator = transforms.iterator();
   boolean prevIsStatic = false;
   while (iterator.hasNext()) {
     Transform transform = iterator.next();
     trTotal++;
     if (transform.isIdentity()) {
       if (timeline == null || !bound.contains(transform)) {
         iterator.remove();
         trRemoved++;
       }
     } else {
       if (timeline == null || !bound.contains(transform)) {
         if (prevIsStatic) {
           trCandidate++;
         }
         prevIsStatic = true;
       } else {
         prevIsStatic = false;
       }
     }
   }
   if (node instanceof Parent) {
     groupsTotal++;
     Parent p = (Parent) node;
     for (Node n : p.getChildrenUnmodifiable()) {
       optimize(n);
     }
     if (transforms.isEmpty()) {
       Parent parent = p.getParent();
       if (parent instanceof Group) {
         trEmpty++;
         //                    System.out.println("Empty group = " + node.getId());
         emptyParents.add(p);
       } else {
         //                    System.err.println("parent is not group = " + parent);
       }
     }
   }
   if (node instanceof MeshView) {
     meshViews.add((MeshView) node);
   }
 }
示例#9
0
  private void saveHistory() throws IOException {
    if (history.isEmpty()) {
      Files.deleteIfExists(streamPath);
      return;
    }

    try (OutputStream outStream =
        Files.newOutputStream(
            streamPath,
            StandardOpenOption.CREATE,
            StandardOpenOption.WRITE,
            StandardOpenOption.TRUNCATE_EXISTING)) {
      try (ObjectOutputStream historyStream = new ObjectOutputStream(outStream)) {
        for (HistoryEntry h : history) {
          historyStream.writeObject(h);
        }
      }
    }
  }
  private void deleteSelectedEntrys() {
    ObservableList<PolizistDaten> Nutzerauswahl = Tabelle.getSelectionModel().getSelectedItems();
    if (Nutzerauswahl.isEmpty()) {
      IM.setErrorText("Es muss mindestens ein Eintrag ausgewählt sein");
      return;
    }

    Nutzerauswahl.forEach(
        PolizistDaten -> {
          try {
            DH.getAnfrageObjekt()
                .executeUpdate(
                    "DELETE FROM POLIZIST WHERE PersonenID = " + PolizistDaten.getPersonenID());
          } catch (SQLException e) {
            IM.setErrorText("Löschen fehlgeschlagen", e);
          }
        });
    refreshPolizistAnsicht();
  }
示例#11
0
 private CustomerController() {
   menuItems = ManagerController.getInstance().getMenuItems();
   orderItems = FXCollections.observableArrayList();
   orderItems.addListener(
       (ListChangeListener) change -> checkoutTab.setDisable(orderItems.isEmpty()));
 }