OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
Line 346... Line 346...
346
     * 
346
     * 
347
     * @param viewIndex the index in the view (eg a JTable).
347
     * @param viewIndex the index in the view (eg a JTable).
348
     * @return the corresponding index in the model.
348
     * @return the corresponding index in the model.
349
     */
349
     */
350
    public int modelIndex(int viewIndex) {
350
    public int modelIndex(int viewIndex) {
-
 
351
        try {
351
        return getViewToModel()[viewIndex].modelIndex;
352
            return getViewToModel()[viewIndex].modelIndex;
-
 
353
        } catch (Exception e) {
-
 
354
            throw new IllegalStateException(this + " couldn't get model index for view index " + viewIndex + " with " + this.getTableModel().getRowCount() + " row(s) in our model", e);
-
 
355
        }
352
    }
356
    }
353
 
357
 
354
    private int[] getModelToView() {
358
    private int[] getModelToView() {
355
        if (!SwingUtilities.isEventDispatchThread()) {
359
        if (!SwingUtilities.isEventDispatchThread()) {
356
            throw new IllegalStateException("must be called from EDT");
360
            throw new IllegalStateException("must be called from EDT");
Line 428... Line 432...
428
 
432
 
429
    public void rmPropertyChangeListener(PropertyChangeListener l) {
433
    public void rmPropertyChangeListener(PropertyChangeListener l) {
430
        this.supp.removePropertyChangeListener(l);
434
        this.supp.removePropertyChangeListener(l);
431
    }
435
    }
432
 
436
 
-
 
437
    @Override
-
 
438
    public String toString() {
-
 
439
        return this.getClass().getSimpleName() + " on " + this.getTableModel();
-
 
440
    }
-
 
441
 
433
    // Helper classes
442
    // Helper classes
434
 
443
 
435
    private class Row implements Comparable<Row> {
444
    private class Row implements Comparable<Row> {
436
        private int modelIndex;
445
        private int modelIndex;
437
 
446