View | Details | Raw Unified | Return to bug 54758
Collapse All | Expand All

(-)a/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java (+16 lines)
Lines 208-211 public final class HSSFConditionalFormattingRule implements ConditionalFormattin Link Here
208
		}
208
		}
209
		return HSSFFormulaParser.toFormulaString(workbook, parsedExpression);
209
		return HSSFFormulaParser.toFormulaString(workbook, parsedExpression);
210
	}
210
	}
211
212
	/**
213
     * Sets the "stopIfTrue" attribute
214
     */
215
    @Override
216
    public void setStopIfTrue(boolean bln) {
217
        throw new UnsupportedOperationException("StopIfTrue is not supported for HSSF yet.");
218
    }
219
220
    /**
221
     * Unsets the "stopIfTrue" attribute
222
     */
223
    @Override
224
    public void unsetStopIfTrue() {
225
        throw new UnsupportedOperationException("StopIfTrue is not supported for HSSF yet.");
226
    }
211
}
227
}
(-)a/src/java/org/apache/poi/ss/usermodel/ConditionalFormattingRule.java (+10 lines)
Lines 122-125 public interface ConditionalFormattingRule { Link Here
122
     * @return  the second formula
122
     * @return  the second formula
123
     */
123
     */
124
    String getFormula2();
124
    String getFormula2();
125
126
    /**
127
     * Sets the "stopIfTrue" attribute
128
     */
129
    public void setStopIfTrue(boolean bln);
130
131
    /**
132
     * Unsets the "stopIfTrue" attribute
133
     */
134
    public void unsetStopIfTrue();
125
}
135
}
(-)a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.java (+16 lines)
Lines 221-224 public class XSSFConditionalFormattingRule implements ConditionalFormattingRule Link Here
221
    public String getFormula2(){
221
    public String getFormula2(){
222
        return _cfRule.sizeOfFormulaArray() == 2 ? _cfRule.getFormulaArray(1) : null;
222
        return _cfRule.sizeOfFormulaArray() == 2 ? _cfRule.getFormulaArray(1) : null;
223
    }
223
    }
224
225
    /**
226
     * Sets the "stopIfTrue" attribute
227
     */
228
    @Override
229
    public void setStopIfTrue(boolean bln) {
230
        _cfRule.setStopIfTrue(bln);
231
    }
232
233
    /**
234
     * Unsets the "stopIfTrue" attribute
235
     */
236
    @Override
237
    public void unsetStopIfTrue() {
238
        _cfRule.unsetStopIfTrue();
239
    }
224
}
240
}
(-)a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java (+19 lines)
Lines 19-24 Link Here
19
package org.apache.poi.xssf.usermodel;
19
package org.apache.poi.xssf.usermodel;
20
20
21
import org.apache.poi.ss.usermodel.BaseTestConditionalFormatting;
21
import org.apache.poi.ss.usermodel.BaseTestConditionalFormatting;
22
import org.apache.poi.ss.usermodel.ConditionalFormatting;
23
import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
24
import org.apache.poi.ss.usermodel.Sheet;
25
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
26
import org.apache.poi.ss.usermodel.Workbook;
22
import org.apache.poi.xssf.XSSFITestDataProvider;
27
import org.apache.poi.xssf.XSSFITestDataProvider;
23
28
24
/**
29
/**
Lines 32-35 public class TestXSSFConditionalFormatting extends BaseTestConditionalFormatting Link Here
32
    public void testRead(){
37
    public void testRead(){
33
        testRead("WithConditionalFormatting.xlsx");
38
        testRead("WithConditionalFormatting.xlsx");
34
    }
39
    }
40
    
41
    public void testStopIfTrue() {
42
        Workbook wb = XSSFITestDataProvider.instance.openSampleWorkbook("WithConditionalFormatting.xlsx");
43
        Sheet sh = wb.getSheet("CF");
44
        SheetConditionalFormatting sheetCF = sh.getSheetConditionalFormatting();
45
        assertEquals(3, sheetCF.getNumConditionalFormattings());
46
47
        ConditionalFormatting cf1 = sheetCF.getConditionalFormattingAt(0);
48
        ConditionalFormattingRule rule1 = cf1.getRule(0);
49
50
        rule1.setStopIfTrue(true);
51
        rule1.setStopIfTrue(false);
52
        rule1.unsetStopIfTrue();
53
    }
35
}
54
}
(-)a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFConditionalFormatting.java (+32 lines)
Lines 20-25 package org.apache.poi.hssf.usermodel; Link Here
20
20
21
import org.apache.poi.hssf.HSSFITestDataProvider;
21
import org.apache.poi.hssf.HSSFITestDataProvider;
22
import org.apache.poi.ss.usermodel.BaseTestConditionalFormatting;
22
import org.apache.poi.ss.usermodel.BaseTestConditionalFormatting;
23
import org.apache.poi.ss.usermodel.ConditionalFormatting;
24
import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
25
import org.apache.poi.ss.usermodel.Sheet;
26
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
27
import org.apache.poi.ss.usermodel.Workbook;
28
import org.apache.poi.xssf.XSSFITestDataProvider;
23
29
24
/**
30
/**
25
 *
31
 *
Lines 33-36 public final class TestHSSFConditionalFormatting extends BaseTestConditionalForm Link Here
33
    public void testRead(){
39
    public void testRead(){
34
        testRead("WithConditionalFormatting.xls");
40
        testRead("WithConditionalFormatting.xls");
35
    }
41
    }
42
    
43
    public void testStopIfTrue() {
44
        Workbook wb = HSSFITestDataProvider.instance.openSampleWorkbook("WithConditionalFormatting.xls");
45
        Sheet sh = wb.getSheet("CF");
46
        SheetConditionalFormatting sheetCF = sh.getSheetConditionalFormatting();
47
        assertEquals(3, sheetCF.getNumConditionalFormattings());
48
49
        ConditionalFormatting cf1 = sheetCF.getConditionalFormattingAt(0);
50
        ConditionalFormattingRule rule1 = cf1.getRule(0);
51
52
        try {
53
	        rule1.setStopIfTrue(true);
54
	        fail("Should not be supported yet");
55
        } catch (UnsupportedOperationException e) {
56
        }
57
        try {
58
	        rule1.setStopIfTrue(false);
59
	        fail("Should not be supported yet");
60
        } catch (UnsupportedOperationException e) {
61
        }
62
        try {
63
	        rule1.unsetStopIfTrue();
64
	        fail("Should not be supported yet");
65
        } catch (UnsupportedOperationException e) {
66
        }
67
    }
36
}
68
}

Return to bug 54758