OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 28 Rev 156
Line 83... Line 83...
83
            this.parsedFilter.put(fmt, res);
83
            this.parsedFilter.put(fmt, res);
84
        }
84
        }
85
        return res;
85
        return res;
86
    }
86
    }
87
 
87
 
-
 
88
    private final String format(final Format fmt, final Object cell) {
-
 
89
        try {
-
 
90
            return fmt.format(cell);
-
 
91
        } catch (Exception e) {
-
 
92
            throw new IllegalStateException("Couldn't format " + cell + '(' + getClass(cell) + ") with " + fmt, e);
-
 
93
        }
-
 
94
    }
-
 
95
 
-
 
96
    static private String getClass(Object cell) {
-
 
97
        return cell == null ? "<null>" : cell.getClass().getName();
-
 
98
    }
-
 
99
 
88
    private final Double getDouble() {
100
    private final Double getDouble() {
89
        if (!this.parsedFilterD_tried) {
101
        if (!this.parsedFilterD_tried) {
90
            try {
102
            try {
91
                this.parsedFilterD = Double.valueOf(this.filterString);
103
                this.parsedFilterD = Double.valueOf(this.filterString);
92
            } catch (NumberFormatException e) {
104
            } catch (NumberFormatException e) {
Line 129... Line 141...
129
                // date format for a timestamp loses the time part : 25/12/2010 13:00 would be
141
                // date format for a timestamp loses the time part : 25/12/2010 13:00 would be
130
                // formatted to 25/12/2010 thus "= 25/12/2010" would select all times of that day,
142
                // formatted to 25/12/2010 thus "= 25/12/2010" would select all times of that day,
131
                // which is better achieved with contains)
143
                // which is better achieved with contains)
132
                // PS: the date format is useful for parsing since "> 25/12/2010" means
144
                // PS: the date format is useful for parsing since "> 25/12/2010" means
133
                // "> 25/12/2010 00:00" which is understandable and concise.
145
                // "> 25/12/2010 00:00" which is understandable and concise.
134
                if (isContains && containsOrEquals(fmt.format(cell)))
146
                if (isContains && containsOrEquals(format(fmt, cell)))
135
                    return true;
147
                    return true;
136
                // e.g. test if "01/01/2006" is before "25 déc. 2010"
148
                // e.g. test if "01/01/2006" is before "25 déc. 2010"
137
                else if (!isContains && test(getParsed(fmt), cell))
149
                else if (!isContains && test(getParsed(fmt), cell))
138
                    return true;
150
                    return true;
139
            }
151
            }