Пример #1
0
  /**
   * 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;
  }
Пример #2
0
  public void notifyUpdateCommand(FilterInput filterInput) {

    final IUserCommand command = interactionMap.get(FilterInteraction.UPDATE);

    if (command != null) {
      logger.debug("update command of filterinput");
      command.setSelection(filterInput);
      notifyListeners(command);
    }
  }