コード例 #1
1
  @Test
  public void observableList() throws Exception {
    ObservableList<String> source = FXCollections.observableArrayList();
    source.addAll("alpha", "beta");
    ObservableList<String> dest = ObservableMirrors.mirrorList(source, gate);
    Queue<ListChangeListener.Change<? extends String>> changes = new LinkedList<>();
    dest.addListener(changes::add);

    // Expect a single change with two added items.
    source.addAll("gamma", "delta");
    assertEquals(1, gate.getTaskQueueSize());
    gate.waitAndRun();
    ListChangeListener.Change<? extends String> change = changes.poll();
    change.next();
    assertTrue(change.wasAdded());
    assertEquals(2, change.getAddedSize());
    assertEquals(ImmutableList.of("gamma", "delta"), change.getAddedSubList());

    // Expect four queued changes with coherent/correct deltas unaffected by later changes to the
    // src list.
    source.remove(3); // remove delta
    source.add("phi");
    source.remove(3); // remove phi
    source.add("epsilon");
    assertEquals(4, gate.getTaskQueueSize());
    gate.waitAndRun();
    gate.waitAndRun();
    change = changes.poll();
    change.next();
    assertTrue(change.wasRemoved());
    assertEquals(1, change.getRemovedSize());
    assertEquals("delta", change.getRemoved().get(0));
    change = changes.poll();
    change.next();
    assertTrue(change.wasAdded());
    assertEquals("phi", change.getAddedSubList().get(0));
    gate.waitAndRun();
    changes.poll();
    gate.waitAndRun();
    changes.poll();

    // Expect a set on the source list to show up as a replace event on the dest list.
    source.set(0, "zero");
    gate.waitAndRun();
    change = changes.poll();
    change.next();
    assertTrue(change.toString(), change.wasReplaced());
    assertEquals(0, change.getFrom());
    assertEquals(1, change.getTo());
    assertEquals("zero", change.getAddedSubList().get(0));
  }
コード例 #2
0
ファイル: Project.java プロジェクト: DanielRough/Jeeves
 public void removeElement(Element elem) {
   if (elem instanceof UserVariable) {
     variables.remove((UserVariable) elem);
   } else if (elem instanceof Trigger) {
     triggers.remove((Trigger) elem);
   } else if (elem instanceof Expression) {
     expressions.remove((Expression) elem);
   } else if (elem instanceof UIElement) {
     uielements.remove((UIElement) elem);
   }
 }
コード例 #3
0
  private void refreshFromList(final Collection<SubscriptionTopicSummaryProperties> list) {
    final Set<String> currentTopics = new HashSet<String>();
    currentTopics.addAll(pieChartDataMapping.keySet());

    synchronized (pieChartData) {
      for (final SubscriptionTopicSummaryProperties newValue : list) {
        final String topic = newValue.topicProperty().getValue();
        final Data lastValue = pieChartDataMapping.get(topic);

        if (lastValue == null) {
          final PieChart.Data data = new PieChart.Data(topic, newValue.countProperty().getValue());
          pieChartDataMapping.put(topic, data);
          pieChartData.add(data);
        } else {
          lastValue.setPieValue(newValue.countProperty().getValue());
        }

        // Mark as processed
        currentTopics.remove(topic);
      }

      // Remove objects not on the list
      for (final String topic : currentTopics) {
        pieChartData.remove(pieChartDataMapping.get(topic));
      }
    }
  }
  public void btnRemoveAssistantOrProfessor_Pressed() {
    if (!listAssistantsOrProfessors.getSelectionModel().isEmpty()) {
      ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems();

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

      for (Professor professor : Manager.INSTANCE.professors) {
        if (rut.equals(professor.getRut())) {
          if (((Lecture) Manager.INSTANCE.currentEditignICourse)
              .getProfessors()
              .contains(professor)) {
            ((Lecture) Manager.INSTANCE.currentEditignICourse).removeProfessor(professor);
            updatedElements.remove(valueSelected);
            listAssistantsOrProfessors.setItems(updatedElements);
            break;
          } else {
            ViewUtilities.showAlert("El profesor no se encuentra registrado en la clase");
            break;
          }
        }
      }
    } else {
      ViewUtilities.showAlert("Primero debes seleccionar un profesor para quitar");
    }
  }
