OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 80 Rev 180
Line 130... Line 130...
130
 
130
 
131
    public CellStyle(final ODPackage pkg, Element tableColElem) {
131
    public CellStyle(final ODPackage pkg, Element tableColElem) {
132
        super(pkg, tableColElem);
132
        super(pkg, tableColElem);
133
    }
133
    }
134
 
134
 
135
    private final DataStyle getDataStyle(final Attribute name) {
135
    final DataStyle getDataStyle(final Attribute name) {
136
        return (DataStyle) Style.getReferencedStyle(getPackage(), name);
136
        return (DataStyle) Style.getReferencedStyle(getPackage(), name);
137
    }
137
    }
138
 
138
 
-
 
139
    // see MutableCell#getDataStyle()
139
    final DataStyle getDataStyle() {
140
    final DataStyle getDataStyle() {
140
        return getDataStyle(this.getElement().getAttribute("data-style-name", this.getSTYLE()));
141
        return getDataStyle(this.getElement().getAttribute("data-style-name", this.getSTYLE()));
141
    }
142
    }
142
 
143
 
143
    // return value since it can be changed depending on the data style.
144
    // return value since it can be changed depending on the data style.
Line 158... Line 159...
158
                    returnCellValue = convertedForStyle;
159
                    returnCellValue = convertedForStyle;
159
                    returnValueType = res.getDataType();
160
                    returnValueType = res.getDataType();
160
                }
161
                }
161
            }
162
            }
162
 
163
 
163
            final List<?> styleMaps = res.getElement().getChildren("map", getSTYLE());
164
            final List<Element> styleMaps = res.getMapChildren();
164
            if (styleMaps.size() > 0) {
165
            if (styleMaps.size() > 0) {
165
                final Object converted = convertForCondition(returnCellValue, res);
166
                final Object converted = convertForCondition(returnCellValue, res);
166
                // we can't compare() so don't try
167
                // we can't compare() so don't try
167
                if (converted != null) {
168
                if (converted != null) {
168
                    for (Object child : styleMaps) {
169
                    for (Element child : styleMaps) {
169
                        final Element styleMap = (Element) child;
170
                        final Element styleMap = child;
170
                        final Matcher matcher = conditionPatrn.matcher(styleMap.getAttributeValue("condition", getSTYLE()).trim());
171
                        final Matcher matcher = conditionPatrn.matcher(styleMap.getAttributeValue("condition", getSTYLE()).trim());
171
                        if (!matcher.matches())
172
                        if (!matcher.matches())
172
                            throw new IllegalStateException("Cannot parse " + JDOMUtils.output(styleMap));
173
                            throw new IllegalStateException("Cannot parse " + JDOMUtils.output(styleMap));
173
                        if (RelationalOperator.getInstance(matcher.group(1)).compare(converted, parse(matcher.group(2)))) {
174
                        if (RelationalOperator.getInstance(matcher.group(1)).compare(converted, parse(matcher.group(2)))) {
174
                            res = getDataStyle(styleMap.getAttribute("apply-style-name", getSTYLE()));
175
                            res = getDataStyle(styleMap.getAttribute("apply-style-name", getSTYLE()));