    /**
     * Sets up the button for appending connections to the matrix
     */
    @Override
    protected void appendConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Append Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows
                } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns
                } else {  // clear all items
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                }
            }
        });

        itemSelector.valueProperty().addListener((options, oldValue, newValue) -> {
            RadioButton rb = (RadioButton)tg.getSelectedToggle();
            connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
            connections.clear();
            if (rb.equals(selectByRow)) {  // clear all items and add rows to it
                for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && col.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(col.getName());
                    CheckBox box = new CheckBox();
                    connections.put(box, col);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            } else if (rb.equals(selectByCol)) {
                for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && row.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(row.getName());
                    CheckBox box = new CheckBox();
                    connections.put(box, row);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            }
        });

        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {  // rowUid | colUid | name | weight
               matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

    /**
     * Sets up the button for appending connections to the matrix
     */
    @Override
    protected void appendConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Append Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();

                    for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                        VBox connectionVBox = new VBox();
                        connectionVBox.setAlignment(Pos.CENTER);

                        Label name = new Label(col.getName());
                        CheckBox box = new CheckBox();
                        connections.put(box, col);
                        connectionVBox.getChildren().addAll(name, box);
                        connectionsModifier.getChildren().add(connectionVBox);
                    }
                } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();

                    for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                        VBox connectionVBox = new VBox();
                        connectionVBox.setAlignment(Pos.CENTER);

                        Label name = new Label(row.getName());
                        CheckBox box = new CheckBox();
                        connections.put(box, row);
                        connectionVBox.getChildren().addAll(name, box);
                        connectionsModifier.getChildren().add(connectionVBox);
                    }
                } else {  // clear all items
                    itemSelector.getItems().removeAll(itemSelector.getItems());

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();
                }
            }
        });
        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {  // rowUid | colUid | name | weight
               matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

Replace Anonymous With Lambda View.SideBarTools.SymmetricSideBar.appendConnectionsCallback.addListener.new ChangeListener<Toggle> with (options, oldValue, newValue) -> {RadioButton rb=(RadioButton)tg.getSelectedToggle(); in method protected appendConnectionsCallback() : void from class View.SideBarTools.SymmetricSideBar


    /**
     * Sets up the button for setting connections in the matrix
     */
    @Override
    protected void setConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Set Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else if (connection.getConnectionName() != null && connection.getWeight() != Double.MAX_VALUE) {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                } else {
                    setText(
                        "Delete " +
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows
                } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns
                } else {  // clear all items
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                }
            }
        });

        itemSelector.valueProperty().addListener((options, oldValue, newValue) -> {
            RadioButton rb = (RadioButton)tg.getSelectedToggle();
            connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
            connections.clear();
            if (rb.equals(selectByRow)) {  // clear all items and add rows to it
                for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && col.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(col.getName());
                    CheckBox box = new CheckBox();
                    connections.put(box, col);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            } else if (rb.equals(selectByCol)) {
                for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && row.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(row.getName());
                    CheckBox box = new CheckBox();
                    connections.put(box, row);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            }
        });

        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        itemSelector.setOnAction(ee -> {  // when item changes, change the connections that are selected
            if(itemSelector.getValue() == null) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow) && matrix.getConnection(itemSelector.getValue().getUid(), entry.getValue().getUid()) != null) {
                    entry.getKey().setSelected(true);
                } else if(rb.equals(selectByCol) && matrix.getConnection(entry.getValue().getUid(), itemSelector.getValue().getUid()) != null) {
                    entry.getKey().setSelected(true);
                } else {
                    entry.getKey().setSelected(false);
                }
            }
        });

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if (entry.getKey().isSelected() && !connectionName.getText().isEmpty()) {  // create the connection
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                } else {  // delete the connection
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(null, Double.MAX_VALUE, itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(null, Double.MAX_VALUE, entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                } else {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(null, Double.MAX_VALUE, rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(null, Double.MAX_VALUE, symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(null, Double.MAX_VALUE, rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(null, Double.MAX_VALUE, symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if (!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if (!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {
                if(conn.getConnectionName() != null && conn.getWeight() != Double.MAX_VALUE) {
                    matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
                } else {
                    matrix.deleteConnection(conn.getRowUid(), conn.getColUid());
                }
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

    /**
     * Sets up the button for setting connections in the matrix
     */
    @Override
    protected void setConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Append Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else if (connection.getConnectionName() != null && connection.getWeight() != Double.MAX_VALUE) {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                } else {
                    setText(
                        "Delete " +
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();

                    for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                        VBox connectionVBox = new VBox();
                        connectionVBox.setAlignment(Pos.CENTER);

                        Label name = new Label(col.getName());
                        CheckBox box = new CheckBox();
                        connections.put(box, col);
                        connectionVBox.getChildren().addAll(name, box);
                        connectionsModifier.getChildren().add(connectionVBox);
                    }
                } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();

                    for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                        VBox connectionVBox = new VBox();
                        connectionVBox.setAlignment(Pos.CENTER);

                        Label name = new Label(row.getName());
                        CheckBox box = new CheckBox();
                        connections.put(box, row);
                        connectionVBox.getChildren().addAll(name, box);
                        connectionsModifier.getChildren().add(connectionVBox);
                    }
                } else {  // clear all items
                    itemSelector.getItems().removeAll(itemSelector.getItems());

                    connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
                    connections.clear();
                }
            }
        });
        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        itemSelector.setOnAction(ee -> {  // when item changes, change the connections that are selected
            if(itemSelector.getValue() == null) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow) && matrix.getConnection(itemSelector.getValue().getUid(), entry.getValue().getUid()) != null) {
                    entry.getKey().setSelected(true);
                } else if(rb.equals(selectByCol) && matrix.getConnection(entry.getValue().getUid(), itemSelector.getValue().getUid()) != null) {
                    entry.getKey().setSelected(true);
                } else {
                    entry.getKey().setSelected(false);
                }
            }
        });

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if (entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                } else {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(null, Double.MAX_VALUE, itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(null, Double.MAX_VALUE, entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                } else {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(null, Double.MAX_VALUE, rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(null, Double.MAX_VALUE, symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(null, Double.MAX_VALUE, rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(null, Double.MAX_VALUE, symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if (!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if (!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {
                if(conn.getConnectionName() != null && conn.getWeight() != Double.MAX_VALUE) {
                    matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
                } else {
                    matrix.deleteConnection(conn.getRowUid(), conn.getColUid());
                }
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

Replace Anonymous With Lambda View.SideBarTools.SymmetricSideBar.setConnectionsCallback.addListener.new ChangeListener<Toggle> with (options, oldValue, newValue) -> {RadioButton rb=(RadioButton)tg.getSelectedToggle(); in method protected setConnectionsCallback() : void from class View.SideBarTools.SymmetricSideBar


	@Override
	public void setSession (RfbClientSession session) {
		Objects.requireNonNull (session, "session");

		this.session = session;
		session.attachView (this);

		this.setFocusTraversable (true);
		this.setMouseTransparent (false);

		this.addEventFilter (MouseEvent.ANY, new EventHandler<MouseEvent> () {

			long lastMoveTimestamp = 0;
			long mouseMoveSendDelayMs = vncPrefs.getLong ("MOUSEMOVE_SEND_DELAY", 100L);

			@Override
			public void handle (MouseEvent e) {
				EventType eventType = e.getEventType ();
				int x = (int) e.getX ();
				int y = (int) e.getY ();

				if (eventType == MouseEvent.MOUSE_PRESSED) {
					int buttonMask = PointerEventMessage.BUTTONMASK_LEFT;
					if (e.getButton () == MouseButton.SECONDARY) {
						buttonMask = PointerEventMessage.BUTTONMASK_RIGHT;
					} else if (e.getButton () == MouseButton.MIDDLE) {
						buttonMask = PointerEventMessage.BUTTONMASK_MIDDLE;
					}

					PointerEventMessage pointerEventMsg = new PointerEventMessage (session, buttonMask, x, y);
					session.sendMessage (pointerEventMsg);
				} else if (eventType == MouseEvent.MOUSE_RELEASED) {
					PointerEventMessage pointerEventMsg = new PointerEventMessage (session, 0, x, y);
					session.sendMessage (pointerEventMsg);
				} else if (eventType == MouseEvent.MOUSE_ENTERED || eventType == MouseEvent.MOUSE_MOVED) {

					// Don't spam the server with mouse position updates
					long motionTimestamp = System.currentTimeMillis ();
					if (motionTimestamp - this.lastMoveTimestamp > this.mouseMoveSendDelayMs) {
						PointerEventMessageSequence pointerEventMsg = new PointerEventMessageSequence (session, PointerEventMessageSequence.EVENTTYPE_CAMEHERE, x, y);
						session.sendMessage (pointerEventMsg);

						this.lastMoveTimestamp = motionTimestamp;
					}
				}
			}
		});
		this.addEventFilter (ScrollEvent.ANY, (ScrollEvent e) -> {
			int x = (int) e.getX ();
			int y = (int) e.getY ();

			int eventType;
			int times;

			int wheelRotation = (int) (e.getDeltaY () / e.getMultiplierY ());
			if (wheelRotation < 0) {        // wheel rotated down
				eventType = PointerEventMessageSequence.EVENTTYPE_WHEEL_DOWN;
				times = -wheelRotation;
			} else {                        // wheel rotated up
				eventType = PointerEventMessageSequence.EVENTTYPE_WHEEL_UP;
				times = wheelRotation;
			}

			PointerEventMessageSequence pointerEventMsg = new PointerEventMessageSequence (session, eventType, x, y);

			for (int i = 0; i < times; i++) {
				session.sendMessage (pointerEventMsg);
			}
		});
		this.addEventFilter (KeyEvent.KEY_PRESSED, (KeyEvent e) -> {
			int keySym = Keysyms.translateFxKeyEvent (e);

			System.out.println ("KeyEvent " + e + " : keysym " + keySym + " " + Integer.toHexString (keySym));

			KeyEventMessageSequence seq = new KeyEventMessageSequence (session, KeyEventMessageSequence.EVENTTYPE_PRESSED, keySym);
			session.sendMessage (seq);

			e.consume ();
		});
		this.addEventFilter (KeyEvent.KEY_RELEASED, (KeyEvent e) -> {
			int keySym = Keysyms.translateFxKeyEvent (e);

			System.out.println ("KeyEvent " + e + " : keysym " + keySym + " " + Integer.toHexString (keySym));

			KeyEventMessageSequence seq = new KeyEventMessageSequence (session, KeyEventMessageSequence.EVENTTYPE_RELEASED, keySym);
			session.sendMessage (seq);

			e.consume ();
		});
		this.addEventFilter (KeyEvent.ANY, (KeyEvent e) -> {
			e.consume ();
		});
	}

	@Override
	public void setSession (RfbClientSession session) {
		Objects.requireNonNull (session, "session");

		this.session = session;
		session.attachView (this);

		this.setFocusTraversable (true);
		this.setMouseTransparent (false);

		this.addEventFilter (MouseEvent.ANY, new EventHandler<MouseEvent> () {

			long lastMoveTimestamp = 0;
			long mouseMoveSendDelayMs = vncPrefs.getLong ("MOUSEMOVE_SEND_DELAY", 100l);

			@Override
			public void handle (MouseEvent e) {
				EventType eventType = e.getEventType ();
				int x = (int) e.getX ();
				int y = (int) e.getY ();

				if (eventType == MouseEvent.MOUSE_PRESSED) {
					int buttonMask = PointerEventMessage.BUTTONMASK_LEFT;
					if (e.getButton () == MouseButton.SECONDARY) {
						buttonMask = PointerEventMessage.BUTTONMASK_RIGHT;
					} else if (e.getButton () == MouseButton.MIDDLE) {
						buttonMask = PointerEventMessage.BUTTONMASK_MIDDLE;
					}

					PointerEventMessage pointerEventMsg = new PointerEventMessage (session, buttonMask, x, y);
					session.sendMessage (pointerEventMsg);
				} else if (eventType == MouseEvent.MOUSE_RELEASED) {
					PointerEventMessage pointerEventMsg = new PointerEventMessage (session, 0, x, y);
					session.sendMessage (pointerEventMsg);
				} else if (eventType == MouseEvent.MOUSE_ENTERED || eventType == MouseEvent.MOUSE_MOVED) {

					// Don't spam the server with mouse position updates
					long motionTimestamp = System.currentTimeMillis ();
					if (motionTimestamp - lastMoveTimestamp > mouseMoveSendDelayMs) {
						PointerEventMessageSequence pointerEventMsg = new PointerEventMessageSequence (session, PointerEventMessageSequence.EVENTTYPE_CAMEHERE, x, y);
						session.sendMessage (pointerEventMsg);

						lastMoveTimestamp = motionTimestamp;
					}
				}
			}
		});
		this.addEventFilter (ScrollEvent.ANY, new EventHandler<ScrollEvent> () {
			@Override
			public void handle (ScrollEvent e) {
				int x = (int) e.getX ();
				int y = (int) e.getY ();

				int eventType;
				int times;

				int wheelRotation = (int) (e.getDeltaY () / e.getMultiplierY ());
				if (wheelRotation < 0) {		// wheel rotated up
					eventType = PointerEventMessageSequence.EVENTTYPE_WHEEL_UP;
					times = wheelRotation;
				} else {						// wheel rotated down
					eventType = PointerEventMessageSequence.EVENTTYPE_WHEEL_DOWN;
					times = -wheelRotation;
				}

				PointerEventMessageSequence pointerEventMsg = new PointerEventMessageSequence (session, eventType, x, y);

				for (int i = 0; i < times; i++) {
					session.sendMessage (pointerEventMsg);
				}
			}

		});
		this.addEventFilter (KeyEvent.KEY_PRESSED, (KeyEvent e) -> {
			int keySym = Keysyms.translateFxKeyEvent (e);

			System.out.println ("KeyEvent " + e + " : keysym " + keySym + " " + Integer.toHexString (keySym));

			KeyEventMessageSequence seq = new KeyEventMessageSequence (session, KeyEventMessageSequence.EVENTTYPE_PRESSED, keySym);
			session.sendMessage (seq);

			e.consume ();
		});
		this.addEventFilter (KeyEvent.KEY_RELEASED, (KeyEvent e) -> {
			int keySym = Keysyms.translateFxKeyEvent (e);

			System.out.println ("KeyEvent " + e + " : keysym " + keySym + " " + Integer.toHexString (keySym));

			KeyEventMessageSequence seq = new KeyEventMessageSequence (session, KeyEventMessageSequence.EVENTTYPE_RELEASED, keySym);
			session.sendMessage (seq);

			e.consume ();
		});
		this.addEventFilter (KeyEvent.ANY, (KeyEvent e) -> {
			e.consume ();
		});
	}

Replace Anonymous With Lambda ru.dmerkushov.vnc.client.ui.DefaultJavaFxVncView.setSession.addEventFilter.new EventHandler<ScrollEvent> with (e) -> {int x=(int)e.getX(); in method public setSession(session RfbClientSession) : void from class ru.dmerkushov.vnc.client.ui.DefaultJavaFxVncView


	@Override
	public void paintNow (int x, int y, int width, int height) {
		RfbFramebuffer framebuffer = this.session.getFramebuffer ();

		if (framebuffer == null) {
			VncCommon.getLogger ().warning ("No framebuffer attached to session");
			return;
		}

		Image fxImg;

		synchronized (framebuffer) {
			fxImg = this.toFxImage (framebuffer);
		}

		final CountDownLatch doneLatch = new CountDownLatch (1);

		Platform.runLater (() -> {
			// Skip this framebuffer update if it's old
//				if (framebuffer.fbuIndex.get () != FramebufferUpdateMessage.currentFbuIndex.get ()) {
//
//					// DEBUG
//					System.out.println ("Skipping");
//
//					doneLatch.countDown ();
//					return;
//				}

			try {
				DefaultJavaFxVncView.this.setWidth (fxImg.getWidth ());
				DefaultJavaFxVncView.this.setHeight (fxImg.getHeight ());

				GraphicsContext gc = DefaultJavaFxVncView.this.getGraphicsContext2D ();

				gc.drawImage (fxImg, 0, 0, width, height);
			} finally {
				doneLatch.countDown ();
			}
		});

		try {
			doneLatch.await ();
		} catch (InterruptedException ex) {
			Logger.getLogger (DefaultJavaFxVncView.class.getName ()).log (Level.SEVERE, null, ex);
		}

		// DEBUG
		System.out.println ("def paintNow WxH: " + this.getWidth () + "x" + this.getHeight ());
	}

	@Override
	public void paintNow (int x, int y, int width, int height) {
		RfbFramebuffer framebuffer = session.getFramebuffer ();

		if (framebuffer == null) {
			VncCommon.getLogger ().warning ("No framebuffer attached to session");
			return;
		}

		Image fxImg;

		synchronized (framebuffer) {
			fxImg = this.toFxImage (framebuffer);
		}

		final CountDownLatch doneLatch = new CountDownLatch (1);

		Platform.runLater (new Runnable () {
			@Override
			public void run () {
				// Skip this framebuffer update if it's old
//				if (framebuffer.fbuIndex.get () != FramebufferUpdateMessage.currentFbuIndex.get ()) {
//
//					// DEBUG
//					System.out.println ("Skipping");
//
//					doneLatch.countDown ();
//					return;
//				}

				try {
					DefaultJavaFxVncView.this.setWidth (fxImg.getWidth ());
					DefaultJavaFxVncView.this.setHeight (fxImg.getHeight ());

					GraphicsContext gc = DefaultJavaFxVncView.this.getGraphicsContext2D ();

					gc.drawImage (fxImg, 0, 0, width, height);
				} finally {
					doneLatch.countDown ();
				}
			}
		});

		try {
			doneLatch.await ();
		} catch (InterruptedException ex) {
			Logger.getLogger (DefaultJavaFxVncView.class.getName ()).log (Level.SEVERE, null, ex);
		}

		// DEBUG
		System.out.println ("WxH: " + getWidth () + "x" + getHeight ());
	}

Replace Anonymous With Lambda ru.dmerkushov.vnc.client.ui.DefaultJavaFxVncView.paintNow.runLater.new Runnable with () -> {tryDefaultJavaFxVncView.this.setWidth(fxImg.getWidth()); in method public paintNow(x int, y int, width int, height int) : void from class ru.dmerkushov.vnc.client.ui.DefaultJavaFxVncView


	@Override
	public void paintNow (int x, int y, int width, int height) {
		RfbFramebuffer framebuffer = this.session.getFramebuffer ();

		if (framebuffer == null) {
			VncCommon.getLogger ().warning ("No framebuffer attached to session");
			return;
		}

		Image fxImg;

		synchronized (framebuffer) {
			fxImg = this.toFxImage (framebuffer);
		}

		final CountDownLatch doneLatch = new CountDownLatch (1);

		Platform.runLater (() -> {
			try {

				GraphicsContext gc = ThumbnailJavafxVncView.this.getGraphicsContext2D ();

				double thumbWidth = ThumbnailJavafxVncView.this.getWidth ();
				double thumbHeight = ThumbnailJavafxVncView.this.getHeight ();

				gc.drawImage (fxImg, 0, 0, thumbWidth, thumbHeight);
			} finally {
				doneLatch.countDown ();
			}
		});

		try {
			doneLatch.await ();
		} catch (InterruptedException ex) {
			Logger.getLogger (DefaultJavaFxVncView.class.getName ()).log (Level.SEVERE, null, ex);
		}

		System.out.println ("thumb paintNow WxH: " + this.getWidth () + "x" + this.getHeight ());
	}

	@Override
	public void paintNow (int x, int y, int width, int height) {
		RfbFramebuffer framebuffer = session.getFramebuffer ();

		if (framebuffer == null) {
			VncCommon.getLogger ().warning ("No framebuffer attached to session");
			return;
		}

		Image fxImg;

		synchronized (framebuffer) {
			fxImg = this.toFxImage (framebuffer);
		}

		final CountDownLatch doneLatch = new CountDownLatch (1);

		Platform.runLater (new Runnable () {
			@Override
			public void run () {

				try {

					GraphicsContext gc = ThumbnailJavafxVncView.this.getGraphicsContext2D ();

					double width = ThumbnailJavafxVncView.this.getWidth ();
					double height = ThumbnailJavafxVncView.this.getHeight ();

					gc.drawImage (fxImg, 0, 0, width, height);
				} finally {
					doneLatch.countDown ();
				}
			}
		});

		try {
			doneLatch.await ();
		} catch (InterruptedException ex) {
			Logger.getLogger (DefaultJavaFxVncView.class.getName ()).log (Level.SEVERE, null, ex);
		}

		System.out.println ("WxH: " + getWidth () + "x" + getHeight ());
	}

Replace Anonymous With Lambda ru.dmerkushov.vnc.client.ui.ThumbnailJavafxVncView.paintNow.runLater.new Runnable with () -> {tryGraphicsContext gc=ThumbnailJavafxVncView.this.getGraphicsContext2D(); in method public paintNow(x int, y int, width int, height int) : void from class ru.dmerkushov.vnc.client.ui.ThumbnailJavafxVncView


    @Override
    public BlockMatrix<Type> get() {
        return new BlockMatrix<>(size, matrixMap);
    }

    @Override
    public BlockMatrix<Type> get() {
        return new BlockMatrix<Type>(size, matrixMap);
    }

Replace Generic With Diamond BlockMatrix<Type> with BlockMatrix<> in method public get() : BlockMatrix<Type> from class org.ulpgc.parallelalgebra.builders.block.BlockMatrixBuilder


    @Test
    public void test1() {
        int size = 4;
        int blockSize = 2;

        MatrixBuilder<Integer> blockMatrixBuilder = new BlockMatrixBuilder<>(size/blockSize);

        for (int ii = 0; ii < 2; ii++) {
            for (int jj = 0; jj < 2; jj++) {
                DenseMatrixBuilder<Integer> denseMatrixBuilder = new DenseMatrixBuilder<>(size/blockSize);
                for (int i = 0; i < 2; i++) {
                    for (int j = 0; j < 2; j++) {
                        denseMatrixBuilder.set(
                                new Coordinate(i, j),
                                new Random().nextInt()
                        );
                    }
                }

                blockMatrixBuilder.set(
                        new Coordinate(ii, jj),
                        denseMatrixBuilder.get()
                );
            }
        }

    }

    @Test
    public void test1() {
        int size = 4;
        int blockSize = 2;

        MatrixBuilder<Integer> blockMatrixBuilder = new BlockMatrixBuilder<Integer>(size/blockSize);

        for (int ii = 0; ii < 2; ii++) {
            for (int jj = 0; jj < 2; jj++) {
                DenseMatrixBuilder<Integer> denseMatrixBuilder = new DenseMatrixBuilder<>(size/blockSize);
                for (int i = 0; i < 2; i++) {
                    for (int j = 0; j < 2; j++) {
                        denseMatrixBuilder.set(
                                new Coordinate(i, j),
                                new Random().nextInt()
                        );
                    }
                }

                blockMatrixBuilder.set(
                        new Coordinate(ii, jj),
                        denseMatrixBuilder.get()
                );
            }
        }

    }

Replace Generic With Diamond BlockMatrixBuilder<Integer> with BlockMatrixBuilder<> in method public test1() : void from class org.ulpgc.parallelalgebra.TransformationTests


    private JungleIO() {
        this.console = System.console();
        this.promptStr = "\033[33m>>> \033[0m";
        this.scanner = new Scanner(System.in);
        this.reader = System.in;
        this.writer = System.out;
        this.dRemap = false;
        try (InputStream sizFile = this.getClass().getResourceAsStream("/.console_siz")) {
            assert sizFile != null;
            Scanner siz = new Scanner(sizFile);
            this.console_row = siz.nextInt(10);
            this.console_col = siz.nextInt(10);
        } catch (IOException ignored) {
        }
    }

    private JungleIO() {
        this.console = System.console();
        this.promptStr = "\033[33m>>> \033[0m";
        this.scanner = new Scanner(System.in);
        this.reader = System.in;
        this.writer = System.out;
        this.dRemap = false;
        try {
            Scanner siz = new Scanner(new FileInputStream(".console_siz"));
            this.console_row = siz.nextInt(10);
            this.console_col = siz.nextInt(10);
        } catch (FileNotFoundException ignored) {
        }
    }

Try With Resources try(InputStream sizFile=this.getClass().getResourceAsStream("/.console_siz")) in method private JungleIO() from class group11.comp3211.view.JungleIO


    public RegistrationDatabase() {
        try {
            Class.forName("org.sqlite.JDBC");
            String url = "jdbc:sqlite:/sqlite/db/registrations.db";

            this.conn = DriverManager.getConnection(url);
            this.setupDatabase();

            System.out.println("Connection to SQLite has been established");

        } catch(SQLException | ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException ex) {
                System.out.println(ex.getMessage());
            }
        }
    }

    public RegistrationDatabase() {
        try {
            Class.forName("org.sqlite.JDBC");
            String url = "jdbc:sqlite:C:\\Users\\olive\\source\\repos\\INTELLIJ\\Student Manager\\databases\\Registrations.db";

            this.conn = DriverManager.getConnection(url);
            this.setupDatabase();

            System.out.println("Connection to SQLite has been established");

        } catch(SQLException e) {
            e.printStackTrace();
        } catch(ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException ex) {
                System.out.println(ex.getMessage());
            }
        }
    }

Merge Catch [catch(SQLException e), catch(ClassNotFoundException e)] to catch(SQLException|ClassNotFoundException e) in method public RegistrationDatabase() from class io.oliverj.register.RegistrationDatabase


    @Test
    void testConstructeur(){
        Combinaison c1 = new Combinaison();
        Pion p1 = new Pion("rouge");
        Pion p2 = new Pion("bleu");
        Pion p3 = new Pion("jaune");
        Pion p4 = new Pion("vert");
        ArrayList<Pion> listePion = new ArrayList<>();
        listePion.add(p1);
        listePion.add(p2);
        listePion.add(p3);
        listePion.add(p4);
        c1.setListePion(listePion);
        Combinaison c2 = new Combinaison(c1);
    }

    @Test
    void testConstructeur(){
        Combinaison c1 = new Combinaison();
        Pion p1 = new Pion("rouge");
        Pion p2 = new Pion("bleu");
        Pion p3 = new Pion("jaune");
        Pion p4 = new Pion("vert");
        ArrayList<Pion> listePion = new ArrayList<Pion>();
        listePion.add(p1);
        listePion.add(p2);
        listePion.add(p3);
        listePion.add(p4);
        c1.setListePion(listePion);
        Combinaison c2 = new Combinaison(c1);
    }

Replace Generic With Diamond ArrayList<Pion> with ArrayList<> in method package testConstructeur() : void from class edu.ecn.medev.CombinaisonTest


    @Test
    void getListePion() {
        Combinaison comb = new Combinaison();
        assertEquals(4, comb.getListePion().size());
        assertNull(comb.getListePion().get(0));
        assertNull(comb.getListePion().get(1));
        assertNull(comb.getListePion().get(2));
        assertNull(comb.getListePion().get(3));

        Pion p1 = new Pion("rouge");
        Pion p2 = new Pion("bleu");
        Pion p3 = new Pion("jaune");
        Pion p4 = new Pion("vert");
        ArrayList<Pion> listePion = new ArrayList<>();
        listePion.add(p1);
        listePion.add(p2);
        listePion.add(p3);
        listePion.add(p4);
        comb.setListePion(listePion);
        Combinaison comb2 = new Combinaison(comb);

        assertEquals(4, comb2.getListePion().size());
        assertEquals("rouge", comb2.getListePion().get(0).getCouleur());
        assertEquals("bleu", comb2.getListePion().get(1).getCouleur());
        assertEquals("jaune", comb2.getListePion().get(2).getCouleur());
        assertEquals("vert", comb2.getListePion().get(3).getCouleur());
    }

    @Test
    void getListePion() {
        Combinaison comb = new Combinaison();
        assertEquals(4, comb.getListePion().size());
        assertNull(comb.getListePion().get(0));
        assertNull(comb.getListePion().get(1));
        assertNull(comb.getListePion().get(2));
        assertNull(comb.getListePion().get(3));

        Pion p1 = new Pion("rouge");
        Pion p2 = new Pion("bleu");
        Pion p3 = new Pion("jaune");
        Pion p4 = new Pion("vert");
        ArrayList<Pion> listePion = new ArrayList<Pion>();
        listePion.add(p1);
        listePion.add(p2);
        listePion.add(p3);
        listePion.add(p4);
        comb.setListePion(listePion);
        Combinaison comb2 = new Combinaison(comb);

        assertEquals(4, comb2.getListePion().size());
        assertEquals("rouge", comb2.getListePion().get(0).getCouleur());
        assertEquals("bleu", comb2.getListePion().get(1).getCouleur());
        assertEquals("jaune", comb2.getListePion().get(2).getCouleur());
        assertEquals("vert", comb2.getListePion().get(3).getCouleur());
    }

Replace Generic With Diamond ArrayList<Pion> with ArrayList<> in method package getListePion() : void from class edu.ecn.medev.CombinaisonTest


		@Override
		public void onChange(IElementHolder eh, BaseTableEntry.Status newStatus) {
			if (newStatus != BaseTableEntry.Status.KNOWN) {
				return;
			}

			if (eh == null) {
				return;
			}

			final OS_Element el = eh.getElement();

			@NotNull ElObjectType type = DecideElObjectType.getElObjectType(el);

			switch (type) {
			case NAMESPACE:
				@NotNull GenType genType = deduceTypes2._inj().new_GenTypeImpl((NamespaceStatement) el);
				generatedFunction.addDependentType(genType);
				break;
			case CLASS:
				if (idte.type != null && idte.type.genType != null) {
					assert idte.type.genType.getResolved() != null;
					generatedFunction.addDependentType(idte.type.genType);
				} else {
					@NotNull GenType genType2 = deduceTypes2._inj().new_GenTypeImpl((ClassStatement) el);
					generatedFunction.addDependentType(genType2);
				}
				break;
			case FUNCTION:
				@Nullable IdentIA identIA2 = null;
				if (pte.expression_num instanceof IdentIA)
					identIA2 = (IdentIA) pte.expression_num;
				if (identIA2 != null) {
					@NotNull IdentTableEntry idte2          = identIA.getEntry();
					@Nullable ProcTableEntry procTableEntry = idte2.getCallablePTE();
					if (procTableEntry == pte) SimplePrintLoggerToRemoveSoon.println_err_2("940 procTableEntry == pte");
					if (procTableEntry != null) {
						// TODO doesn't seem like we need this
						procTableEntry.onFunctionInvocation(functionInvocation -> {
							ClassInvocation     ci  = functionInvocation.getClassInvocation();
							NamespaceInvocation nsi = functionInvocation.getNamespaceInvocation();
							// do we register?? probably not
							assert ci != null || nsi != null;
							@NotNull FunctionInvocation fi = deduceTypes2.newFunctionInvocation((FunctionDef) el, pte, ci != null ? ci : nsi, deduceTypes2.getPhase());

							{
								if (functionInvocation.getClassInvocation() == fi.getClassInvocation() &&
										functionInvocation.getFunction() == fi.getFunction() &&
										functionInvocation.getPte() == fi.getPte())
									SimplePrintLoggerToRemoveSoon.println_err_2("955 It seems like we are generating the same thing...");
								else {
									int ok = 2;
								}

							}
							generatedFunction.addDependentFunction(fi);
						});
						// END
					}
				}
				break;
			case CONSTRUCTOR:
				int y = 2;
				break;
			default:
				deduceTypes2.LOG.err(String.format("228 Don't know what to do %s %s", type, el));
				break;
			}
		}

		@Override
		public void onChange(IElementHolder eh, BaseTableEntry.Status newStatus) {
			if (newStatus != BaseTableEntry.Status.KNOWN) {
				return;
			}

			if (eh == null) {
				return;
			}

			final OS_Element el = eh.getElement();

			@NotNull ElObjectType type = DecideElObjectType.getElObjectType(el);

			switch (type) {
			case NAMESPACE:
				@NotNull GenType genType = deduceTypes2._inj().new_GenTypeImpl((NamespaceStatement) el);
				generatedFunction.addDependentType(genType);
				break;
			case CLASS:
				if (idte.type != null && idte.type.genType != null) {
					assert idte.type.genType.getResolved() != null;
					generatedFunction.addDependentType(idte.type.genType);
				} else {
					@NotNull GenType genType2 = deduceTypes2._inj().new_GenTypeImpl((ClassStatement) el);
					generatedFunction.addDependentType(genType2);
				}
				break;
			case FUNCTION:
				@Nullable IdentIA identIA2 = null;
				if (pte.expression_num instanceof IdentIA)
					identIA2 = (IdentIA) pte.expression_num;
				if (identIA2 != null) {
					@NotNull IdentTableEntry idte2          = identIA.getEntry();
					@Nullable ProcTableEntry procTableEntry = idte2.getCallablePTE();
					if (procTableEntry == pte) SimplePrintLoggerToRemoveSoon.println_err_2("940 procTableEntry == pte");
					if (procTableEntry != null) {
						// TODO doesn't seem like we need this
						procTableEntry.onFunctionInvocation(new DoneCallback<FunctionInvocation>() {

							@Override
							public void onDone(@NotNull FunctionInvocation functionInvocation) {
								ClassInvocation     ci  = functionInvocation.getClassInvocation();
								NamespaceInvocation nsi = functionInvocation.getNamespaceInvocation();
								// do we register?? probably not
								assert ci != null || nsi != null;
								@NotNull FunctionInvocation fi = deduceTypes2.newFunctionInvocation((FunctionDef) el, pte, ci != null ? ci : nsi, deduceTypes2.phase);

								{
									if (functionInvocation.getClassInvocation() == fi.getClassInvocation() &&
											functionInvocation.getFunction() == fi.getFunction() &&
											functionInvocation.pte == fi.pte)
										SimplePrintLoggerToRemoveSoon.println_err_2("955 It seems like we are generating the same thing...");
									else {
										int ok = 2;
									}

								}
								generatedFunction.addDependentFunction(fi);
							}
						});
						// END
					}
				}
				break;
			case CONSTRUCTOR:
				int y = 2;
				break;
			default:
				deduceTypes2.LOG.err(String.format("228 Don't know what to do %s %s", type, el));
				break;
			}
		}

Replace Anonymous With Lambda tripleo.elijah.stages.deduce.__Add_Proc_Table_Listeners.SL.onChange.onFunctionInvocation.new DoneCallback<FunctionInvocation> with functionInvocation -> {ClassInvocation ci=functionInvocation.getClassInvocation(); in method public onChange(eh IElementHolder, newStatus BaseTableEntry.Status) : void from class tripleo.elijah_durable_congenial.stages.deduce.__Add_Proc_Table_Listeners.SL