コード例 #5
0
 @Test
 public void testItemsRemoveRange() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   // items we expect to appear in removed
   List removedItems = new ArrayList();
   removedItems.add(3);
   removedItems.add(5);
   report.clear();
   // remove items at 3...5, inclusive
   items.remove(3, 6);
   assertEquals(1, indicesList.size());
   //        report.prettyPrint();
   indices = new int[] {1};
   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(),
       wasSingleRemoved(report.getLastChange()));
   Change c = report.getLastChange();
   c.next();
   assertEquals(2, c.getRemovedSize());
   assertEquals(removedItems, c.getRemoved());
 }
コード例 #6
0
 @FXML
 protected void handleRemoveFromCart(ActionEvent event) {
   MenuItem selectedItem = orderList.getSelectionModel().getSelectedItem();
   if (null != selectedItem) {
     orderItems.remove(selectedItem);
   }
 }
コード例 #7
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);
     }
   }
 }
コード例 #8
0
 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;
     }
   }
 }
コード例 #9
0
 /**
  * Since extraction of IndicesBase Changed behaviour of sourceChange: valid only from before
  * endChange to after endChange!
  */
 @Test
 @Ignore
 public void testChangeOnRemoveItems() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   ListChangeReport itemsReport = new ListChangeReport(items);
   //        new PrintingListChangeListener("Items removed before", indicesList);
   items.remove(0);
   assertEquals(itemsReport.getLastChange(), indicesList.getSourceChange());
 }
コード例 #10
0
 @Test
 public void testChangeNullOnDirectAddAfterItemsModified() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   ListChangeReport itemsReport = new ListChangeReport(items);
   //        new PrintingListChangeListener("Items removed before", indicesList);
   items.remove(0);
   indicesList.addIndices(6);
   assertEquals(null, indicesList.getSourceChange());
 }
コード例 #11
0
ファイル: InventoryView.java プロジェクト: rwcarlsen/cyclist2
  private void addAgent(String type, String name) {
    AgentInfo info = new AgentInfo(type, name);
    AgentEntry entry = new AgentEntry(info);
    _agentListPanel.getContent().getChildren().add(entry);
    entry.setOnClose(
        item -> {
          _agents.remove(item.info);
          _agentListPanel.getContent().getChildren().remove(item);
          _chart.remove(item.info);
        });

    addAgent(info);
  }
コード例 #12
0
  /**
   * @param event event of button
   * @throws GroupNotValidException not valid
   * @throws IDNotValidException not valid
   * @throws StringNotValidException not valid
   */
  public final void onBtnGroupClick(final ActionEvent event)
      throws GroupNotValidException, IDNotValidException, StringNotValidException {

    try {
      Object item = disabled.getSelectionModel().getSelectedItem();
      Button button = (Button) event.getSource();

      // add a group
      if (button.getText().equals("<<")) {

        if (item.toString().equals("Arbeit")) {
          INACTIVEDATA.remove(item);
          ACTIVEDATA.add(item);
          c.addToGroup(Main.getWorkGroup());
        }
        if (item.toString().equals("Familie")) {
          INACTIVEDATA.remove(item);
          ACTIVEDATA.add(item);
          c.addToGroup(Main.getFamilyGroup());
        }
        if (item.toString().equals("Freunde")) {
          INACTIVEDATA.remove(item);
          ACTIVEDATA.add(item);
          c.addToGroup(Main.getFriendsGroup());
        }
      }

      // remove a group
      item = enabled.getSelectionModel().getSelectedItem();
      if (button.getText().equals(">>")) {

        if (item.toString().equals("Arbeit")) {
          ACTIVEDATA.remove(item);
          INACTIVEDATA.add(item);
          c.removeFromGroup(Main.getWorkGroup());
        }
        if (item.toString().equals("Familie")) {
          ACTIVEDATA.remove(item);
          INACTIVEDATA.add(item);
          c.removeFromGroup(Main.getFamilyGroup());
        }
        if (item.toString().equals("Freunde")) {
          ACTIVEDATA.remove(item);
          INACTIVEDATA.add(item);
          c.removeFromGroup(Main.getFriendsGroup());
        }
      }

    } catch (Exception e) {

      Alert alert = new Alert(AlertType.ERROR);
      alert.setTitle("Keine gültige Gruppe erkannt.");
      alert.setHeaderText("");
      alert.setContentText("Es wurde keine gültige Gruppe erkannt. Klicke auf gültige Gruppe.");
      alert.showAndWait();

      logger.log(Level.SEVERE, "Error: " + e.getMessage());
    }
  }
