OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 80 Rev 142
Line 147... Line 147...
147
        this(r, imageLogo, societeSelector, true);
147
        this(r, imageLogo, societeSelector, true);
148
    }
148
    }
149
 
149
 
150
    public ConnexionPanel(final Runnable r, final JImage imageLogo, final boolean societeSelector, final boolean allowStoredPass) {
150
    public ConnexionPanel(final Runnable r, final JImage imageLogo, final boolean societeSelector, final boolean allowStoredPass) {
151
        super();
151
        super();
-
 
152
        if (r == null) {
-
 
153
            throw new IllegalArgumentException("null runnable");
-
 
154
        }
152
        this.login = new Login(Configuration.getInstance().getRoot());
155
        this.login = new Login(Configuration.getInstance().getRoot());
153
 
156
 
154
        this.societeSelector = societeSelector;
157
        this.societeSelector = societeSelector;
155
        this.r = r;
158
        this.r = r;
156
        String lastLoginName = UserProps.getInstance().getLastLoginName();
159
        String lastLoginName = UserProps.getInstance().getLastLoginName();
Line 370... Line 373...
370
        this.buttonConnect.setToolTipText(this.connectionAllowed);
373
        this.buttonConnect.setToolTipText(this.connectionAllowed);
371
    }
374
    }
372
 
375
 
373
    private boolean areFieldsValidated() {
376
    private boolean areFieldsValidated() {
374
        if (this.societeSelector) {
377
        if (this.societeSelector) {
375
            final SQLRow selectedRow = this.comboSociete.getSelectedRow();
378
            if (this.comboSociete.isEmpty()) {
376
            // don't use isData() since it calls isArchived() and since ComboRequest doesn't include
-
 
377
            // ARCHIVE field this triggers a request
-
 
378
            if (selectedRow == null || selectedRow.isUndefined()) {
-
 
379
                return false;
379
                return false;
380
            }
380
            }
381
        }
381
        }
382
 
-
 
383
        if (this.textLogin == null || this.textLogin.isEmpty() || this.textPassWord == null) {
382
        if (this.textLogin == null || this.textLogin.isEmpty() || this.textPassWord == null) {
384
            return false;
383
            return false;
385
        } else {
384
        } else {
386
            return this.textLogin.getValidState().isValid();
385
            return this.textLogin.getValidState().isValid();
387
        }
386
        }
Line 484... Line 483...
484
 
483
 
485
    private void unlockUIOnError(final String error, final String userName) {
484
    private void unlockUIOnError(final String error, final String userName) {
486
        SwingUtilities.invokeLater(new Runnable() {
485
        SwingUtilities.invokeLater(new Runnable() {
487
            @Override
486
            @Override
488
            public void run() {
487
            public void run() {
-
 
488
                try {
489
                ConnexionPanel.this.reloadPanel.setMode(ReloadPanel.MODE_BLINK);
489
                    ConnexionPanel.this.reloadPanel.setMode(ReloadPanel.MODE_BLINK);
490
                JOptionPane.showMessageDialog(ConnexionPanel.this, TM.getTM().translate("loginPanel." + error, userName));
490
                    JOptionPane.showMessageDialog(ConnexionPanel.this, TM.getTM().translate("loginPanel." + error, userName));
491
                // Guillaume wants this for the Nego
491
                    // Guillaume wants this for the Nego
492
                if (Login.UNKNOWN_USER.equals(error))
492
                    if (Login.UNKNOWN_USER.equals(error))
493
                    ConnexionPanel.this.textLogin.setValue(ConnexionPanel.this.adminLogin);
493
                        ConnexionPanel.this.textLogin.setValue(ConnexionPanel.this.adminLogin);
494
                setConnecting(false);
494
                    setConnecting(false);
-
 
495
                } catch (Exception e) {
-
 
496
                    e.printStackTrace();
-
 
497
                }
495
            }
498
            }
496
        });
499
        });
497
    }
500
    }
498
 
501
 
499
    public int getSelectedSociete() {
502
    public int getSelectedSociete() {