Hello Gerd,
thanks for including it together with the dialog changes.
Andr=E9=20
> -----Original Message-----
> From: Gerd Wagner [mailto:bir...@t-...]=20
> Sent: Saturday, June 23, 2007 3:09 PM
> To: tmuerell; Andre Schild; squ...@li...
> Subject: Re: [Squirrel-sql-develop] Fileencoding in CSV export
>=20
> Hi Thorsten,
>=20
> thanks for your work quoted below. This should solve Andre=20
> Schild's request=20
> about Fileencoding in CSV export.
>=20
> In case you and Andre already talked about it, excuse me for=20
> being gabby.
>=20
> Gerd
>=20
> tmuerell wrote:
> > Update of=20
> /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sq
> l/fw/gui/action
> > In directory=20
> sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24423/fw/src/net/sour
> ceforge/squirrel_sql/fw/gui/action
> >=20
> > Modified Files:
> > TableExportCsvDlg.java TableExportCsvController.java=20
> > I18NStrings.properties TableExportCsvCommand.java=20
> > Log Message:
> > Added the ability to choose the csv export file encoding.
> >=20
> > Index: TableExportCsvController.java
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file:=20
> /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sq
> l/fw/gui/action/TableExportCsvController.java,v
> > retrieving revision 1.9
> > retrieving revision 1.10
> > diff -C2 -d -r1.9 -r1.10
> > *** TableExportCsvController.java 13 Dec 2006 22:24:23=20
> -0000 1.9
> > --- TableExportCsvController.java 22 Jun 2007 17:39:38=20
> -0000 1.10
> > ***************
> > *** 7,10 ****
> > --- 7,12 ----
> > import javax.swing.*;
> > import java.io.File;
> > + import java.nio.charset.Charset;
> > + import java.nio.charset.IllegalCharsetNameException;
> > import java.awt.event.*;
> > import java.awt.*;
> > ***************
> > *** 14,17 ****
> > --- 16,20 ----
> > {
> > private static final String PREF_KEY_CSV_FILE =3D=20
> "SquirrelSQL.csvexport.csvfile";
> > + private static final String PREF_KEY_CSV_ENCODING =3D=20
> "SquirrelSQL.csvexport.csvencoding";
> > private static final String PREF_KEY_WITH_HEADERS =3D=20
> "SquirrelSQL.csvexport.withColumnHeaders";
> > private static final String PREF_KEY_SEPERATOR_TAB =3D=20
> "SquirrelSQL.csvexport.sepearatorTab";
> > ***************
> > *** 156,159 ****
> > --- 159,164 ----
> > _dlg.chkSeparatorTab.setEnabled(true);
> > _dlg.txtSeparatorChar.setEnabled(true);
> > + _dlg.lblCharset.setEnabled(true);
> > + _dlg.charsets.setEnabled(true);
> > =20
> > if(_dlg.chkSeparatorTab.isSelected())
> > ***************
> > *** 177,182 ****
> > --- 182,189 ----
> > {
> > _dlg.lblSeparator.setEnabled(false);
> > + _dlg.lblCharset.setEnabled(false);
> > _dlg.chkSeparatorTab.setEnabled(false);
> > _dlg.txtSeparatorChar.setEnabled(false);
> > + _dlg.charsets.setEnabled(false);
> > if(replaceEnding)
> > {
> > ***************
> > *** 355,358 ****
> > --- 362,366 ----
> > {
> > Preferences.userRoot().put(PREF_KEY_CSV_FILE,=20
> _dlg.txtFile.getText());
> > + Preferences.userRoot().put(PREF_KEY_CSV_ENCODING,=20
> _dlg.charsets.getSelectedItem().toString());
> > =20
> Preferences.userRoot().putBoolean(PREF_KEY_WITH_HEADERS,=20
> _dlg.chkWithHeaders.isSelected());
> > =20
> Preferences.userRoot().putBoolean(PREF_KEY_FORMAT_CSV,=20
> _dlg.radFormatCSV.isSelected());
> > ***************
> > *** 370,373 ****
> > --- 378,382 ----
> > {
> > =20
> _dlg.txtFile.setText(Preferences.userRoot().get(PREF_KEY_CSV_F
> ILE, null));
> > + =20
> _dlg.charsets.setSelectedItem(Preferences.userRoot().get(PREF_
> KEY_CSV_ENCODING, Charset.defaultCharset().name()));
> > =20
> _dlg.chkWithHeaders.setSelected(Preferences.userRoot().getBool
> ean(PREF_KEY_WITH_HEADERS, true));
> > =20
> > ***************
> > *** 473,476 ****
> > --- 482,493 ----
> > }
> > }
> > + =20
> > + Charset getCSVCharset() {
> > + try {
> > + return=20
> Charset.forName(_dlg.charsets.getSelectedItem().toString());
> > + } catch (IllegalCharsetNameException icne) {
> > + return Charset.defaultCharset();
> > + }
> > + }
> > =20
> > boolean includeHeaders()
> >=20
> > Index: TableExportCsvCommand.java
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file:=20
> /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sq
> l/fw/gui/action/TableExportCsvCommand.java,v
> > retrieving revision 1.13
> > retrieving revision 1.14
> > diff -C2 -d -r1.13 -r1.14
> > *** TableExportCsvCommand.java 21 Mar 2007 09:48:46=20
> -0000 1.13
> > --- TableExportCsvCommand.java 22 Jun 2007 17:39:38=20
> -0000 1.14
> > ***************
> > *** 3,8 ****
> > --- 3,11 ----
> > import java.io.BufferedWriter;
> > import java.io.File;
> > + import java.io.FileOutputStream;
> > import java.io.FileWriter;
> > import java.io.IOException;
> > + import java.io.OutputStream;
> > + import java.io.OutputStreamWriter;
> > import java.sql.Types;
> > import java.util.Calendar;
> > ***************
> > *** 378,383 ****
> > throws IOException
> > {
> > ! FileWriter fw =3D new FileWriter(file);
> > ! BufferedWriter bw =3D new BufferedWriter(fw);
> > =20
> > String separator =3D ctrl.getSeparatorChar();
> > --- 381,385 ----
> > throws IOException
> > {
> > ! BufferedWriter bw =3D new BufferedWriter(new=20
> OutputStreamWriter(new FileOutputStream(file), ctrl.getCSVCharset()));
> > =20
> > String separator =3D ctrl.getSeparatorChar();
> > ***************
> > *** 433,439 ****
> > =20
> > bw.flush();
> > - fw.flush();
> > bw.close();
> > - fw.close();
> > =20
> > return true;
> > --- 435,439 ----
> >=20
> > Index: I18NStrings.properties
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file:=20
> /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sq
> l/fw/gui/action/I18NStrings.properties,v
> > retrieving revision 1.10
> > retrieving revision 1.11
> > diff -C2 -d -r1.10 -r1.11
> > *** I18NStrings.properties 17 Mar 2007 23:53:35 -0000 1.10
> > --- I18NStrings.properties 22 Jun 2007 17:39:38 -0000 1.11
> > ***************
> > *** 14,17 ****
> > --- 14,18 ----
> > TableExportCsvDlg.exportCsvFile=3DExport to file:
> > TableExportCsvDlg.separator=3DSeparator:
> > + TableExportCsvDlg.charset=3DCharset:
> > TableExportCsvDlg.exportCompleteTable=3DExport complete table
> > TableExportCsvDlg.exportSelection=3DExport selection
> >=20
> > Index: TableExportCsvDlg.java
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file:=20
> /cvsroot/squirrel-sql/sql12/fw/src/net/sourceforge/squirrel_sq
> l/fw/gui/action/TableExportCsvDlg.java,v
> > retrieving revision 1.4
> > retrieving revision 1.5
> > diff -C2 -d -r1.4 -r1.5
> > *** TableExportCsvDlg.java 20 Dec 2006 21:40:28 -0000 1.4
> > --- TableExportCsvDlg.java 22 Jun 2007 17:39:38 -0000 1.5
> > ***************
> > *** 9,12 ****
> > --- 9,13 ----
> > import javax.swing.*;
> > import java.awt.*;
> > + import java.nio.charset.Charset;
> > =20
> > public class TableExportCsvDlg extends JDialog
> > ***************
> > *** 21,24 ****
> > --- 22,26 ----
> > JRadioButton radFormatCSV;
> > JLabel lblSeparator;
> > + JLabel lblCharset;
> > JTextField txtSeparatorChar;
> > JCheckBox chkSeparatorTab;
> > ***************
> > *** 32,35 ****
> > --- 34,38 ----
> > JButton btnOk;
> > JButton btnCancel;
> > + JComboBox charsets;
> > =20
> > public TableExportCsvDlg()
> > ***************
> > *** 231,238 ****
> > ret.add(chkSeparatorTab, gbc);
> > =20
> > -=20
> > gbc =3D new GridBagConstraints(3, 0, 1, 1, 1, 0,=20
> GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new=20
> Insets(0, 0, 0, 0), 0, 0);
> > ret.add(new JPanel(), gbc);
> > =20
> > =20
> > return ret;
> > --- 234,256 ----
> > ret.add(chkSeparatorTab, gbc);
> > =20
> > gbc =3D new GridBagConstraints(3, 0, 1, 1, 1, 0,=20
> GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new=20
> Insets(0, 0, 0, 0), 0, 0);
> > ret.add(new JPanel(), gbc);
> > + =20
> > +=20
> > + charsets =3D new JComboBox();
> > + for (String s : Charset.availableCharsets().keySet()) {
> > + charsets.addItem(s);
> > + }
> > + =20
> > + gbc =3D new GridBagConstraints(0, 1, 2, 1, 0, 0,=20
> GridBagConstraints.WEST, GridBagConstraints.NONE, new=20
> Insets(0, 0, 0, 0), 0, 0);
> > + // i18n[TableExportCsvDlg.charset=3DCharset:]
> > + lblCharset =3D new=20
> JLabel(s_stringMgr.getString("TableExportCsvDlg.charset"));
> > + ret.add(lblCharset, gbc);
> > + =20
> > + gbc =3D new GridBagConstraints(2, 1, 1, 1, 0, 0,=20
> GridBagConstraints.WEST, GridBagConstraints.NONE, new=20
> Insets(0, 0, 0, 0), 0, 0);
> > + ret.add(charsets, gbc);
> > =20
> > + gbc =3D new GridBagConstraints(3, 1, 1, 1, 1, 0,=20
> GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new=20
> Insets(0, 0, 0, 0), 0, 0);
> > + ret.add(new JPanel(), gbc);
> > =20
> > return ret;
> >=20
> >=20
> >=20
> --------------------------------------------------------------
> -----------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Squirrel-sql-commits mailing list
> > Squ...@li...
> > https://lists.sourceforge.net/lists/listinfo/squirrel-sql-commits
> >=20
>=20
>=20
>=20
|