Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/mailtools
In directory sc8-pr-cvs1:/tmp/cvs-serv20310/src/org/tn5250j/mailtools
Modified Files:
SendEMailDialog.java
Log Message:
Update related to Quick email-sending, menu's are added, but we need a
streamlined menuitem that checks the right checkboxes of the
SendEmailDialog module, so this feature is almost completely ready.
Index: SendEMailDialog.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/mailtools/SendEMailDialog.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SendEMailDialog.java 1 Dec 2003 12:26:22 -0000 1.14
--- SendEMailDialog.java 1 Dec 2003 15:18:55 -0000 1.15
***************
*** 32,41 ****
--- 32,45 ----
import java.awt.GridBagConstraints;
import java.awt.Insets;
+ import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.StringTokenizer;
+ import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
+ import javax.swing.JButton;
+ import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
***************
*** 50,53 ****
--- 54,58 ----
import org.tn5250j.Session;
import org.tn5250j.SessionConfig;
+ import org.tn5250j.gui.TN5250jFileChooser;
import org.tn5250j.tools.LangTool;
import org.tn5250j.tools.encoder.EncodeComponent;
***************
*** 70,73 ****
--- 75,80 ----
JRadioButton normal;
JRadioButton screenshot;
+ JButton browse;
+
/**
***************
*** 127,131 ****
if (attachmentName.getText().length() > 0)
! sem.setAttachmentName(attachmentName.getText());
if (text.isSelected()) {
--- 134,139 ----
if (attachmentName.getText().length() > 0)
! //sem.setAttachmentName(attachmentName.getText());
! sem.setAttachmentName(fileName);
if (text.isSelected()) {
***************
*** 169,176 ****
f);
sem.setFileName(f.getName());
! } catch (Exception ex) {
System.out.println(ex.getMessage());
}
!
}
--- 177,189 ----
f);
sem.setFileName(f.getName());
! }
! catch (Exception ex) {
System.out.println(ex.getMessage());
}
!
! }
! else if (attachmentName.getText().length() > 0) {
! File f = new File(attachmentName.getText());
! sem.setFileName(f.toString());
}
***************
*** 398,415 ****
}
gbc = new GridBagConstraints();
gbc.gridx = 0; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(0, 10, 5, 5);
semp.add(tom, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(0, 15, 5, 5);
semp.add(normal, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 2; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(0, 45, 5, 10);
semp.add(screenshot, gbc);
gbc = new GridBagConstraints();
--- 411,436 ----
}
+ browse = new JButton(LangTool.getString("em.choosefile"));
+ browse.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ browse_actionPerformed(e);
+ }
+ });
+
+ semp.setBorder(BorderFactory.createEtchedBorder());
gbc = new GridBagConstraints();
gbc.gridx = 0; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(5, 10, 5, 5);
semp.add(tom, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(5, 15, 5, 5);
semp.add(normal, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 2; gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(5, 45, 5, 10);
semp.add(screenshot, gbc);
gbc = new GridBagConstraints();
***************
*** 472,481 ****
gbc.gridwidth = 2;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(5, 5, 5, 10);
semp.add(attachmentName, gbc);
return semp;
}
private void setAttachmentName() {
--- 493,522 ----
gbc.gridwidth = 2;
gbc.anchor = GridBagConstraints.WEST;
! gbc.insets = new Insets(5, 5, 5, 5);
semp.add(attachmentName, gbc);
+ gbc = new GridBagConstraints();
+ gbc.gridx = 1; gbc.gridy = 8;
+ gbc.gridwidth = 2;
+ gbc.anchor = GridBagConstraints.CENTER;
+ gbc.insets = new Insets(5, 5, 10, 10);
+ semp.add(browse, gbc);
return semp;
}
+
+ private void browse_actionPerformed(ActionEvent e) {
+ String workingDir = System.getProperty("user.dir");
+ TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir);
+
+ int ret = pcFileChooser.showOpenDialog(new JFrame());
+
+ // check to see if something was actually chosen
+ if (ret == JFileChooser.APPROVE_OPTION) {
+ File file = pcFileChooser.getSelectedFile();
+ fileName = file.getName();
+ attachmentName.setText(file.toString());
+ }
+ }
private void setAttachmentName() {
***************
*** 483,494 ****
if (text.isSelected()) {
attachmentName.setText("tn5250j.txt");
-
}
- else if (normal.isSelected()) {
- attachmentName.setText("tn5250j.png");
- }
else {
attachmentName.setText("tn5250j.png");
}
}
--- 524,532 ----
if (text.isSelected()) {
attachmentName.setText("tn5250j.txt");
}
else {
attachmentName.setText("tn5250j.png");
}
+ browse.setEnabled(false);
}
***************
*** 498,501 ****
--- 536,540 ----
graphic.setEnabled(false);
attachmentName.setText("");
+ browse.setEnabled(true);
}
else {
***************
*** 504,507 ****
--- 543,547 ----
text.setSelected(true);
setAttachmentName();
+ browse.setEnabled(false);
}
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.