Java 类javafx.scene.control.Dialogs 实例源码
项目:botcoin
文件:DashboardOptionsController.java
public void changePassHandler(ActionEvent event)
{
boolean correct = false;
String passphrase = new PassphrasePrompt(false).show(Global.dashboardStage);
String passDecrypt = Utils.decode(Settings.PATH_TO_SAVED_PW, passphrase);
correct = !passDecrypt.equals("-1");
if (!correct)
{
Dialogs.showErrorDialog(Global.dashboardStage,
"The passphrase is incorrect",
"Error",
"Wrong Passphrase");
}
else
{
System.out.println("Ok, proceeding"); //TODO remove
//Password correct
PassphraseDialog passDialog = new PassphraseDialog(Global.dashboardStage,Global.app,true,Global.passphrase);
passDialog.show();
}
}
项目:botcoin
文件:NewRuleDialogController.java
public void addRulePressed()
{
NewStoprulePaneController currentRuleController = (NewStoprulePaneController) stopRuleController.getController();
String ruleValidationMessage = currentRuleController.isRuleValid();
if (ruleValidationMessage.equals(currentRuleController.RULE_OK))
{
//Rule is valid, add it
currentRuleController.addRule();
}
else
{
//Rule is not valid, popup a message
Dialogs.showInformationDialog(new Stage(),
ruleValidationMessage,
"Check the correctness of the values",
"Invalid rule");
}
}
项目:botcoin
文件:DashboardController.java
public void onOffButtonPressed(ActionEvent event) {
if (getOnOffBtn().isSelected())
{
getOnOffBtn().setSelected(false);
Dialogs.DialogResponse response = Dialogs.showConfirmDialog(Global.dashboardStage,
"Are you sure you want to activate the bot?",
"Botcoin will try to execute the Active rules.",
"This operation needs confirmation",Dialogs.DialogOptions.YES_NO);
//check confirm dialog
if(response.equals(Dialogs.DialogResponse.YES) || response.equals(Dialogs.DialogResponse.OK) )
{
Global.toggleBot(true);
getOnOffBtn().setSelected(true);
}
else
{
getOnOffBtn().setSelected(false);
}
}
else
Global.toggleBot(false);
}
项目:socius
文件:PrincipalController.java
@FXML
public void compartilhar(ActionEvent e) throws IOException {
//permite peguar um arquivo
FileChooser fileChooser = new FileChooser();
File source = new File(System.getProperty("user.home"));
fileChooser.setInitialDirectory(source);
fileChooser.setTitle("Compartilhar Arquivos");
File original = fileChooser.showOpenDialog(new Stage());
if (original != null) {
//fazer depois de peguar o arquivo enviar para pasta publica
File copia = new File(socius + System.getProperty("file.separator") + original.getName());
MoverArquivoCompartilhar moverthread = new MoverArquivoCompartilhar(original.toPath(), copia.toPath());
Thread t = new Thread(moverthread);
t.run();
//os dialogs tambem podem receber um novo stage
Dialogs.showInformationDialog(new Stage(), "O arquivo " + original.getName() + " foi publicado"
+ " com sucesso!");
atualizaListaMeusArquivos();
}
}
项目:socius
文件:StatusDownloadController.java
public void setRequiredData(Stage stg, Download dw, PrincipalController pctl) {
this.stage = stg;
this.download = dw;
this.pcl = pctl;
// Confirmação para fechar tela
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Dialogs.DialogResponse res = Dialogs.showConfirmDialog(
stage, "Tem certeza de que deseja cancelar o download?",
"Download", "Download");
if (res.equals(Dialogs.DialogResponse.YES)) {
download.interromper();
pcl.atualizaListaMeusArquivos();
stage.close();
} else {
// Cancela fechamento da janela
t.consume();
}
}
});
}
项目:Java-MyCopies
文件:TaskScreenController.java
@FXML
void okGoToSpecificTaskScreen(ActionEvent event) {
if (taskSelected != null) {
taskSelected = TypeOfTaskComboBox.valueProperty().get();
switch (taskSelected) {
case singlecopy:
myController.setScreen(ScreenResources.COPY_SCREEN.screenName());
break;
case scheduledcopy:
Dialogs.showWarningDialog(stage,
"This function is not yet implemented. You will be redirected back to the main menu.",
"Warning",
"Function not yet implemented");
myController.setScreen(ScreenResources.MAIN_SCREEN.screenName());
break;
case alarm:
Dialogs.showWarningDialog(stage,
"This function is not yet implemented. You will be redirected back to the main menu.",
"Warning",
"Function not yet implemented");
myController.setScreen(ScreenResources.MAIN_SCREEN.screenName());
break;
default:
LOG.warn("You have to select a type of Task");
break;
}
} else {
Dialogs.showWarningDialog(stage, "You haven\'t selected any Task Type", "Warning", "Task Type not selected!");
}
}
项目:botcoin
文件:DashboardStrategyController.java
public void clearRules(){
Dialogs.DialogResponse response = Dialogs.showConfirmDialog(Global.dashboardStage,
"Are you sure you want to clear "+Global.strategy.getRulesList().size()+" rules?",
"Potential dangerous operation",
"Confirm operation",Dialogs.DialogOptions.YES_NO);
//check confirm dialog
if(response.equals(Dialogs.DialogResponse.YES) || response.equals(Dialogs.DialogResponse.OK) )
{
Global.strategy.deleteAllRules();
Global.strategy.writeStrategyToFile(Settings.STRATEGY_PATH);
}
}
项目:botcoin
文件:NewStoprulePaneController.java
public void addRule()
{
String operation= (String) operationChoice.getSelectionModel().getSelectedItem();
double amount= Double.parseDouble(amountField.getText());
String coin = getSelectedCoin();
String direction= (String) directionChoice.getSelectionModel().getSelectedItem();
double target= Double.parseDouble(thresholdField.getText());
String currency= getSelectedCurrency();
String comment= "";
String executedOrderResponse= "";
boolean active= true ;
boolean executed= false ;
String market = (String) marketChoice.getSelectionModel().getSelectedItem();
Dialogs.DialogResponse response = Dialogs.showConfirmDialog(Global.dashboardStage,
"Are you sure you want to : \n"+
operation+" "+amount+" "+coin+" on "+market+" if price goes "+direction+" "+target+" "+currency,
"Please read it twice!",
"Confirm rule",Dialogs.DialogOptions.YES_NO);
//check confirm dialog
if(response.equals(Dialogs.DialogResponse.YES) || response.equals(Dialogs.DialogResponse.OK) )
{
Global.strategy.addRule(operation, amount,coin, direction, target, currency, comment, executedOrderResponse, active, executed,market);
((DashboardStrategyController) Global.getController(Constant.STRATEGY)).newRuleDialogStage.close();
}
}
项目:botcoin
文件:App.java
private void askForPassword(Stage primaryStage) {
System.out.println("Asking the user to prompt the password");
String passphrase="";
boolean correct = false;
do
{
passphrase = new PassphrasePrompt(true).show(primaryStage);
String passDecrypt = Utils.decode(Settings.PATH_TO_SAVED_PW, passphrase);
correct = !passDecrypt.equals("-1");
if (!correct)
{
System.out.println("Startup : Password incorrect");
Dialogs.showErrorDialog(primaryStage,
"The passphrase is incorrect",
"Error",
"Wrong Passphrase");
}
}
while(!correct);
//Password correct
System.out.println("Startup : Password is correct!");
Global.passphrase=passphrase;
}
项目:javafxstudy
文件:PersonOverviewController.java
@FXML
private void handleDeletePerson() {
int selectedIndex = personTable.getSelectionModel().getSelectedIndex();
if (selectedIndex == -1) {
Dialogs.showWarningDialog(mainApp.getPrimaryStage(), "Please select a person in the table.", "No Person Selected",
"No Selection");
} else {
personTable.getItems().remove(selectedIndex);
}
}
项目:javafxstudy
文件:PersonOverviewController.java
@FXML
private void handleEditPerson() {
Person selectedPerson = personTable.getSelectionModel().getSelectedItem();
if (selectedPerson != null) {
boolean okClicked = mainApp.showPersonEditDialog(selectedPerson);
if (okClicked) {
refreshPersonTable();
showPersonDetails(selectedPerson);
}
} else {
Dialogs.showWarningDialog(mainApp.getPrimaryStage(), "Please select a person in the table.", "No Person Selected",
"No Selection");
}
}
项目:socius
文件:EstadoOnline.java
@Override
public void conectar() {
if (Dialogs.showConfirmDialog(new Stage(), "Você já está conectado!,\n deseja desconectar?").equals("YES")) {
try {
desconectar();
} catch (Exception ex) {
Logger.getLogger(EstadoOnline.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
项目:socius
文件:EstadoOffline.java
@Override
public void desconectar() {
if (Dialogs.showConfirmDialog(new Stage(), "Você não está conectado!.\n deseja Conectar?").equals("YES")) {
ClientBoot redirecionar = new ClientBoot();
redirecionar.telaLogin();
}
}
项目:socius
文件:CadastroController.java
public void salvar() {
try {
Usuario user = new Usuario();
user.setNome(nome.getText() + " " + sobrenome.getText());
user.setLogin(usuario.getText());
if (senha.getText().equals(confirma.getText())) {
user.setSenha(senha.getText());
boolean cadastroRealizado = new CadastroHandler().enviarServidor(user);
if (cadastroRealizado) {
Dialogs.showInformationDialog(new Stage(), "Salvo com sucesso. Você já pode realizar login utilizando as credenciais informadas."
+ "", "Sucesso", "Cadastro");
ClientBoot redirect = new ClientBoot();
redirect.telaLogin();
redirect.start(new Stage());
Stage st = (Stage) senha.getScene().getWindow();
st.close();
} else {
Dialogs.showErrorDialog(new Stage(), "Login informado já em uso. Altere e tente novamente.", "Login já em uso", "Erro");
usuario.requestFocus();
}
} else {
//travar tela de baixo
Dialogs.showErrorDialog(new Stage(), "Senha"
+ " e confirmação estão diferentes.", "Erro", "Erro");
clear();
}
} catch (Exception ex) {
Logger.getLogger(CadastroController.class.getName()).log(Level.SEVERE, null, ex);
}
}
项目:socius
文件:CadastroController.java
@FXML
public void okAction(ActionEvent e) {
if (!(nome.getText().isEmpty() || sobrenome.getText().isEmpty()
&& senha.getText().isEmpty() && confirma.getText().isEmpty())) {
salvar();
} else {
Dialogs.showErrorDialog(new Stage(), "É necessario preencher todos"
+ " os campos. Verifique e tente novamente.", "Erro", "Erro");
}
}
项目:socius
文件:PrincipalController.java
@FXML
public void download(ActionEvent e) throws RemoteException, IOException {
if (lista_arquivos.getSelectionModel().getSelectedItem() != null) {
Arquivo arq = lista_arquivos.getSelectionModel().getSelectedItem().getArquivo();
Download down = new Download(DadosGlobais.getInstance().getComputador().getServidorConectado(),
lista_computadores.getSelectionModel().getSelectedItem().getComputador(), arq, this);
//abrir pegando o controller
FXMLLoader loader = new FXMLLoader(getClass().getResource("/socius/telas/statusdownload/statusdownload.fxml"));
Parent root = (Parent) loader.load();
Stage stage = new Stage();
// Repassa download para a própria tela se atualizar
StatusDownloadController sdc = loader.getController();
sdc.setRequiredData(stage, down, this);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setResizable(false);
// Mostra a tela
stage.show();
//inicia download
down.iniciar();
} else {
Dialogs.showInformationDialog(new Stage(), "Selecione um arquivo primeiro", "Download", "Download");
}
}
项目:socius
文件:PrincipalController.java
@FXML
public void tornarPrivado(ActionEvent e) throws IOException {
//peguar remover arquivo da pasta compartilhada
//falta bloquear arquivo quando alguem estiver efetuando download
if (meus_arquivos.getSelectionModel().getSelectedItem() != null) {
Files.deleteIfExists(new File(socius + System.getProperty("file.separator")
+ meus_arquivos.getSelectionModel().getSelectedItem().getArquivo().getFile().getName()).toPath());
Dialogs.showInformationDialog(new Stage(), "O arquivo de nome:"
+ "" + meus_arquivos.getSelectionModel().getSelectedItem().getArquivo().getFile().getName() + "não está mais público");
//atualizar listas
atualizaListaMeusArquivos();
} else {
Dialogs.showInformationDialog(new Stage(), "Selecione um arquivo, nenhum arquivo foi selecionado!");
}
}
项目:botcoin
文件:DashboardStrategyController.java
public void newRule()
{
if (Global.MtgoxMarket.isKeysValid() ||
Global.BtceMarket.isKeysValid() ||
Global.BitstampMarket.isKeysValid())
{
URL location = NewRuleDialogController.class.getResource("NewRuleDialog.fxml");
newRuleDialogController = new FXMLLoader();
newRuleDialogController.setLocation(location);
newRuleDialogController.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = null;
try {
root = (Parent) newRuleDialogController.load(location.openStream());
}
catch (IOException ex) {
Logger.getLogger(NewRuleDialogController.class.getName()).log(Level.SEVERE, null, ex);
}
newRuleDialogStage = new Stage();
newRuleDialogStage.setTitle("Strategy configuration | Add rule");
newRuleDialogStage.setScene(new Scene(root, 745, 300));
newRuleDialogStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Utils.log("New rule dialog closed",Utils.LOG_LOW);
}
});
newRuleDialogStage.show();
}
else
{
Dialogs.showInformationDialog(Global.dashboardStage,
"Before adding a rule you should setup some api keys.",
"The bot does not work without API access",
"Add API keys before");
}
}
项目:botcoin
文件:DashboardOptionsController.java
public void checkUpdates()
{
Dialogs.showInformationDialog(Global.dashboardStage,
"Your version is TODO. Check latest version at http://botcoin.io/upgrade" );//TODO
}
项目:botcoin
文件:PassphrasePrompt.java
public String show(Stage stage) {
GridPane grid = new GridPane();
myStage = stage;
//myStage.getScene().getStylesheets().add(Settings.CSS_FILE_PATH);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(0, 10, 0, 10));
passphraseEnterField_ = new PasswordField(); passphraseEnterField_.setPromptText("Insert your encription passphrase");
//TODO add an Icon here
double minWidth = 700;
passphraseEnterField_.setMinWidth(minWidth);
String label = "";
if (isFirstTime)
label= "Passphrase";
else
label = "Current passphrase";
grid.add(new Label(label), 0, 0);
grid.add(passphraseEnterField_, 0, 1);
Callback<Void, Void> myCallback = new Callback<Void, Void>() {
@Override
public Void call(Void param) {
//maybe TODO
return null;
}
};
String message = "";
if (isFirstTime)
message= "Please insert the passphrase to decrypt your data\n";
else
message = "Please insert the old passphrase";
Dialogs.DialogResponse resp = Dialogs.showCustomDialog(myStage,
grid,
message,
"The bot needs a passphrase",
Dialogs.DialogOptions.OK_CANCEL,
myCallback);
if (resp == resp.CLOSED || resp == resp.CANCEL)
{
if(isFirstTime)
{
Dialogs.showErrorDialog(myStage,
"To run the bot you need to enter the passphrase",
"Missimg passphrase",
"Error");
Utils.log("To run the bot you need to enter the passphrase ",Utils.LOG_ERR);
System.exit(0);
}
else
{
}
}
//You must check the resp, since input fields' texts are returned regardless of what button was pressed.
//(ie. If user clicked 'Cancel' disregard the input)
return passphraseEnterField_.getText();
}
项目:javafxstudy
文件:PersonEditDialogController.java
private boolean isInputValid() {
String errorMessage = "";
if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {
errorMessage += "No valid first name!\n";
}
if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {
errorMessage += "No valid last name!\n";
}
if (streetField.getText() == null || streetField.getText().length() == 0) {
errorMessage += "No valid street!\n";
}
if (postalCodeField.getText() == null || postalCodeField.getText().length() == 0) {
errorMessage += "No valid postal code!\n";
} else {
// try to parse the postal code into an int
try {
Integer.parseInt(postalCodeField.getText());
} catch (NumberFormatException e) {
errorMessage += "No valid postal code (must be an integer)!\n";
}
}
if (cityField.getText() == null || cityField.getText().length() == 0) {
errorMessage += "No valid city!\n";
}
if (birthdayField.getText() == null || birthdayField.getText().length() == 0) {
errorMessage += "No valid birthday!\n";
} else {
if (!CalendarUtil.validString(birthdayField.getText())) {
errorMessage += "No valid birthday. Use the format yyyy-mm-dd!\n";
}
}
if (errorMessage.length() == 0) {
return true;
} else {
// Show the error message
Dialogs.showErrorDialog(dialogStage, errorMessage, "Please correct invalid fields", "Invalid Fields");
return false;
}
}
项目:socius
文件:SistemaOperacionalNaoSuportadoException.java
@Override
public void exibeMensagem() {
// Dialogs.showErrorDialog(ManterStage.getInstance().getStage(), SistemaOperacionalNaoSuportadoException.super.getMessage(),"Erro",SistemaOperacionalNaoSuportadoException.super.getLocalizedMessage());
Dialogs.showErrorDialog(new Stage(), SistemaOperacionalNaoSuportadoException.super.getMessage(),"Erro",SistemaOperacionalNaoSuportadoException.super.getLocalizedMessage());
}
项目:socius
文件:UsuarioInvalidoException.java
@Override
public void exibeMensagem() {
// Dialogs.showErrorDialog(ManterStage.getInstance().getStage(), UsuarioInvalidoException.super.getMessage(),"Erro",UsuarioInvalidoException.super.getLocalizedMessage());
Dialogs.showErrorDialog(new Stage(), UsuarioInvalidoException.super.getMessage(),"Erro",UsuarioInvalidoException.super.getLocalizedMessage());
}
项目:socius
文件:FalhaNaTransferenciaException.java
@Override
public void exibeMensagem() {
Dialogs.showErrorDialog(new Stage(),FalhaNaTransferenciaException.super.getMessage(),
FalhaNaTransferenciaException.super.getLocalizedMessage());
}
项目:socius
文件:FalhaNaConexaoComServidorException.java
@Override
public void exibeMensagem() {
// Dialogs.showErrorDialog(ManterStage.getInstance().getStage(), FalhaNaConexaoComServidorException.super.getMessage(),"Erro",FalhaNaConexaoComServidorException.super.getLocalizedMessage());
Dialogs.showErrorDialog(new Stage(), FalhaNaConexaoComServidorException.super.getMessage(),"Erro",FalhaNaConexaoComServidorException.super.getLocalizedMessage());
}
项目:socius
文件:ComputadorNaoConectadoException.java
@Override
public void exibeMensagem() {
// Dialogs.showErrorDialog(ManterStage.getInstance().getStage(), ComputadorNaoConectadoException.super.getMessage(),"Erro",ComputadorNaoConectadoException.super.getLocalizedMessage());
Dialogs.showErrorDialog(new Stage(), ComputadorNaoConectadoException.super.getMessage(),"Erro",ComputadorNaoConectadoException.super.getLocalizedMessage());
}
项目:socius
文件:UsuarioJaLogadoException.java
@Override
public void exibeMensagem() {
// Dialogs.showErrorDialog(ManterStage.getInstance().getStage(), FalhaNaConexaoComServidorException.super.getMessage(),"Erro",FalhaNaConexaoComServidorException.super.getLocalizedMessage());
Dialogs.showErrorDialog(new Stage(), UsuarioJaLogadoException.super.getMessage(),"Erro","Erro");
}
项目:botcoin
文件:DashboardStrategyController.java
public void exportStrategy()
{
Dialogs.showInformationDialog(Global.dashboardStage,
"The strategy is saved on your local disk : "+ Settings.STRATEGY_PATH );
}