tflFiles.commit(); tflNumbers.commit();
        public void actionPerformed(ActionEvent e) {                        if (!pollMode && tflFiles.model.size() == 0) {                if (checkUseCover.isSelected()) {                    if (JOptionPane.showConfirmDialog(SendWin.this, _("You haven't selected a file to transmit, so your fax will ONLY contain the cover page.\nContinue anyway?"), _("Continue?"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION)                        return;                } else {                    JOptionPane.showMessageDialog(SendWin.this, _("To send a fax you must select at least one file!"), _("Warning"), JOptionPane.INFORMATION_MESSAGE);                    return;                }            }                        if (tflNumbers.model.size() == 0) {                JOptionPane.showMessageDialog(SendWin.this, _("To send a fax you have to enter at least one phone number!"), _("Warning"), JOptionPane.INFORMATION_MESSAGE);                return;            }                        try {                        File coverFile = null;                FaxOptions fo = utils.getFaxOptions();                                                    if (!pollMode) {                    Faxcover cov = null;                    if (checkUseCover.isSelected()) {                        cov = new Faxcover();                        cov.pageCount = 0;                    }                                        if (checkUseCover.isSelected()) {                        if (checkCustomCover.isSelected()) {                            if (!(new File(ftfCustomCover.getText()).canRead())) {                                JOptionPane.showMessageDialog(SendWin.this, MessageFormat.format(_("Can not read file \"{0}\"!"), ftfCustomCover.getText()), _("Error"), JOptionPane.WARNING_MESSAGE);                                return;                            }                        } else if (fo.useCustomDefaultCover) {                            if (!(new File(fo.defaultCover).canRead())) {                                JOptionPane.showMessageDialog(SendWin.this, MessageFormat.format(_("Can not read default cover page file \"{0}\"!"), fo.defaultCover), _("Error"), JOptionPane.WARNING_MESSAGE);                                return;                            }                        }                    }                                        hyfc.type(HylaFAXClient.TYPE_IMAGE);                                        for (int i = 0; i < tflFiles.model.size(); i++) {                        HylaTFLItem item = (HylaTFLItem)tflFiles.model.get(i);                        item.upload(hyfc);                                                if (cov != null) {                            InputStream strIn = item.getInputStream();                            if (strIn != null)                                // Try to get page count                                 cov.estimatePostscriptPages(strIn);                        }                    }                                        // Create cover                    if (cov != null) {                                                cov.fromCompany = fo.FromCompany;                        cov.fromFaxNumber = fo.FromFaxNumber;                        cov.fromLocation = fo.FromLocation;                        cov.fromVoiceNumber = fo.FromVoiceNumber;                        cov.sender = fo.FromName;                                                cov.comments = textToComments.getText();                        cov.regarding = textSubject.getText();                        cov.toCompany = textToCompany.getText();                        cov.toFaxNumber = TextNumber.getText();                        cov.toLocation = textToLocation.getText();                        cov.toName = textToName.getText();                        cov.toVoiceNumber = textToVoiceNumber.getText();                                                cov.setPageSize(((PaperSize)ComboPaperSize.getSelectedItem()).size);                                                                        if (checkCustomCover.isSelected())                            cov.coverTemplate = new File(ftfCustomCover.getText());                        else if (fo.useCustomDefaultCover)                            cov.coverTemplate = new File(fo.defaultCover);                                                // Create cover:                        coverFile = File.createTempFile("cover", ".tmp");                        coverFile.deleteOnExit();                        FileOutputStream fout = new FileOutputStream(coverFile);                        cov.makeCoverSheet(fout);                        fout.close();                                           }                }                                            for (int i = 0; i < tflNumbers.model.size(); i++) {                    String number = tflNumbers.model.get(i).toString();                                        try {                        String coverName = null;                        if (coverFile != null) {                            FileInputStream fi = new FileInputStream(coverFile);                            coverName = hyfc.putTemporary(fi);                            fi.close();                        }                                                Job j = hyfc.createJob();                                                j.setFromUser(fo.user);                        j.setNotifyAddress(fo.notifyAddress);                        j.setMaximumDials(fo.maxDial);                                                j.setDialstring(number);                        j.setMaximumTries(((Integer)SpinMaxTries.getValue()).intValue());                        j.setNotifyType(((FaxStringProperty)ComboNotification.getSelectedItem()).type);                        j.setPageDimension(((PaperSize)ComboPaperSize.getSelectedItem()).size);                        j.setVerticalResolution(((FaxIntProperty)ComboResolution.getSelectedItem()).type);                        j.setKilltime(utils.minutesToHylaTime(((Integer)SpinKillTime.getValue()).intValue()));                                                  if (pollMode)                             j.setProperty("POLL", "\"\" \"\"");                        else {                                           if (coverName != null)                                j.setProperty("COVER", coverName);                                                        for (int k = 0; k < tflFiles.model.size(); k++) {                                HylaTFLItem item = (HylaTFLItem)tflFiles.model.get(k);                                j.addDocument(item.getServerName());                                                    }                                                        fo.useCover = checkUseCover.isSelected();                            fo.useCustomCover = checkCustomCover.isSelected();                            fo.CustomCover = ftfCustomCover.getText();                        }                                                hyfc.submit(j);                       } catch (Exception e1) {                        //JOptionPane.showMessageDialog(ButtonSend, MessageFormat.format(_("An error occured while submitting the fax job for phone number \"{0}\" (will try to submit the fax to the other numbers anyway): "), number) + "\n" + e1.getLocalizedMessage(), _("Error"), JOptionPane.ERROR_MESSAGE);                        ExceptionDialog.showExceptionDialog(SendWin.this, MessageFormat.format(_("An error occured while submitting the fax job for phone number \"{0}\" (will try to submit the fax to the other numbers anyway): "), number) , e1);                    }                }                                for (int i = 0; i < tflFiles.model.size(); i++) {                    HylaTFLItem item = (HylaTFLItem)tflFiles.model.get(i);                    item.cleanup();                }                if (coverFile != null)                    coverFile.delete();                                dispose();            } catch (Exception e1) {                //JOptionPane.showMessageDialog(ButtonSend, _("An error occured while submitting the fax: ") + "\n" + e1.getLocalizedMessage(), _("Error"), JOptionPane.ERROR_MESSAGE);                ExceptionDialog.showExceptionDialog(SendWin.this, _("An error occured while submitting the fax: "), e1);            }        }