Exemplo n.º 1
0
 /**
  * Sets up the add button, which is used to add filters to the graph and to the table view.
  *
  * @return The fully configured add button.
  */
 private Button setAddButton() {
   final Button addButton = new ImageButton("add.png");
   addButton.setOnAction(actionEvent -> filterEditingMenu.showMenu());
   addButton.setScaleX(0.5);
   addButton.setScaleY(0.5);
   return addButton;
 }
Exemplo n.º 2
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;
  }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
  /**
   * Set up the selection button used to create a filter from a selection.
   *
   * @return The fully configured selection button.
   */
  private Button setSelectionButton() {
    final Button selectionButton = new ImageButton("select.png");
    selectionButton.setScaleX(0.5);
    selectionButton.setScaleY(0.5);

    selectionButton.setOnAction(
        actionEvent -> {
          final Set<INode> selected = new HashSet<>(pickedState.getPicked());
          final List<String> filterStringList =
              selected
                  .stream()
                  .map(node -> node.getAddress().toString())
                  .collect(Collectors.toList());
          filterEditingMenu.showMenu(filterStringList);
        });

    return selectionButton;
  }