List of usage examples for javafx.scene.control Alert Alert
public Alert(@NamedArg("alertType") AlertType alertType)
From source file:de.rkl.tools.tzconv.TimezoneConverter.java
private void fillFromTemplate(final StringWriter mainAreaWriter, final ZonedDateTime dateTime) { final File templateFileObject = applicationModel.templateFile.getValue(); if (templateFileObject == null) { mainAreaWriter.append(formatConvertedDateTimes(dateTime)); } else {/*from ww w . j ava 2s . c o m*/ try { velocityEngine.evaluate(initVelocityContext(dateTime), mainAreaWriter, templateFileObject.getName(), new FileReader(templateFileObject)); } catch (FileNotFoundException e) { final Alert fileNotFoundAlert = new Alert(Alert.AlertType.ERROR); fileNotFoundAlert.setHeaderText("Template file not found"); fileNotFoundAlert.setContentText(String.valueOf(e)); fileNotFoundAlert.showAndWait(); } } }
From source file:com.helegris.szorengeteg.ui.forms.TopicFormView.java
private void bulkAddAudio() { if (sortedRows.size() > 0) { Stage stage = new Stage(); BulkAddAudioView view = new BulkAddAudioView(sortedRows); stage.setScene(new SceneStyler().createScene(view, SceneStyler.Style.TOPIC_LIST)); stage.setTitle(Messages.msg("form.bulk_add_something", Messages.msg("form.audio"))); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(getScene().getWindow()); stage.showAndWait();//from w ww . ja v a 2 s . co m if (view.isOk()) { view.getFiles().entrySet().stream().forEach((entry) -> { ((RowForCard) sortedRows.get(entry.getKey())).setAudioFile(entry.getValue()); }); view.getAudio().entrySet().stream().forEach((entry) -> { ((RowForCard) sortedRows.get(entry.getKey())).setAudio(entry.getValue()); }); } } else { Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle(Messages.msg("alert.error")); alert.setHeaderText(Messages.msg("alert.no_words_audio")); alert.setContentText(Messages.msg("alert.add_words")); alert.showAndWait(); } }
From source file:main.TestManager.java
/** * Deletes all files on the server and uploads all the * tests from the local directory.//from w w w . j a va 2 s.c o m */ public static void syncServerWithTest() { FTPClient ftp = new FTPClient(); boolean error = false; try { int reply; String server = "zajicek.endora.cz"; ftp.connect(server, 21); // After connection attempt, we check the reply code to verify // success. reply = ftp.getReplyCode(); //Not connected successfully - inform the user if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); Debugger.println("FTP server refused connection."); ErrorInformer.failedSyncing(); return; } // LOGIN boolean success = ftp.login("plakato", "L13nK4"); Debugger.println("Login successful: " + success); if (success == false) { ftp.disconnect(); ErrorInformer.failedSyncing(); return; } ftp.enterLocalPassiveMode(); // Get all files from the server FTPFile[] files = ftp.listFiles(); System.out.println("Got files! Count: " + files.length); // Delete all current tests on the server to be replaced with // actualized version from local directory for (FTPFile f : files) { if (f.getName() == "." || f.getName() == "..") { continue; } if (f.isFile()) { ftp.deleteFile(f.getName()); } } // Copy the files from local folder to server File localFolder = new File("src/tests/"); File[] localFiles = localFolder.listFiles(); int failed = 0; for (File f : localFiles) { if (f.getName() == "." || f.getName() == "..") { continue; } if (f.isFile()) { Debugger.println(f.getName()); File file = new File("src/tests/" + f.getName()); InputStream input = new FileInputStream(file); if (!ftp.storeFile(f.getName(), input)) failed++; input.close(); } } // If we failed to upload some file, inform the user if (failed != 0) { ftp.disconnect(); ErrorInformer.failedSyncing(); return; } // Disconnect ftp client or resolve the potential error ftp.logout(); } catch (IOException e) { error = true; e.printStackTrace(); } finally { if (ftp.isConnected()) { try { ftp.disconnect(); } catch (IOException ioe) { // do nothing } } if (error) { ErrorInformer.failedSyncing(); return; } } Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Upload hotov"); alert.setHeaderText(null); alert.setContentText("spene sa podarilo skoprova vetky testy na server!"); alert.showAndWait(); alert.close(); }
From source file:utilitybasedfx.MainGUIController.java
@FXML private void eventCompileFromSource(ActionEvent event) { // [TODO] use javac to compile from source Alert alert = new Alert(AlertType.ERROR); alert.setTitle("This is not yet implemented"); alert.setHeaderText("in the future pressing this will generate the .class files from the source"); alert.setContentText("but as of now it is not implemented"); alert.showAndWait();// www .j a v a 2s . c om shouldRefreshFileTree = true; }
From source file:staff.cashier.CashierController.java
@FXML private void onClickGetPayment(ActionEvent e) throws SQLException, IOException, ClassNotFoundException, DocumentException, DecoderException { PendingBill currBill = cashierView.getSelectionModel().getSelectedItem(); System.out.println(currBill.getCusName() + " " + currBill.getOrderID() + " " + currBill.getBill()); int orderid = currBill.getOrderID(); int bill_status = 1; Statement st = conn.createStatement(); Statement st1 = conn.createStatement(); Statement st2 = conn.createStatement(); // set bill status 1 in order_info table. String query = "update order_info set bill_paid='" + bill_status + "' where order_id='" + currBill.getOrderID() + "'"; st.executeUpdate(query);// w w w. j a v a 2s .co m // set cus_id=0 in corrosponding table. String query1 = "select * from order_info where order_id='" + currBill.getOrderID() + "'"; ResultSet rs = st1.executeQuery(query1); rs.next(); BigInteger cus_id = new BigInteger(Long.toString(rs.getLong("c_id"))); BigInteger new_cid = BigInteger.ZERO; String query2 = "update table_info set c_id='" + new_cid + "',order_taken=0 where c_id='" + cus_id + "'"; st2.executeUpdate(query2); //deleting the row ObservableList<PendingBill> billSelected, allBill; allBill = cashierView.getItems(); allBill.remove((currBill)); //Inserting into `bill` schema int counter = 0; //fetching the bill_id of the last order query = "select * from bill"; rs = st.executeQuery(query); while (rs.next()) { counter = rs.getInt("bill_id"); } counter++; String query3 = "insert into bill values(" + counter + "," + currBill.bill + ")"; st.executeUpdate(query3); //Updating the bill_generation schema String query4 = "insert into bill_generation values(" + currBill.orderID + ",'" + caid + "'," + counter + ")"; st.executeUpdate(query4); //GENERATING THE BILL IN PDF FORM String query5 = "select * from order_info where order_id=" + orderid + " "; ResultSet rs1 = st.executeQuery(query5); rs1.next(); String itemList = rs1.getString("list"); int tis = rs1.getInt("table_id"); float cc = rs1.getFloat("cost"); //String itemDetails=rs1.getString("item_qty"); int coupon = rs1.getInt("coupon_id"); float disc_p = 0; //FETCHING THE DISCOUNT PERCENT CORRESPONDING TO THAT COUPON if (coupon != 0) { Statement st4 = conn.createStatement(); String q4 = "select discount_percent from coupon where coupon_id=" + coupon; ResultSet rs4 = st4.executeQuery(q4); rs4.next(); disc_p = rs4.getFloat("discount_percent"); } //FETCHING CUSTOMER NAME String query6 = "select * from customer where c_id=" + cus_id + ""; ResultSet rs2 = st.executeQuery(query6); rs2.next(); String cusname = rs2.getString("c_name"); String email = rs2.getString("c_email"); String itemsInfo = ""; /*----------------DESERIALIZATION ByteArrayInputStream in = new ByteArrayInputStream(Hex.decodeHex(itemList.toCharArray())); String[] aa= (String[]) (new ObjectInputStream(in).readObject()); //System.out.println(Arrays.toString(); try{ for (String aa1 : aa) { if(aa1!=null){ int i; String tmp=""; for( i=0;i<(aa1.length()-1);i++) { tmp+=aa1.charAt(i); } int qty=Integer.parseInt(""+aa1.charAt(i)); itemsInfo+="Item name: "+tmp+" Qty:"+qty+"\n\n"; } } } catch(Exception ee){} -----------------------------------------*/ //EXTRACTING INFORMATION ABOUT ORDERED ITEMS String tmp = ""; for (int i = 0; i < (itemList.length() - 1); i++) { if (itemList.charAt(i + 1) == '-') { int qty = Integer.parseInt("" + itemList.charAt(i)); Statement st3 = conn.createStatement(); String q3 = "Select price from menu where d_name='" + tmp + "'"; ResultSet rs3 = st3.executeQuery(q3); rs3.next(); float p = rs3.getFloat("price"); itemsInfo += "Item name:" + tmp + " Qty:" + qty + " Price:+" + p + " Total:" + (qty * p) + "\n\n"; tmp = ""; i++; } else tmp += itemList.charAt(i); } itemsInfo += "Total Cost :" + cc + "\n\n"; if (coupon != 0) { float tprice = cc - ((disc_p * cc) / 100); itemsInfo += "You have been given a discount of " + disc_p + "%\n\nFinal Cost : Rs." + tprice + "\n\n"; } System.out.println("Item info:" + itemsInfo); //WRITING TO PDF Document doc = new Document(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream("Order" + orderid + ".pdf")); doc.open(); doc.addTitle("CENTRICO RESTAURANT"); doc.addCreationDate(); doc.addSubject("BILL"); //System.out.println(itemDetails); doc.add(new Paragraph(" CENTRICO RESTAURANT\n\nORDER ID : " + orderid + "\n\nTABLE ID : " + tis + "\n\nCUSTOMER NAME : " + cusname + "\n\nEMAIL ID : " + email + "\n\n" + itemsInfo + "\n\n")); doc.close(); writer.close(); //SENDING THE BILL IN MAIL TO THE CUSTOMER GmailQuickstart a = new GmailQuickstart(); a.setCusemail(email); a.setCusmessage("Thankyou so much " + cusname + " for coming here.Please visit us again :) \n Please find your bill attached below\n"); a.setCussubject("Bill for order number " + orderid); a.setFileName("Order" + orderid + ".pdf"); Thread t = new Thread(a); t.start(); //alert Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Information dialog"); alert.setHeaderText(null); alert.setContentText(" Payment has Received Successfully"); alert.showAndWait(); }
From source file:de.micromata.mgc.javafx.launcher.gui.AbstractMainWindow.java
@FXML private void openLogLF5(ActionEvent event) { if (MgcLf5Appender.initialized == false) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Log4J Viewer"); alert.setHeaderText("No MgcLf5Appender found"); alert.setContentText(// w w w. j a va2s . c o m "To activate Logs to shown in the LF5 window, you have to register the Appender in the log4j.properties configuration:\n" + "\n" + "Sample:\n" + "log4j.rootCategory=DEBUG, A1, F1, LF5\n" + "...\n" + "log4j.appeender.LF5.Threshold=INFO\r\n" + "log4j.appender.LF5=de.micromata.mgc.javafx.launcher.gui.lf5.MgcLf5Appender"); alert.showAndWait(); } if (Lf5MainWindowController.CONTROLERINSTANCE != null) { Lf5MainWindowController.CONTROLERINSTANCE.show(); return; } Lf5MainWindowController controller = ControllerService.get().loadAsWindow(this, Lf5MainWindowController.class, model, "About"); controller.initializeWithModel(); controller.getStage().show(); }
From source file:uk.co.everywheremusic.viewcontroller.SetupScene.java
private boolean validateForm() { boolean valid = true; String errorMessage = ""; File musicDir = new File(txtFolder.getText()); if (!musicDir.isDirectory()) { valid = false;// ww w . j a va 2 s . co m errorMessage += Globals.SETUP_ERR_INVALID_FOLDER + "\n\n"; } String password = txtPassword.getText(); String confirmPassword = txtConfirmPassword.getText(); if (!password.equals(confirmPassword)) { valid = false; errorMessage += "Passwords do not match\n\n"; } if (password.equals("")) { valid = false; errorMessage += "Enter a password\n\n"; } if (!valid) { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle(Globals.SETUP_ALERT_TITLE); alert.setHeaderText(Globals.SETUP_ALERT_HEADER_TEXT); TextArea text = new TextArea(errorMessage); text.setEditable(false); text.setWrapText(true); GridPane.setVgrow(text, Priority.NEVER); GridPane.setHgrow(text, Priority.NEVER); GridPane content = new GridPane(); content.setMaxWidth(Double.MAX_VALUE); content.add(text, 0, 0); alert.getDialogPane().setContent(content); alert.showAndWait(); } return valid; }
From source file:deincraftlauncher.InstallController.java
private void popupMessage(String text) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText("Benachrichtigung:"); alert.setContentText(text);// w w w .ja v a2 s .c o m alert.initModality(Modality.WINDOW_MODAL); alert.initStyle(StageStyle.UNDECORATED); alert.initOwner(deincraftlauncher.DeincraftLauncherUI.window); alert.show(); }
From source file:net.sourceforge.pmd.util.fxdesigner.MainDesignerController.java
private void showLicensePopup() { Alert licenseAlert = new Alert(AlertType.INFORMATION); licenseAlert.setWidth(500);//w w w . ja v a 2 s .c o m licenseAlert.setHeaderText("License"); ScrollPane scroll = new ScrollPane(); try { scroll.setContent(new TextArea(IOUtils.toString(getClass().getResourceAsStream("LICENSE")))); } catch (IOException e) { e.printStackTrace(); } licenseAlert.getDialogPane().setContent(scroll); licenseAlert.showAndWait(); }
From source file:de.pixida.logtest.designer.automaton.AutomatonEdge.java
@Override ContextMenu createContextMenu() {/*from w w w . j a va 2 s . c o m*/ final ContextMenu cm = new ContextMenu(); final MenuItem mi = new MenuItem("Delete edge"); mi.setGraphic(Icons.getIconGraphics("delete")); mi.setStyle("-fx-text-fill:red"); mi.setOnAction(event -> { final Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Confirm"); alert.setHeaderText("You are about to delete the edge."); alert.setContentText("Do you want to continue?"); alert.showAndWait().filter(response -> response == ButtonType.OK) .ifPresent(response -> this.removeNodeAndEdges()); }); cm.getItems().add(mi); return cm; }