コード例 #13
0
 /**
  * Initializes the ImageView ArrayList.
  *
  * @param i An ArrayList of ImageView references intended to be displayed as an instrument line.
  */
 public ButtonLine(HBox instLine, ImageView selected, ImageLoader im, Staff st) {
   il = im;
   for (Node i : instLine.getChildren()) buttons.add((ImageView) i);
   selectedInst = selected;
   theStaff = st;
   setupButtons();
   DEFAULT_NOTE = Note.A3.getKeyNum();
   /*
    * For some reason, the piranha and coin are flipped in all soundfonts.
    * The solution here is unfortunately to just flip the images.
    */
   ObservableList<Node> n = instLine.getChildren();
   Node nd = n.remove(15);
   n.add(16, nd);
 }
コード例 #14
0
 @Test
 public void testItemsRemovedBefore() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   items.remove(0);
   for (int i = 0; i < indices.length; i++) {
     indices[i] = indices[i] - 1;
   }
   Arrays.sort(indices);
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
 }
コード例 #15
0
  @Test
  public void testItemsSetAllSmallerSize() {
    int[] indices = new int[] {3, 5, 1};
    indicesList.addIndices(indices);
    report.clear();

    ObservableList<String> other = createObservableList(true);
    other.remove(1);
    items.setAll(other);

    assertEquals("all cleared", 0, indicesList.size());
    assertEquals(1, report.getEventCount());
    assertTrue(
        "expected single removed, but was " + report.getLastChange(),
        wasSingleRemoved(report.getLastChange()));
  }
コード例 #16
0
 /**
  * The main driving force here is to experiment with AnchoredSelectionModel we'll live with the
  * regression here, since it will be solved correctly in core.
  */
 @Test
 public void testRT15793() {
   ListView<String> view = createEmptyView();
   int notified = 0;
   //        view.itemsProperty().addListener(o -> {LOG.info("notified");});
   //        view.itemsProperty().addListener((o, old, value) -> {LOG.info("notified");});
   ObservableList<String> emptyList = FXCollections.observableArrayList();
   // listView is instantiated with an empty list, so following assumption
   // is incorrect
   //        assertEquals(null, view.getItems());
   view.setItems(emptyList);
   emptyList.add("something");
   view.getSelectionModel().select(0);
   assertEquals(0, view.getSelectionModel().getSelectedIndex());
   emptyList.remove(0);
   assertEquals(-1, view.getSelectionModel().getSelectedIndex());
 }
