Line 33... |
Line 33... |
33 |
import org.openconcerto.erp.preferences.GestionClientPreferencePanel;
|
33 |
import org.openconcerto.erp.preferences.GestionClientPreferencePanel;
|
34 |
import org.openconcerto.erp.rights.GroupUIComboRightEditor;
|
34 |
import org.openconcerto.erp.rights.GroupUIComboRightEditor;
|
35 |
import org.openconcerto.erp.rights.MenuComboRightEditor;
|
35 |
import org.openconcerto.erp.rights.MenuComboRightEditor;
|
36 |
import org.openconcerto.erp.utils.NXDatabaseAccessor;
|
36 |
import org.openconcerto.erp.utils.NXDatabaseAccessor;
|
37 |
import org.openconcerto.map.model.Ville;
|
37 |
import org.openconcerto.map.model.Ville;
|
- |
|
38 |
import org.openconcerto.sql.Configuration;
|
- |
|
39 |
import org.openconcerto.sql.PropsConfiguration;
|
- |
|
40 |
import org.openconcerto.sql.TM;
|
38 |
import org.openconcerto.sql.element.SQLElement;
|
41 |
import org.openconcerto.sql.element.SQLElement;
|
39 |
import org.openconcerto.sql.model.SQLBackgroundTableCache;
|
42 |
import org.openconcerto.sql.model.SQLBackgroundTableCache;
|
40 |
import org.openconcerto.sql.model.SQLBase;
|
43 |
import org.openconcerto.sql.model.SQLBase;
|
41 |
import org.openconcerto.sql.model.SQLRow;
|
44 |
import org.openconcerto.sql.model.SQLRow;
|
42 |
import org.openconcerto.sql.model.SQLRowListRSH;
|
45 |
import org.openconcerto.sql.model.SQLRowListRSH;
|
Line 62... |
Line 65... |
62 |
import org.openconcerto.ui.component.MutableListComboPopupListener;
|
65 |
import org.openconcerto.ui.component.MutableListComboPopupListener;
|
63 |
import org.openconcerto.ui.preferences.EmailProps;
|
66 |
import org.openconcerto.ui.preferences.EmailProps;
|
64 |
import org.openconcerto.utils.ExceptionHandler;
|
67 |
import org.openconcerto.utils.ExceptionHandler;
|
65 |
import org.openconcerto.utils.JImage;
|
68 |
import org.openconcerto.utils.JImage;
|
66 |
import org.openconcerto.utils.cc.IClosure;
|
69 |
import org.openconcerto.utils.cc.IClosure;
|
- |
|
70 |
import org.openconcerto.utils.i18n.TranslationManager;
|
67 |
|
71 |
|
68 |
import java.awt.Color;
|
72 |
import java.awt.Color;
|
69 |
import java.awt.GridBagConstraints;
|
73 |
import java.awt.GridBagConstraints;
|
70 |
import java.awt.GridBagLayout;
|
74 |
import java.awt.GridBagLayout;
|
71 |
import java.awt.Image;
|
75 |
import java.awt.Image;
|
Line 79... |
Line 83... |
79 |
import java.util.concurrent.CountDownLatch;
|
83 |
import java.util.concurrent.CountDownLatch;
|
80 |
import java.util.concurrent.FutureTask;
|
84 |
import java.util.concurrent.FutureTask;
|
81 |
import java.util.logging.Level;
|
85 |
import java.util.logging.Level;
|
82 |
|
86 |
|
83 |
import javax.swing.Action;
|
87 |
import javax.swing.Action;
|
- |
|
88 |
import javax.swing.JComponent;
|
84 |
import javax.swing.JFrame;
|
89 |
import javax.swing.JFrame;
|
85 |
import javax.swing.JOptionPane;
|
90 |
import javax.swing.JOptionPane;
|
86 |
import javax.swing.JPanel;
|
91 |
import javax.swing.JPanel;
|
87 |
import javax.swing.JTextArea;
|
92 |
import javax.swing.JTextArea;
|
88 |
import javax.swing.SwingUtilities;
|
93 |
import javax.swing.SwingUtilities;
|
Line 201... |
Line 206... |
201 |
final MainFrame f = new MainFrame(comptaPropsConfiguration);
|
206 |
final MainFrame f = new MainFrame(comptaPropsConfiguration);
|
202 |
String version = comptaPropsConfiguration.getVersion();
|
207 |
String version = comptaPropsConfiguration.getVersion();
|
203 |
final String socTitle = comptaPropsConfiguration.getRowSociete() == null ? "" : ", [Société " + comptaPropsConfiguration.getRowSociete().getString("NOM") + "]";
|
208 |
final String socTitle = comptaPropsConfiguration.getRowSociete() == null ? "" : ", [Société " + comptaPropsConfiguration.getRowSociete().getString("NOM") + "]";
|
204 |
f.setTitle(comptaPropsConfiguration.getAppName() + " " + version + socTitle);
|
209 |
f.setTitle(comptaPropsConfiguration.getAppName() + " " + version + socTitle);
|
205 |
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
210 |
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
- |
|
211 |
|
206 |
}
|
212 |
}
|
207 |
});
|
213 |
});
|
208 |
final FutureTask<?> showMainFrame = new FutureTask<Object>(new Runnable() {
|
214 |
final FutureTask<?> showMainFrame = new FutureTask<Object>(new Runnable() {
|
209 |
@Override
|
215 |
@Override
|
210 |
public void run() {
|
216 |
public void run() {
|
Line 273... |
Line 279... |
273 |
c.weighty = 1;
|
279 |
c.weighty = 1;
|
274 |
c.insets = new Insets(0, 0, 0, 0);
|
280 |
c.insets = new Insets(0, 0, 0, 0);
|
275 |
c.fill = GridBagConstraints.BOTH;
|
281 |
c.fill = GridBagConstraints.BOTH;
|
276 |
|
282 |
|
277 |
this.connexionPanel = ConnexionPanel.create(r, image, !Gestion.isMinimalMode());
|
283 |
this.connexionPanel = ConnexionPanel.create(r, image, !Gestion.isMinimalMode());
|
- |
|
284 |
final List<Locale> langs = Arrays.asList(Locale.FRANCE, Locale.CANADA_FRENCH, new Locale("fr", "CH"), new Locale("fr", "BE"), Locale.UK, Locale.CANADA, Locale.US, Locale.GERMANY,
|
- |
|
285 |
new Locale("de", "CH"), new Locale("es", "ES"), new Locale("pl", "PL"));
|
278 |
if (this.connexionPanel == null)
|
286 |
if (this.connexionPanel == null) {
|
- |
|
287 |
final Locale locale = UserProps.getInstance().getLocale();
|
- |
|
288 |
// for next launch
|
- |
|
289 |
UserProps.getInstance().setLocale(locale);
|
- |
|
290 |
// for current run
|
- |
|
291 |
((PropsConfiguration) Configuration.getInstance()).setLocale(locale);
|
- |
|
292 |
// for code that will never need more than one Locale concurrently
|
- |
|
293 |
// (e.g. used by TM singletons in various packages)
|
- |
|
294 |
Locale.setDefault(locale);
|
- |
|
295 |
// as explained in Locale.setDefault() javadoc : "be prepared to reinitialize
|
- |
|
296 |
// locale-sensitive code"
|
- |
|
297 |
JComponent.setDefaultLocale(locale);
|
- |
|
298 |
// throw RuntimeException like ResourceBundle.getBundle() at the beginning of this
|
- |
|
299 |
// method
|
- |
|
300 |
TranslationManager.createDefaultInstance();
|
- |
|
301 |
TM.getInstance();
|
279 |
return null;
|
302 |
return null;
|
280 |
this.connexionPanel.initLocalization(getClass().getName(), Arrays.asList(Locale.FRANCE, Locale.CANADA_FRENCH, new Locale("fr", "CH"), new Locale("fr", "BE"), Locale.UK, Locale.CANADA,
|
- |
|
- |
|
303 |
}
|
- |
|
304 |
|
281 |
Locale.US, Locale.GERMANY, new Locale("de", "CH"), new Locale("es", "ES"), new Locale("pl", "PL")));
|
305 |
this.connexionPanel.initLocalization(getClass().getName(), langs);
|
282 |
|
306 |
|
283 |
p.add(this.connexionPanel, c);
|
307 |
p.add(this.connexionPanel, c);
|
284 |
final PanelFrame panelFrame = new PanelFrame(p, "Connexion");
|
308 |
final PanelFrame panelFrame = new PanelFrame(p, "Connexion");
|
285 |
panelFrame.setLocationRelativeTo(null);
|
309 |
panelFrame.setLocationRelativeTo(null);
|
286 |
panelFrame.pack();
|
310 |
panelFrame.pack();
|
Line 297... |
Line 321... |
297 |
final SQLBase baseSociete = comptaConf.getSQLBaseSociete();
|
321 |
final SQLBase baseSociete = comptaConf.getSQLBaseSociete();
|
298 |
Thread t = new Thread() {
|
322 |
Thread t = new Thread() {
|
299 |
@Override
|
323 |
@Override
|
300 |
public void run() {
|
324 |
public void run() {
|
301 |
// laisse le temps au logiciel de demarrer
|
325 |
// laisse le temps au logiciel de demarrer
|
- |
|
326 |
ClasseCompte.loadClasseCompte(comptaConf);
|
302 |
try {
|
327 |
try {
|
303 |
Thread.sleep(1000);
|
328 |
Thread.sleep(1000);
|
304 |
} catch (InterruptedException e) {
|
329 |
} catch (InterruptedException e) {
|
305 |
e.printStackTrace();
|
330 |
e.printStackTrace();
|
306 |
}
|
331 |
}
|
307 |
ClasseCompte.loadClasseCompte();
|
- |
|
308 |
CaisseCotisationSQLElement.getCaisseCotisation();
|
332 |
CaisseCotisationSQLElement.getCaisseCotisation();
|
309 |
|
333 |
|
310 |
SQLPreferences prefs = SQLPreferences.getMemCached(comptaConf.getRootSociete());
|
334 |
SQLPreferences prefs = SQLPreferences.getMemCached(comptaConf.getRootSociete());
|
311 |
|
335 |
|
312 |
Ville.init(new NXDatabaseAccessor(comptaConf), prefs.getBoolean(GestionClientPreferencePanel.LOAD_CITIES, true));
|
336 |
Ville.init(new NXDatabaseAccessor(comptaConf), prefs.getBoolean(GestionClientPreferencePanel.LOAD_CITIES, true));
|