Consistent whitespace/indents
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1690809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4632e35c3d
commit
659af54686
@ -73,96 +73,88 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
|||||||
* sheet.addConditionalFormatting(regions, rule);
|
* sheet.addConditionalFormatting(regions, rule);
|
||||||
* </PRE>
|
* </PRE>
|
||||||
*/
|
*/
|
||||||
public final class HSSFConditionalFormatting implements ConditionalFormatting
|
public final class HSSFConditionalFormatting implements ConditionalFormatting {
|
||||||
{
|
private final HSSFWorkbook _workbook;
|
||||||
private final HSSFWorkbook _workbook;
|
private final CFRecordsAggregate cfAggregate;
|
||||||
private final CFRecordsAggregate cfAggregate;
|
|
||||||
|
// TODO Should this be assigning unique IDs to the rules
|
||||||
|
// as they get added to the file?
|
||||||
|
|
||||||
// TODO Should this be assigning unique IDs to the rules
|
|
||||||
// as they get added to the file?
|
|
||||||
|
|
||||||
// TODO Support types beyond CELL_VALUE_IS and FORMULA
|
// TODO Support types beyond CELL_VALUE_IS and FORMULA
|
||||||
|
|
||||||
HSSFConditionalFormatting(HSSFWorkbook workbook, CFRecordsAggregate cfAggregate)
|
HSSFConditionalFormatting(HSSFWorkbook workbook, CFRecordsAggregate cfAggregate) {
|
||||||
{
|
if(workbook == null) {
|
||||||
if(workbook == null) {
|
throw new IllegalArgumentException("workbook must not be null");
|
||||||
throw new IllegalArgumentException("workbook must not be null");
|
}
|
||||||
}
|
if(cfAggregate == null) {
|
||||||
if(cfAggregate == null) {
|
throw new IllegalArgumentException("cfAggregate must not be null");
|
||||||
throw new IllegalArgumentException("cfAggregate must not be null");
|
}
|
||||||
}
|
_workbook = workbook;
|
||||||
_workbook = workbook;
|
this.cfAggregate = cfAggregate;
|
||||||
this.cfAggregate = cfAggregate;
|
}
|
||||||
}
|
CFRecordsAggregate getCFRecordsAggregate() {
|
||||||
CFRecordsAggregate getCFRecordsAggregate() {
|
return cfAggregate;
|
||||||
return cfAggregate;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated (Aug-2008) use {@link HSSFConditionalFormatting#getFormattingRanges()}
|
* @deprecated (Aug-2008) use {@link HSSFConditionalFormatting#getFormattingRanges()}
|
||||||
*/
|
*/
|
||||||
public org.apache.poi.ss.util.Region[] getFormattingRegions()
|
public org.apache.poi.ss.util.Region[] getFormattingRegions() {
|
||||||
{
|
CellRangeAddress[] cellRanges = getFormattingRanges();
|
||||||
CellRangeAddress[] cellRanges = getFormattingRanges();
|
return org.apache.poi.ss.util.Region.convertCellRangesToRegions(cellRanges);
|
||||||
return org.apache.poi.ss.util.Region.convertCellRangesToRegions(cellRanges);
|
}
|
||||||
}
|
/**
|
||||||
/**
|
* @return array of <tt>CellRangeAddress</tt>s. never <code>null</code>
|
||||||
* @return array of <tt>CellRangeAddress</tt>s. never <code>null</code>
|
*/
|
||||||
*/
|
public CellRangeAddress[] getFormattingRanges() {
|
||||||
public CellRangeAddress[] getFormattingRanges() {
|
return cfAggregate.getHeader().getCellRanges();
|
||||||
return cfAggregate.getHeader().getCellRanges();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces an existing Conditional Formatting rule at position idx.
|
* Replaces an existing Conditional Formatting rule at position idx.
|
||||||
* Excel allows to create up to 3 Conditional Formatting rules.
|
* Excel allows to create up to 3 Conditional Formatting rules.
|
||||||
* This method can be useful to modify existing Conditional Formatting rules.
|
* This method can be useful to modify existing Conditional Formatting rules.
|
||||||
*
|
*
|
||||||
* @param idx position of the rule. Should be between 0 and 2.
|
* @param idx position of the rule. Should be between 0 and 2.
|
||||||
* @param cfRule - Conditional Formatting rule
|
* @param cfRule - Conditional Formatting rule
|
||||||
*/
|
*/
|
||||||
public void setRule(int idx, HSSFConditionalFormattingRule cfRule)
|
public void setRule(int idx, HSSFConditionalFormattingRule cfRule) {
|
||||||
{
|
cfAggregate.setRule(idx, cfRule.getCfRuleRecord());
|
||||||
cfAggregate.setRule(idx, cfRule.getCfRuleRecord());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setRule(int idx, ConditionalFormattingRule cfRule){
|
public void setRule(int idx, ConditionalFormattingRule cfRule){
|
||||||
setRule(idx, (HSSFConditionalFormattingRule)cfRule);
|
setRule(idx, (HSSFConditionalFormattingRule)cfRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a Conditional Formatting rule.
|
* add a Conditional Formatting rule.
|
||||||
* Excel allows to create up to 3 Conditional Formatting rules.
|
* Excel allows to create up to 3 Conditional Formatting rules.
|
||||||
* @param cfRule - Conditional Formatting rule
|
* @param cfRule - Conditional Formatting rule
|
||||||
*/
|
*/
|
||||||
public void addRule(HSSFConditionalFormattingRule cfRule)
|
public void addRule(HSSFConditionalFormattingRule cfRule) {
|
||||||
{
|
cfAggregate.addRule(cfRule.getCfRuleRecord());
|
||||||
cfAggregate.addRule(cfRule.getCfRuleRecord());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void addRule(ConditionalFormattingRule cfRule){
|
public void addRule(ConditionalFormattingRule cfRule){
|
||||||
addRule((HSSFConditionalFormattingRule)cfRule);
|
addRule((HSSFConditionalFormattingRule)cfRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Conditional Formatting rule at position idx.
|
* @return the Conditional Formatting rule at position idx.
|
||||||
*/
|
*/
|
||||||
public HSSFConditionalFormattingRule getRule(int idx)
|
public HSSFConditionalFormattingRule getRule(int idx) {
|
||||||
{
|
CFRuleBase ruleRecord = cfAggregate.getRule(idx);
|
||||||
CFRuleBase ruleRecord = cfAggregate.getRule(idx);
|
return new HSSFConditionalFormattingRule(_workbook, ruleRecord);
|
||||||
return new HSSFConditionalFormattingRule(_workbook, ruleRecord);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return number of Conditional Formatting rules.
|
* @return number of Conditional Formatting rules.
|
||||||
*/
|
*/
|
||||||
public int getNumberOfRules()
|
public int getNumberOfRules() {
|
||||||
{
|
return cfAggregate.getNumberOfRules();
|
||||||
return cfAggregate.getNumberOfRules();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
return cfAggregate.toString();
|
||||||
return cfAggregate.toString();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user