private void refreshFunctions() {
// remove all current functions
nodeFunctions.getChildren().clear();
CheckBox checkBox;
// get a reference to the function set
final FunctionSet functionSet = gui.getExperiment().getResources().getFunctionSet();
for (int i = 0; i < functionSet.getTotalFunctionCount(); i++) {
// add a checkbox for each function
checkBox = new CheckBox(functionSet.getFunction(i).toString());
checkBox.setId(String.valueOf(i));
// make sure the selection matches the function set
checkBox.setSelected(functionSet.isEnabled(functionSet.getFunction(i)));
final int index = i;
// set listener so function set gets updated if the checkboxes change
checkBox.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (((CheckBox) event.getSource()).isSelected()) {
functionSet.enableFunction(index);
} else {
functionSet.disableFunction(index);
}
gui.updateFunctionSelector();
revalidateParameters();
}
});