~vcs-imports/jhylafax/head

« back to all changes in this revision

Viewing changes to src/java/net/sf/jhylafax/SendDialog.java

  • Committer: squig
  • Date: 2005-04-18 16:37:19 UTC
  • Revision ID: Arch-1:unnamed@bazaar.ubuntu.com%series--4272--patch-10
added i18n support and password querying

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
public class SendDialog extends AbstractFaxDialog {
45
45
 
46
46
        private final static Log logger = LogFactory.getLog(QueuePanel.class);
47
 
        private static final int DEFAULT_COLUMNS = 20;
48
 
        
49
 
        private JTextField numberTextField;
50
 
        private JLabel numberLabel;
 
47
 
51
48
        private JTextField documentTextField;
52
49
        private JLabel documentLabel;
53
50
        private FileDialogAction fileDialogAction;
54
51
        
55
52
        public SendDialog() {
56
 
                numberTextField = new JTextField();
57
 
                numberLabel = builder.append("", numberTextField, 6);
58
 
                builder.nextLine();
59
 
 
 
53
                addNumberTextField();
 
54
                
60
55
                documentTextField = new JTextField();
61
56
                documentLabel = builder.append("", documentTextField, 4);
62
57
                fileDialogAction = new FileDialogAction();              
63
58
                builder.append(fileDialogAction.createIconButton());
64
59
                builder.nextLine();
65
60
 
66
 
                addDateButtons();
 
61
                addDateControls();
67
62
                
68
63
                HylaFAXJob job = new HylaFAXJob(); 
69
64
                HylaFAXClientHelper.initializeFromSettings(job);
75
70
        
76
71
        @Override
77
72
        public boolean apply() {
78
 
                getJob().setNumber(numberTextField.getText());
 
73
                if (!super.apply()) {
 
74
                        return false;
 
75
                }
79
76
                final File file = new File(documentTextField.getText()); 
80
77
                        
81
78
                Job<?> ioJob = new Job() {
84
81
                        {
85
82
                                monitor.setTotalSteps(7);
86
83
                                
87
 
                                HylaFAXClient client = JHylaFAX.getInstance().getConnection();
 
84
                                HylaFAXClient client = JHylaFAX.getInstance().getConnection(monitor);
88
85
                                monitor.work(1);
89
86
                                
90
87
                                client.mode(HylaFAXClient.MODE_STREAM);
128
125
                
129
126
                try {
130
127
                        JHylaFAX.getInstance().runJob(ioJob);
 
128
                } 
 
129
                catch (UserAbortException e) {
 
130
                        return false;
131
131
                }
132
132
                catch (Exception e) {
133
133
                        logger.debug("Error sending fax", e);
134
 
                        ErrorDialog.show(this, I18n.tr("Error sending fax"), e.getLocalizedMessage(), e);
 
134
                        ErrorDialog.showError(this, I18n.tr("Could not send fax"), 
 
135
                                        I18n.tr("JHylaFAX Error"),
 
136
                                        e);
135
137
                        return false;
136
138
                }
137
139
                return true;
141
143
                super.updateLabels();
142
144
 
143
145
                setTitle(I18n.tr("Send Fax"));
144
 
                numberLabel.setText(I18n.tr("Number"));
145
146
                documentLabel.setText(I18n.tr("Document"));
146
147
        }
147
148