1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-22 15:30:09 -08:00

Stop autosaving, switch to save + reload buttons.

This commit is contained in:
Danila Fedorin 2017-08-02 19:37:35 -07:00
parent 2f1ed5f0d1
commit be28e26607
2 changed files with 11 additions and 10 deletions

View File

@ -51,8 +51,6 @@ public class AbacusController implements PluginListener {
private ComboBox<String> numberImplementationBox;
@FXML
private ListView<ToggleablePlugin> enabledPluginView;
@FXML
private Button reloadButton;
/**
* The list of history entries, created by the users.
@ -94,11 +92,6 @@ public class AbacusController implements PluginListener {
historyTable.setItems(historyData);
numberImplementationOptions = FXCollections.observableArrayList();
numberImplementationBox.setItems(numberImplementationOptions);
numberImplementationBox.valueProperty().addListener((observable, oldValue, newValue)
-> {
abacus.getConfiguration().setNumberImplementation(newValue);
abacus.getConfiguration().saveTo(Abacus.CONFIG_FILE);
});
historyTable.getSelectionModel().setCellSelectionEnabled(true);
enabledPlugins = FXCollections.observableArrayList();
enabledPluginView.setItems(enabledPlugins);
@ -146,7 +139,13 @@ public class AbacusController implements PluginListener {
if(!pluginEntry.isEnabled()) disabledPlugins.add(pluginEntry.getClassName());
}
abacus.getPluginManager().reload();
abacus.getConfiguration().saveTo(Abacus.CONFIG_FILE);
}
@FXML
private void performSave(){
Configuration configuration = abacus.getConfiguration();
configuration.setNumberImplementation(numberImplementationBox.getSelectionModel().getSelectedItem());
configuration.saveTo(Abacus.CONFIG_FILE);
}
@Override

View File

@ -49,8 +49,10 @@
<ListView fx:id="enabledPluginView"
GridPane.rowIndex="1" GridPane.columnIndex="0"
GridPane.columnSpan="2" maxHeight="100"/>
<Button fx:id="reloadButton" text="Reload" GridPane.rowIndex="2" GridPane.columnIndex="0"
onAction="#performReload"/>
<HBox GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="2" spacing="10">
<Button text="Apply" onAction="#performSave"/>
<Button text="Reload" onAction="#performReload"/>
</HBox>
</GridPane>
</Tab>
</TabPane>