OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 65 Rev 174
Line 52... Line 52...
52
    static final boolean isShort(final Element elem) {
52
    static final boolean isShort(final Element elem) {
53
        // in OOo the default is short
53
        // in OOo the default is short
54
        return !"long".equals(elem.getAttributeValue("style", elem.getNamespace("number")));
54
        return !"long".equals(elem.getAttributeValue("style", elem.getNamespace("number")));
55
    }
55
    }
56
 
56
 
57
    public static final Locale getLocale(final Element elem) {
57
    static final Locale getElementLocale(final Element elem) {
58
        final Locale res;
58
        final Locale res;
59
        final String country = elem.getAttributeValue("country", elem.getNamespace());
59
        final String country = elem.getAttributeValue("country", elem.getNamespace());
60
        final String lang = elem.getAttributeValue("language", elem.getNamespace());
60
        final String lang = elem.getAttributeValue("language", elem.getNamespace());
61
        if (lang != null) {
61
        if (lang != null) {
62
            res = new Locale(lang, country == null ? "" : country);
62
            res = new Locale(lang, country == null ? "" : country);
63
        } else {
63
        } else {
64
            res = Locale.getDefault();
64
            res = null;
65
        }
65
        }
66
        return res;
66
        return res;
67
    }
67
    }
68
 
68
 
69
    private static final Calendar getCalendar(final Element elem, Calendar defaultCal) {
69
    private static final Calendar getCalendar(final Element elem, Calendar defaultCal) {
Line 121... Line 121...
121
 
121
 
122
    @Override
122
    @Override
123
    public String format(Object o, CellStyle defaultStyle, boolean lenient) {
123
    public String format(Object o, CellStyle defaultStyle, boolean lenient) {
124
        final Date d = o instanceof Calendar ? ((Calendar) o).getTime() : (Date) o;
124
        final Date d = o instanceof Calendar ? ((Calendar) o).getTime() : (Date) o;
125
        final Namespace numberNS = this.getElement().getNamespace();
125
        final Namespace numberNS = this.getElement().getNamespace();
126
        final Locale styleLocale = getLocale(getElement());
126
        final Locale styleLocale = this.getLocale();
127
        final Calendar styleCalendar = Calendar.getInstance(styleLocale);
127
        final Calendar styleCalendar = Calendar.getInstance(styleLocale);
128
        final StringBuilder res = new StringBuilder();
128
        final StringBuilder res = new StringBuilder();
129
 
129
 
130
        Calendar currentCalendar = styleCalendar;
130
        Calendar currentCalendar = styleCalendar;
131
        final StringBuilder sb = new StringBuilder();
131
        final StringBuilder sb = new StringBuilder();