コード例 #17
0
  /** Mètode que canvia la llista que es mostra per pantalla */
  public void setData(String city, int units) {
    data.remove(1, data.size());
    File inputFile = new File(city + units + ".xml");
    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(inputFile);
      // És important normalitzar
      doc.getDocumentElement().normalize();

      NodeList nl = doc.getElementsByTagName("time");
      temp = new Temps();
      TempUnitari tempU = null;
      for (int i = 0; i < nl.getLength(); i++) {
        tempU = new TempUnitari();
        Element temps = (Element) nl.item(i);
        String[] horari = temps.getAttribute("day").split("-");
        String diaVista = horari[2] + "/" + horari[1];
        String descripcio =
            temps.getFirstChild().getAttributes().getNamedItem("name").getTextContent();
        String icon =
            temps.getFirstChild().getAttributes().getNamedItem("var").getTextContent() + "#";
        Element temperatura = (Element) temps.getChildNodes().item(4);
        String tempMin = temperatura.getAttribute("min");
        String tempMax = temperatura.getAttribute("max");
        Element humitat = (Element) temps.getChildNodes().item(6);
        String humidity = humitat.getAttribute("value");
        Element presio = (Element) temps.getChildNodes().item(5);
        String pressure = presio.getAttribute("value");
        tempU.setTempsMin(Double.parseDouble(tempMin));
        tempU.setTempsMax(Double.parseDouble(tempMax));
        tempU.setHumidity(Integer.parseInt(humidity));
        tempU.setPressure(Double.parseDouble(pressure));
        temp.add(tempU);
        // afegir el String al observableList per a que el mostri el listView
        data.add(icon + diaVista + "\t-\t" + descripcio + "\t-\t" + tempMin + "/" + tempMax);
      }
    } catch (ParserConfigurationException e) {
      e.printStackTrace();
    } catch (SAXException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #18
0
 @FXML
 public void eliminarRegistro() {
   int indice = lstViewComputadoras.getSelectionModel().getSelectedIndex();
   if (indice < 0) {
     Alert mensaje = new Alert(AlertType.ERROR);
     mensaje.setContentText("Necesita seleccionar un elemento para eliminar");
     mensaje.setHeaderText("Error al eliminar");
     mensaje.setTitle("Error");
     mensaje.show();
   } else {
     Alert mensaje = new Alert(AlertType.CONFIRMATION);
     mensaje.setTitle("Eliminar registro");
     mensaje.setContentText("¿Desea eliminar este registro?");
     mensaje.setHeaderText("Eliminar");
     Optional<ButtonType> opcion = mensaje.showAndWait();
     if (opcion.get() == ButtonType.OK) {
       listaComputadoras.remove(indice);
       limpiarComponentes();
     }
   }
 }
コード例 #19
0
  @Test
  public void testItemsRemovedAtFirst() {
    int[] indices = new int[] {3, 5, 1};
    indicesList.addIndices(indices);
    report.clear();

    items.remove(1);
    assertEquals(indices.length - 1, indicesList.size());
    Arrays.sort(indices);
    indices = Arrays.copyOfRange(indices, 1, 3);
    // note: since here, the indices are "shortend" at start!
    for (int i = 0; i < indices.length; i++) {
      indices[i] = indices[i] - 1;
    }
    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()));
  }
コード例 #20
0
 @FXML
 protected void removeMemberFromCurrentButton(ActionEvent E) {
   currentMembers.remove(currentMembersList.getSelectionModel().getSelectedItem());
 }
コード例 #21
0
 /** Sanity: single remove at index removes indexed */
 @Test
 public void testItemRemovedAt() {
   indicesList.setIndices(3);
   items.remove(3);
   assertEquals(0, indicesList.size());
 }
