added first start up config variable getting
This commit is contained in:
parent
d3a094b83d
commit
e31716db04
@ -15,6 +15,7 @@ import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.FileChooser;
|
||||
import sarsoo.fmframework.config.Config;
|
||||
import sarsoo.fmframework.config.ConfigPersister;
|
||||
import sarsoo.fmframework.config.ConfigVariable;
|
||||
import sarsoo.fmframework.config.VariableEvent;
|
||||
import sarsoo.fmframework.config.VariableListener;
|
||||
@ -70,6 +71,8 @@ public class RootController {
|
||||
}
|
||||
}
|
||||
|
||||
new ConfigPersister().saveConfig(".fm/", config);
|
||||
|
||||
FmFramework.getSessionConfig().getVariable("username").addListener(new VariableListener() {
|
||||
|
||||
@Override
|
||||
@ -250,45 +253,23 @@ public class RootController {
|
||||
}
|
||||
|
||||
public void changeUsername() {
|
||||
Service<Void> service = new Service<Void>() {
|
||||
@Override
|
||||
protected Task<Void> createTask() {
|
||||
return new Task<Void>() {
|
||||
@Override
|
||||
protected Void call() throws Exception {
|
||||
|
||||
String username = JOptionPane.showInputDialog("enter username:");
|
||||
if (username != null) {
|
||||
FmFramework.getSessionConfig().getVariable("username").setValue(username);
|
||||
String username = JOptionPane.showInputDialog("enter username:");
|
||||
if (username != null) {
|
||||
FmFramework.getSessionConfig().addVariable(new ConfigVariable("username", username));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
service.start();
|
||||
}
|
||||
|
||||
public void setApiKey() {
|
||||
Service<Void> service = new Service<Void>() {
|
||||
@Override
|
||||
protected Task<Void> createTask() {
|
||||
return new Task<Void>() {
|
||||
@Override
|
||||
protected Void call() throws Exception {
|
||||
|
||||
String apiKey = JOptionPane.showInputDialog("enter api key:");
|
||||
if (apiKey != null) {
|
||||
FmFramework.getSessionConfig().getVariable("api_key").setValue(apiKey);
|
||||
String apiKey = JOptionPane.showInputDialog("enter api key:");
|
||||
if (apiKey != null) {
|
||||
FmFramework.getSessionConfig().addVariable(new ConfigVariable("api_key", apiKey));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
service.start();
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
Loading…
Reference in New Issue
Block a user