示例#1
0
  /*
   * This is called when we think that the data within this TableCell may have
   * changed. You'll note that this is a private function - it is only called
   * when one of the triggers above call it.
   */
  private void updateItem() {
    if (currentObservableValue != null) {
      currentObservableValue.removeListener(weaktableRowUpdateObserver);
    }

    // get the total number of items in the data model
    final TableView tableView = getTableView();
    final List<T> items =
        tableView == null ? FXCollections.<T>emptyObservableList() : tableView.getItems();
    final TableColumn tableColumn = getTableColumn();
    final int itemCount = items == null ? -1 : items.size();
    final int index = getIndex();
    final boolean isEmpty = isEmpty();
    final T oldValue = getItem();

    final boolean indexExceedsItemCount = index >= itemCount;

    // there is a whole heap of reasons why we should just punt...
    if (indexExceedsItemCount
        || index < 0
        || columnIndex < 0
        || !isVisible()
        || tableColumn == null
        || !tableColumn.isVisible()) {

      // RT-30484 We need to allow a first run to be special-cased to allow
      // for the updateItem method to be called at least once to allow for
      // the correct visual state to be set up. In particular, in RT-30484
      // refer to Ensemble8PopUpTree.png - in this case the arrows are being
      // shown as the new cells are instantiated with the arrows in the
      // children list, and are only hidden in updateItem.
      // RT-32621: There are circumstances where we need to updateItem,
      // even when the index is greater than the itemCount. For example,
      // RT-32621 identifies issues where a TreeTableView collapses a
      // TreeItem but the custom cells remain visible. This is now
      // resolved with the check for indexExceedsItemCount.
      if ((!isEmpty && oldValue != null) || isFirstRun || indexExceedsItemCount) {
        updateItem(null, true);
        isFirstRun = false;
      }
      return;
    } else {
      currentObservableValue = tableColumn.getCellObservableValue(index);
      final T newValue = currentObservableValue == null ? null : currentObservableValue.getValue();

      // There used to be conditional code here to prevent updateItem from
      // being called when the value didn't change, but that led us to
      // issues such as RT-33108, where the value didn't change but the item
      // we needed to be listening to did. Without calling updateItem we
      // were breaking things, so once again the conditionals are gone.
      updateItem(newValue, false);
    }

    if (currentObservableValue == null) {
      return;
    }

    // add property change listeners to this item
    currentObservableValue.addListener(weaktableRowUpdateObserver);
  }
  /** Clear all items in SnapShot plugin. */
  public void clearAllItems() {
    currentTarget.set(FXCollections.emptyObservableList());
    summaryData.set(null);
    currentClassNameSet.set(FXCollections.emptyObservableSet());
    currentObjectTag.set(-1);

    summaryController.clearAllItems();
    histogramController.clearAllItems();
    snapshotController.clearAllItems();
  }
 private void clearTabGezin() {
   // todo opgave 3
   cbGezinnen.getSelectionModel().clearSelection();
   tfGezinNr.clear();
   tfOuder1.clear();
   tfOuder2.clear();
   tfHuwelijk.clear();
   tfScheiding.clear();
   lvKinderen.setItems(FXCollections.emptyObservableList());
 }
 private void clearTabPersoon() {
   cbPersonen.getSelectionModel().clearSelection();
   tfPersoonNr.clear();
   tfVoornamen.clear();
   tfTussenvoegsel.clear();
   tfAchternaam.clear();
   tfGeslacht.clear();
   tfGebDatum.clear();
   tfGebPlaats.clear();
   cbOuderlijkGezin.getSelectionModel().clearSelection();
   lvAlsOuderBetrokkenBij.setItems(FXCollections.emptyObservableList());
 }
  /** Initializes the controller class. */
  @Override
  public void initialize(URL url, ResourceBundle rb) {
    super.initialize(url, rb);

    summaryData = new SimpleObjectProperty<>();
    summaryController.summaryDataProperty().bind(summaryData);
    currentTarget = new SimpleObjectProperty<>(FXCollections.emptyObservableList());
    summaryController.currentTargetProperty().bind(currentTarget);
    histogramController.currentTargetProperty().bind(currentTarget);
    snapshotController.currentTargetProperty().bind(currentTarget);
    currentClassNameSet = new SimpleObjectProperty<>();
    summaryController.currentClassNameSetProperty().bind(currentClassNameSet);
    histogramController.currentClassNameSetProperty().bind(currentClassNameSet);
    histogramController.instanceGraphProperty().bind(radioInstance.selectedProperty());
    snapshotController.instanceGraphProperty().bind(radioInstance.selectedProperty());
    snapshotSelectionModel = new SimpleObjectProperty<>();
    snapshotSelectionModel.bind(snapshotController.snapshotSelectionModelProperty());
    histogramController.snapshotSelectionModelProperty().bind(snapshotSelectionModel);
    histogramController.setDrawRebootSuspectLine(this::drawRebootSuspectLine);
    topNList = new SimpleObjectProperty<>();
    topNList.bind(histogramController.topNListProperty());
    snapshotController.topNListProperty().bind(topNList);
    currentSnapShotHeader = new SimpleObjectProperty<>();
    currentSnapShotHeader.bind(
        snapshotController.snapshotSelectionModelProperty().get().selectedItemProperty());
    reftreeController.currentSnapShotHeaderProperty().bind(currentSnapShotHeader);

    currentObjectTag = new SimpleLongProperty();
    // TODO:
    //   Why can I NOT use binding?
    //   First binding is enabled. But second binding is disabled.
    //   So I use ChangeListener to avoid this issue.
    // currentObjectTag.bind(histogramController.currentObjectTagProperty());
    // currentObjectTag.bind(snapshotController.currentObjectTagProperty());
    histogramController
        .currentObjectTagProperty()
        .addListener(
            (v, o, n) -> Optional.ofNullable(n).ifPresent(m -> currentObjectTag.set((Long) m)));
    snapshotController
        .currentObjectTagProperty()
        .addListener(
            (v, o, n) -> Optional.ofNullable(n).ifPresent(m -> currentObjectTag.set((Long) m)));
    reftreeController.currentObjectTagProperty().bind(currentObjectTag);

    snapshotMain.getSelectionModel().selectedItemProperty().addListener(this::onTabChanged);

    startCombo.setConverter(new SnapShotHeaderConverter());
    endCombo.setConverter(new SnapShotHeaderConverter());

    okBtn
        .disableProperty()
        .bind(
            startCombo
                .getSelectionModel()
                .selectedIndexProperty()
                .greaterThanOrEqualTo(endCombo.getSelectionModel().selectedIndexProperty()));

    setOnWindowResize(
        (v, o, n) ->
            Platform.runLater(
                () ->
                    Stream.of(
                            summaryController.getHeapChart(),
                            summaryController.getInstanceChart(),
                            summaryController.getGcTimeChart(),
                            summaryController.getMetaspaceChart(),
                            histogramController.getTopNChart())
                        .forEach(c -> Platform.runLater(() -> drawRebootSuspectLine(c)))));

    histogramController.setTaskExecutor(
        t -> {
          bindTask(t);
          (new Thread(t)).start();
        });
  }
 public CommonsBaseGridView(Class<T> clazz, IOptions iColumnNaming) {
   this(clazz, FXCollections.emptyObservableList(), iColumnNaming);
 }