mirror of
https://github.com/DanilaFe/abacus
synced 2026-01-26 08:35:20 +00:00
Compare commits
3 Commits
variables
...
function-l
| Author | SHA1 | Date | |
|---|---|---|---|
| 200f4c7288 | |||
| f28e915c9a | |||
| 7a0863380a |
@@ -5,6 +5,7 @@ import javafx.beans.value.ChangeListener;
|
|||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.collections.transformation.FilteredList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.cell.CheckBoxListCell;
|
import javafx.scene.control.cell.CheckBoxListCell;
|
||||||
@@ -72,6 +73,8 @@ public class AbacusController implements PluginListener {
|
|||||||
@FXML
|
@FXML
|
||||||
private Tab settingsTab;
|
private Tab settingsTab;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Tab functionListTab;
|
||||||
|
@FXML
|
||||||
private TableView<HistoryModel> historyTable;
|
private TableView<HistoryModel> historyTable;
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<HistoryModel, String> inputColumn;
|
private TableColumn<HistoryModel, String> inputColumn;
|
||||||
@@ -93,6 +96,10 @@ public class AbacusController implements PluginListener {
|
|||||||
private ListView<ToggleablePlugin> enabledPluginView;
|
private ListView<ToggleablePlugin> enabledPluginView;
|
||||||
@FXML
|
@FXML
|
||||||
private TextField computationLimitField;
|
private TextField computationLimitField;
|
||||||
|
@FXML
|
||||||
|
private ListView<String> functionListView;
|
||||||
|
@FXML
|
||||||
|
private TextField functionListSearchField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of history entries, created by the users.
|
* The list of history entries, created by the users.
|
||||||
@@ -110,6 +117,14 @@ public class AbacusController implements PluginListener {
|
|||||||
* and, when reloaded, get added to the plugin manager's black list.
|
* and, when reloaded, get added to the plugin manager's black list.
|
||||||
*/
|
*/
|
||||||
private ObservableList<ToggleablePlugin> enabledPlugins;
|
private ObservableList<ToggleablePlugin> enabledPlugins;
|
||||||
|
/**
|
||||||
|
* The list of functions that are registered in the calculator.
|
||||||
|
*/
|
||||||
|
private ObservableList<String> functionList;
|
||||||
|
/**
|
||||||
|
* The filtered list displayed to the user.
|
||||||
|
*/
|
||||||
|
private FilteredList<String> functionFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The abacus instance used for changing the plugin configuration.
|
* The abacus instance used for changing the plugin configuration.
|
||||||
@@ -213,6 +228,11 @@ public class AbacusController implements PluginListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
functionList = FXCollections.observableArrayList();
|
||||||
|
functionFilter = new FilteredList<>(functionList, (s) -> true);
|
||||||
|
functionListView.setItems(functionFilter);
|
||||||
|
functionListSearchField.textProperty().addListener((observable, oldValue, newValue) ->
|
||||||
|
functionFilter.setPredicate((newValue.length() == 0) ? ((s) -> true) : ((s) -> s.contains(newValue))));
|
||||||
historyData = FXCollections.observableArrayList();
|
historyData = FXCollections.observableArrayList();
|
||||||
historyTable.setItems(historyData);
|
historyTable.setItems(historyData);
|
||||||
numberImplementationOptions = FXCollections.observableArrayList();
|
numberImplementationOptions = FXCollections.observableArrayList();
|
||||||
@@ -327,10 +347,13 @@ public class AbacusController implements PluginListener {
|
|||||||
plugin.enabledProperty().addListener(e -> changesMade = true);
|
plugin.enabledProperty().addListener(e -> changesMade = true);
|
||||||
enabledPlugins.add(plugin);
|
enabledPlugins.add(plugin);
|
||||||
}
|
}
|
||||||
|
functionList.addAll(manager.getAllFunctions());
|
||||||
|
functionList.sort(String::compareTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUnload(PluginManager manager) {
|
public void onUnload(PluginManager manager) {
|
||||||
|
functionList.clear();
|
||||||
enabledPlugins.clear();
|
enabledPlugins.clear();
|
||||||
numberImplementationOptions.clear();
|
numberImplementationOptions.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,6 +209,9 @@ public class PluginManager {
|
|||||||
if (disabledPlugins.contains(plugin.getClass().getName())) continue;
|
if (disabledPlugins.contains(plugin.getClass().getName())) continue;
|
||||||
plugin.disable();
|
plugin.disable();
|
||||||
}
|
}
|
||||||
|
registeredFunctions.clear();
|
||||||
|
registeredOperators.clear();
|
||||||
|
registeredNumberImplementations.clear();
|
||||||
cachedInterfaceImplementations.clear();
|
cachedInterfaceImplementations.clear();
|
||||||
cachedPi.clear();
|
cachedPi.clear();
|
||||||
listeners.forEach(e -> e.onUnload(this));
|
listeners.forEach(e -> e.onUnload(this));
|
||||||
|
|||||||
@@ -60,6 +60,15 @@
|
|||||||
</FlowPane>
|
</FlowPane>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
<Tab fx:id="functionListTab" text="Functions" closable="false">
|
||||||
|
<VBox spacing="10">
|
||||||
|
<padding>
|
||||||
|
<Insets left="10" right="10" top="10" bottom="10"/>
|
||||||
|
</padding>
|
||||||
|
<TextField fx:id="functionListSearchField" maxWidth="Infinity"/>
|
||||||
|
<ListView maxWidth="Infinity" fx:id="functionListView"/>
|
||||||
|
</VBox>
|
||||||
|
</Tab>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user