OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Rev 41 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 25
Line 71... Line 71...
71
    private JComboBox comboMode;
71
    private JComboBox comboMode;
72
    private JTextField textMainProperties;
72
    private JTextField textMainProperties;
73
    private JTextField textIP;
73
    private JTextField textIP;
74
    private JTextField textPort;
74
    private JTextField textPort;
75
    private JTextField textFile;
75
    private JTextField textFile;
-
 
76
    private JTextField textBase;
76
    Properties props;
77
    Properties props;
77
    private JButton buttonDir;
78
    private JButton buttonDir;
78
    private JTabbedPane tabbedPane;
79
    private JTabbedPane tabbedPane;
79
 
80
 
80
    public static void main(String[] args) {
81
    public static void main(String[] args) {
Line 144... Line 145...
144
            try {
145
            try {
145
                this.props.load(new FileInputStream(this.confFile));
146
                this.props.load(new FileInputStream(this.confFile));
146
            } catch (Exception e) {
147
            } catch (Exception e) {
147
                JOptionPane.showMessageDialog(null, "Impossible de lire le fichier " + this.confFile + " \n" + e.getLocalizedMessage());
148
                JOptionPane.showMessageDialog(null, "Impossible de lire le fichier " + this.confFile + " \n" + e.getLocalizedMessage());
148
            }
149
            }
-
 
150
 
149
            String serverIp = this.props.getProperty("server.ip", "127.0.0.1:5432");
151
            String serverIp = this.props.getProperty("server.ip", "127.0.0.1:5432");
150
            String serverDriver = this.props.getProperty("server.driver", "postgresql").toLowerCase();
152
            String serverDriver = this.props.getProperty("server.driver", "postgresql").toLowerCase();
151
            if (serverDriver.startsWith("h2")) {
153
            if (serverDriver.startsWith("h2")) {
152
                updateUIForMode(ServerFinderConfig.H2);
154
                updateUIForMode(ServerFinderConfig.H2);
153
            } else if (serverDriver.startsWith("mysql")) {
155
            } else if (serverDriver.startsWith("mysql")) {
Line 156... Line 158...
156
            } else {
158
            } else {
157
                // Fallback on POSTGRESQL
159
                // Fallback on POSTGRESQL
158
                updateUIForMode(ServerFinderConfig.POSTGRESQL);
160
                updateUIForMode(ServerFinderConfig.POSTGRESQL);
159
                this.textPort.setText("5432");
161
                this.textPort.setText("5432");
160
            }
162
            }
161
 
-
 
-
 
163
            this.textBase.setText(this.props.getProperty("systemRoot", "OpenConcerto"));
162
            if (serverIp.contains("file:")) {
164
            if (serverIp.contains("file:")) {
163
                this.textFile.setText(serverIp.substring(5));
165
                this.textFile.setText(serverIp.substring(5));
164
            } else {
166
            } else {
165
                if (serverIp.contains(":")) {
167
                if (serverIp.contains(":")) {
166
                    int i = serverIp.lastIndexOf(':');
168
                    int i = serverIp.lastIndexOf(':');
Line 403... Line 405...
403
 
405
 
404
        // L3: file
406
        // L3: file
405
        c.gridy++;
407
        c.gridy++;
406
        c.gridx = 0;
408
        c.gridx = 0;
407
        c.weightx = 0;
409
        c.weightx = 0;
-
 
410
        p.add(new JLabel("Base de données", SwingConstants.RIGHT), c);
-
 
411
        c.gridx++;
-
 
412
        c.weighty = 0;
-
 
413
        c.gridwidth = 1;
-
 
414
        this.textBase = new JTextField();
-
 
415
        this.textBase.setEditable(false);
-
 
416
        p.add(this.textBase, c);
-
 
417
 
-
 
418
        // L4: file
-
 
419
        c.gridy++;
-
 
420
        c.gridx = 0;
-
 
421
        c.weightx = 0;
-
 
422
        c.gridwidth = 1;
408
        p.add(new JLabel("Dossier de base de données", SwingConstants.RIGHT), c);
423
        p.add(new JLabel("Dossier de base de données", SwingConstants.RIGHT), c);
409
        c.gridx++;
424
        c.gridx++;
410
        c.weighty = 0;
425
        c.weighty = 0;
411
        c.gridwidth = 2;
426
        c.gridwidth = 2;
412
        this.textFile = new JTextField();
427
        this.textFile = new JTextField();
Line 646... Line 661...
646
        p.add(buttonSelect, c);
661
        p.add(buttonSelect, c);
647
        p.setOpaque(false);
662
        p.setOpaque(false);
648
        return p;
663
        return p;
649
    }
664
    }
650
 
665
 
651
    private JPanel createPanelInstallation() {
-
 
652
        final JPanel p = new JPanel();
-
 
653
        p.setLayout(new GridBagLayout());
-
 
654
        p.setOpaque(false);
-
 
655
        return p;
-
 
656
    }
-
 
657
 
-
 
658
    public ServerFinderConfig getServerConfig() {
666
    public ServerFinderConfig getServerConfig() {
659
        final ServerFinderConfig conf = new ServerFinderConfig();
667
        final ServerFinderConfig conf = new ServerFinderConfig();
660
        conf.setType(ServerFinderPanel.this.comboMode.getSelectedItem().toString());
668
        conf.setType(ServerFinderPanel.this.comboMode.getSelectedItem().toString());
661
        conf.setIp(ServerFinderPanel.this.textIP.getText());
669
        conf.setIp(ServerFinderPanel.this.textIP.getText());
662
        conf.setPort(ServerFinderPanel.this.textPort.getText());
670
        conf.setPort(ServerFinderPanel.this.textPort.getText());
-
 
671
        conf.setSystemRoot(this.textBase.getText());
663
        return conf;
672
        return conf;
664
    }
673
    }
665
 
674
 
666
    private void useSelectedConfig(final JList l) {
675
    private void useSelectedConfig(final JList l) {
667
        Object sel = l.getSelectedValue();
676
        Object sel = l.getSelectedValue();
Line 688... Line 697...
688
    }
697
    }
689
 
698
 
690
    public ServerFinderConfig createServerFinderConfig() {
699
    public ServerFinderConfig createServerFinderConfig() {
691
        ServerFinderConfig conf = new ServerFinderConfig();
700
        ServerFinderConfig conf = new ServerFinderConfig();
692
        conf.setType(this.comboMode.getSelectedItem().toString());
701
        conf.setType(this.comboMode.getSelectedItem().toString());
-
 
702
        conf.setSystemRoot(this.textBase.getText());
693
        if (!conf.getType().equals(ServerFinderConfig.H2)) {
703
        if (!conf.getType().equals(ServerFinderConfig.H2)) {
694
            conf.setIp(this.textIP.getText());
704
            conf.setIp(this.textIP.getText());
695
            conf.setPort(this.textPort.getText());
705
            conf.setPort(this.textPort.getText());
696
        } else {
706
        } else {
697
            final File file = new File(this.textFile.getText());
707
            final File file = new File(this.textFile.getText());