コード例 #22
0
///////////////////////////////////////////////////////////////////////////////
コード例 #23
0
  public ObservableList<PathElement> pathChanger(
      ObservableList<PathElement> elements, double angle) {
    MoveTo moveTo = (MoveTo) elements.get(0);
    LineTo lineToSecond = (LineTo) elements.get(1);
    LineTo lineToThird = (LineTo) elements.get(2);
    LineTo lineToFourth = (LineTo) elements.get(3);
    LineTo lineToFifth = (LineTo) elements.get(4);
    LineTo lineToSixth = (LineTo) elements.get(5);
    LineTo lineToSeventh = (LineTo) elements.get(6);
    LineTo lineToEighth = (LineTo) elements.get(7);

    double x = moveTo.getX();
    double y = moveTo.getY();
    double[] res = rotationCoordinates(new double[] {x, y}, angle);

    moveTo.setX(res[0]);
    moveTo.setY(res[1]);

    x = lineToSecond.getX();
    y = lineToSecond.getY();

    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSecond.setX(res[0]);
    lineToSecond.setY(res[1]);

    x = lineToThird.getX();
    y = lineToThird.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToThird.setX(res[0]);
    lineToThird.setY(res[1]);

    x = lineToFourth.getX();
    y = lineToFourth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToFourth.setX(res[0]);
    lineToFourth.setY(res[1]);

    x = lineToFifth.getX();
    y = lineToFifth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToFifth.setX(res[0]);
    lineToFifth.setY(res[1]);

    x = lineToSixth.getX();
    y = lineToSixth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSixth.setX(res[0]);
    lineToSixth.setY(res[1]);

    x = lineToSeventh.getX();
    y = lineToSeventh.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToSeventh.setX(res[0]);
    lineToSeventh.setY(res[1]);

    x = lineToEighth.getX();
    y = lineToEighth.getY();
    res = rotationCoordinates(new double[] {x, y}, angle);

    lineToEighth.setX(res[0]);
    lineToEighth.setY(res[1]);

    elements.remove(0, 8);
    elements.add(0, moveTo);
    elements.add(1, lineToSecond);
    elements.add(2, lineToThird);
    elements.add(3, lineToFourth);
    elements.add(4, lineToFifth);
    elements.add(5, lineToSixth);
    elements.add(6, lineToSeventh);
    elements.add(7, lineToEighth);
    return elements;
  }
コード例 #24
0
 @Override
 public void deleteSelectedObject() {
   if (currentPerson != null) {
     personList.remove(currentPerson);
   }
 }
コード例 #25
0
  /** @return Top-level {@link Node} */
  public Node create() {
    // Layout:
    //
    // | table |  [Add]
    // | table |  [Remove]
    // | table |
    // | table |

    // Create table with editable columns for type Double (supported as Number)
    final TableColumn<Point, Number> x_col = new TableColumn<>(Messages.PointsTable_X);
    x_col.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Point, Number>, ObservableValue<Number>>() {
          @Override
          public ObservableValue<Number> call(CellDataFeatures<Point, Number> param) {
            return new SimpleDoubleProperty(param.getValue().getX());
          }
        });
    x_col.setCellFactory(
        TextFieldTableCell.<Point, Number>forTableColumn(new NumberStringConverter()));
    x_col.setOnEditCommit(
        event -> {
          final int row = event.getTablePosition().getRow();
          points.setX(row, event.getNewValue().doubleValue());
        });

    final TableColumn<Point, Number> y_col = new TableColumn<>(Messages.PointsTable_Y);
    y_col.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Point, Number>, ObservableValue<Number>>() {
          @Override
          public ObservableValue<Number> call(CellDataFeatures<Point, Number> param) {
            return new SimpleDoubleProperty(param.getValue().getY());
          }
        });
    y_col.setCellFactory(
        TextFieldTableCell.<Point, Number>forTableColumn(new NumberStringConverter()));
    y_col.setOnEditCommit(
        event -> {
          final int row = event.getTablePosition().getRow();
          points.setY(row, event.getNewValue().doubleValue());
        });

    final ObservableList<Point> data = new PointsAdapter(points);
    final TableView<Point> table = new TableView<>(data);
    table.getColumns().add(x_col);
    table.getColumns().add(y_col);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    table.setPlaceholder(new Label(Messages.PointsTable_Empty));
    table.setEditable(true);

    // Buttons
    final Button add = new Button(Messages.Add, JFXUtil.getIcon("add.png"));
    add.setMaxWidth(Double.MAX_VALUE);
    add.setOnAction(event -> data.add(new Point(0, 0)));

    final Button remove = new Button(Messages.Remove, JFXUtil.getIcon("delete.png"));
    remove.setMaxWidth(Double.MAX_VALUE);
    remove.setOnAction(
        event -> {
          final int sel = table.getSelectionModel().getSelectedIndex();
          if (sel >= 0) data.remove(sel);
        });

    final VBox buttons = new VBox(10, add, remove);
    final HBox content = new HBox(10, table, buttons);
    HBox.setHgrow(table, Priority.ALWAYS);
    return content;
  }
コード例 #26
0
 public void removeContact() {
   Contact contact = (Contact) list.getSelectionModel().getSelectedItem();
   contacts.remove(contact);
 }
コード例 #27
0
 public void removeOrderItem(MenuItem orderItem) {
   orderItems.remove(orderItem);
 }
コード例 #28
0
ファイル: SearchView.java プロジェクト: JJHarrison/seng302
  @Override
  public void initialize(URL url, ResourceBundle resourceBundle) {
    viewModel.queryProperty().bind(searchTextField.textProperty());
    searchResultsListView.setItems(viewModel.getResults());

    searchTextField.setOnKeyPressed(
        event -> {
          if (event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN) {
            searchResultsListView.requestFocus();
            searchResultsListView.fireEvent(event);
          } else if (event.getCode() == KeyCode.ESCAPE) {
            event.consume();
            viewModel.closeSearch();
          } else if (event.getCode() == KeyCode.ENTER) {
            if (viewModel.queryProperty().get().equals("times new roman")) {
              ObservableList<String> classes =
                  MainController.getPrimaryStage().getScene().getRoot().getStyleClass();
              if (classes.contains("gag")) {
                classes.remove("gag");
              } else {
                classes.add("gag");
              }
            }
            event.consume();
            viewModel.buttonAction(searchResultsListView.getSelectionModel().getSelectedItem());
          }
        });

    searchTextField.setOnKeyReleased(
        event -> {
          viewModel.getSearchCommand().execute();
          searchResultsListView.getSelectionModel().selectFirst();
        });

    searchResultsListView.setOnKeyPressed(
        event -> {
          if (event.getCode() == KeyCode.ESCAPE) {
            event.consume();
            viewModel.closeSearch();
          } else if (event.getCode() == KeyCode.ENTER || event.getCode() == KeyCode.SPACE) {
            event.consume();
            viewModel.buttonAction(searchResultsListView.getSelectionModel().getSelectedItem());
          } else if (!(event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN)) {
            searchTextField.requestFocus();
            searchTextField.positionCaret(searchTextField.getLength());
            searchTextField.fireEvent(event);
          }
        });

    searchResultsListView.setCellFactory(
        param ->
            new ListCell<SearchResult>() {
              @Override
              protected void updateItem(SearchResult item, boolean empty) {
                setPadding(new Insets(0));
                super.updateItem(item, empty);
                if (!empty) {
                  setGraphic(viewModel.generateSearchResultRow(item));
                } else {
                  setGraphic(null);
                  setText("");
                }
              }
            });

    searchResultsListView
        .visibleProperty()
        .bind(Bindings.size(viewModel.getResults()).greaterThan(0));
    searchResultsListView
        .managedProperty()
        .bind(Bindings.size(viewModel.getResults()).greaterThan(0));

    viewModel
        .getResults()
        .addListener(
            (ListChangeListener<? super SearchResult>)
                c -> {
                  if (viewModel.getResults().size() > 0) {
                    searchResultsListView.setPrefHeight(
                        Integer.min(MAX_RESULTS_BEFORE_SCROLLBAR, viewModel.getResults().size())
                                * 30
                            + 10);
                    searchResultsListView
                        .getScene()
                        .getWindow()
                        .setHeight(
                            Integer.min(MAX_RESULTS_BEFORE_SCROLLBAR, viewModel.getResults().size())
                                    * 30
                                + 63);
                  } else {
                    searchResultsListView.getScene().getWindow().setHeight(61);
                  }
                });
  }
コード例 #29
0
 public void remove(Edition edition) {
   editionData.remove(edition);
 }
コード例 #30
0
 @FXML
 protected void handleRemoveFormationButton(ActionEvent E) {
   allFormations.remove(formationList.getSelectionModel().getSelectedItem());
 }