]> source.dussan.org Git - poi.git/commitdiff
Fix inconsistent whitespace/formatting
authorNick Burch <nick@apache.org>
Tue, 14 Jul 2015 18:35:04 +0000 (18:35 +0000)
committerNick Burch <nick@apache.org>
Tue, 14 Jul 2015 18:35:04 +0000 (18:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691049 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java

index 6f598dfc66dfc80c593123cf09ff1b131ac78088..31f5cd631914274a3cbc62fb5a320cdedc402d79 100644 (file)
@@ -35,182 +35,179 @@ import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
  * and the formatting settings such as font, border and pattern.
  */
 public final class HSSFConditionalFormattingRule implements ConditionalFormattingRule {
-       private static final byte CELL_COMPARISON = CFRuleRecord.CONDITION_TYPE_CELL_VALUE_IS;
-
-       private final CFRuleBase cfRuleRecord;
-       private final HSSFWorkbook workbook;
-
-       HSSFConditionalFormattingRule(HSSFWorkbook pWorkbook, CFRuleBase pRuleRecord) {
-               if (pWorkbook == null) {
-                       throw new IllegalArgumentException("pWorkbook must not be null");
-               }
-               if (pRuleRecord == null) {
-                       throw new IllegalArgumentException("pRuleRecord must not be null");
-               }
-               workbook = pWorkbook;
-               cfRuleRecord = pRuleRecord;
-       }
-
-       CFRuleBase getCfRuleRecord()
-       {
-               return cfRuleRecord;
-       }
-
-       private HSSFFontFormatting getFontFormatting(boolean create)
-       {
-               FontFormatting fontFormatting = cfRuleRecord.getFontFormatting();
-               if ( fontFormatting != null)
-               {
-                       cfRuleRecord.setFontFormatting(fontFormatting);
-                       return new HSSFFontFormatting(cfRuleRecord, workbook);
-               }
-               else if( create )
-               {
-                       fontFormatting = new FontFormatting();
-                       cfRuleRecord.setFontFormatting(fontFormatting);
-                       return new HSSFFontFormatting(cfRuleRecord, workbook);
-               }
-               else
-               {
-                       return null;
-               }
-       }
-
-       /**
-        * @return - font formatting object  if defined,  <code>null</code> otherwise
-        */
-       public HSSFFontFormatting getFontFormatting()
-       {
-               return getFontFormatting(false);
-       }
-       /**
-        * create a new font formatting structure if it does not exist,
-        * otherwise just return existing object.
-        * @return - font formatting object, never returns <code>null</code>.
-        */
-       public HSSFFontFormatting createFontFormatting()
-       {
-               return getFontFormatting(true);
-       }
-
-       private HSSFBorderFormatting getBorderFormatting(boolean create)
-       {
-               BorderFormatting borderFormatting = cfRuleRecord.getBorderFormatting();
-               if ( borderFormatting != null)
-               {
-                       cfRuleRecord.setBorderFormatting(borderFormatting);
-                       return new HSSFBorderFormatting(cfRuleRecord);
-               }
-               else if( create )
-               {
-                       borderFormatting = new BorderFormatting();
-                       cfRuleRecord.setBorderFormatting(borderFormatting);
-                       return new HSSFBorderFormatting(cfRuleRecord);
-               }
-               else
-               {
-                       return null;
-               }
-       }
-       /**
-        * @return - border formatting object  if defined,  <code>null</code> otherwise
-        */
-       public HSSFBorderFormatting getBorderFormatting()
-       {
-               return getBorderFormatting(false);
-       }
-       /**
-        * create a new border formatting structure if it does not exist,
-        * otherwise just return existing object.
-        * @return - border formatting object, never returns <code>null</code>.
-        */
-       public HSSFBorderFormatting createBorderFormatting()
-       {
-               return getBorderFormatting(true);
-       }
-
-       private HSSFPatternFormatting getPatternFormatting(boolean create)
-       {
-               PatternFormatting patternFormatting = cfRuleRecord.getPatternFormatting();
-               if ( patternFormatting != null)
-               {
-                       cfRuleRecord.setPatternFormatting(patternFormatting);
-                       return new HSSFPatternFormatting(cfRuleRecord, workbook);
-               }
-               else if( create )
-               {
-                       patternFormatting = new PatternFormatting();
-                       cfRuleRecord.setPatternFormatting(patternFormatting);
-                       return new HSSFPatternFormatting(cfRuleRecord, workbook);
-               }
-               else
-               {
-                       return null;
-               }
-       }
-
-       /**
-        * @return - pattern formatting object  if defined, <code>null</code> otherwise
-        */
-       public HSSFPatternFormatting getPatternFormatting()
-       {
-               return getPatternFormatting(false);
-       }
-       /**
-        * create a new pattern formatting structure if it does not exist,
-        * otherwise just return existing object.
-        * @return - pattern formatting object, never returns <code>null</code>.
-        */
-       public HSSFPatternFormatting createPatternFormatting()
-       {
-               return getPatternFormatting(true);
-       }
-
-       /**
-        * @return -  the conditiontype for the cfrule
-        */
-       public byte getConditionType() {
-               return cfRuleRecord.getConditionType();
-       }
+    private static final byte CELL_COMPARISON = CFRuleRecord.CONDITION_TYPE_CELL_VALUE_IS;
+
+    private final CFRuleBase cfRuleRecord;
+    private final HSSFWorkbook workbook;
+
+    HSSFConditionalFormattingRule(HSSFWorkbook pWorkbook, CFRuleBase pRuleRecord) {
+        if (pWorkbook == null) {
+            throw new IllegalArgumentException("pWorkbook must not be null");
+        }
+        if (pRuleRecord == null) {
+            throw new IllegalArgumentException("pRuleRecord must not be null");
+        }
+        workbook = pWorkbook;
+        cfRuleRecord = pRuleRecord;
+    }
+
+    CFRuleBase getCfRuleRecord()
+    {
+        return cfRuleRecord;
+    }
+
+    private HSSFFontFormatting getFontFormatting(boolean create)
+    {
+        FontFormatting fontFormatting = cfRuleRecord.getFontFormatting();
+        if ( fontFormatting != null)
+        {
+            cfRuleRecord.setFontFormatting(fontFormatting);
+            return new HSSFFontFormatting(cfRuleRecord, workbook);
+        }
+        else if( create )
+        {
+            fontFormatting = new FontFormatting();
+            cfRuleRecord.setFontFormatting(fontFormatting);
+            return new HSSFFontFormatting(cfRuleRecord, workbook);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    /**
+     * @return - font formatting object  if defined,  <code>null</code> otherwise
+     */
+    public HSSFFontFormatting getFontFormatting()
+    {
+        return getFontFormatting(false);
+    }
+    /**
+     * create a new font formatting structure if it does not exist,
+     * otherwise just return existing object.
+     * @return - font formatting object, never returns <code>null</code>.
+     */
+    public HSSFFontFormatting createFontFormatting()
+    {
+        return getFontFormatting(true);
+    }
+
+    private HSSFBorderFormatting getBorderFormatting(boolean create)
+    {
+        BorderFormatting borderFormatting = cfRuleRecord.getBorderFormatting();
+        if ( borderFormatting != null)
+        {
+            cfRuleRecord.setBorderFormatting(borderFormatting);
+            return new HSSFBorderFormatting(cfRuleRecord);
+        }
+        else if( create )
+        {
+            borderFormatting = new BorderFormatting();
+            cfRuleRecord.setBorderFormatting(borderFormatting);
+            return new HSSFBorderFormatting(cfRuleRecord);
+        }
+        else
+        {
+            return null;
+        }
+    }
+    /**
+     * @return - border formatting object  if defined,  <code>null</code> otherwise
+     */
+    public HSSFBorderFormatting getBorderFormatting()
+    {
+        return getBorderFormatting(false);
+    }
+    /**
+     * create a new border formatting structure if it does not exist,
+     * otherwise just return existing object.
+     * @return - border formatting object, never returns <code>null</code>.
+     */
+    public HSSFBorderFormatting createBorderFormatting()
+    {
+        return getBorderFormatting(true);
+    }
+
+    private HSSFPatternFormatting getPatternFormatting(boolean create)
+    {
+        PatternFormatting patternFormatting = cfRuleRecord.getPatternFormatting();
+        if ( patternFormatting != null)
+        {
+            cfRuleRecord.setPatternFormatting(patternFormatting);
+            return new HSSFPatternFormatting(cfRuleRecord, workbook);
+        }
+        else if( create )
+        {
+            patternFormatting = new PatternFormatting();
+            cfRuleRecord.setPatternFormatting(patternFormatting);
+            return new HSSFPatternFormatting(cfRuleRecord, workbook);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    /**
+     * @return - pattern formatting object  if defined, <code>null</code> otherwise
+     */
+    public HSSFPatternFormatting getPatternFormatting()
+    {
+        return getPatternFormatting(false);
+    }
+    /**
+     * create a new pattern formatting structure if it does not exist,
+     * otherwise just return existing object.
+     * @return - pattern formatting object, never returns <code>null</code>.
+     */
+    public HSSFPatternFormatting createPatternFormatting()
+    {
+        return getPatternFormatting(true);
+    }
+
+    /**
+     * @return -  the conditiontype for the cfrule
+     */
+    public byte getConditionType() {
+        return cfRuleRecord.getConditionType();
+    }
     /**
      * @return -  the conditiontype for the cfrule
      */
-       public ConditionType getConditionTypeType() {
-           return ConditionType.forId(getConditionType());
-       }
-
-       /**
-        * @return - the comparisionoperatation for the cfrule
-        */
-       public byte getComparisonOperation() {
-               return cfRuleRecord.getComparisonOperation();
-       }
-
-       public String getFormula1()
-       {
-               return toFormulaString(cfRuleRecord.getParsedExpression1());
-       }
-
-       public String getFormula2()
-       {
-               byte conditionType = cfRuleRecord.getConditionType();
-               if (conditionType == CELL_COMPARISON) {
-                       byte comparisonOperation = cfRuleRecord.getComparisonOperation();
-                       switch(comparisonOperation)
-                       {
-                               case ComparisonOperator.BETWEEN:
-                               case ComparisonOperator.NOT_BETWEEN:
-                                       return toFormulaString(cfRuleRecord.getParsedExpression2());
-                       }
-               }
-               return null;
-       }
-
-       private String toFormulaString(Ptg[] parsedExpression)
-       {
-               if(parsedExpression ==null) {
-                       return null;
-               }
-               return HSSFFormulaParser.toFormulaString(workbook, parsedExpression);
-       }
+    public ConditionType getConditionTypeType() {
+        return ConditionType.forId(getConditionType());
+    }
+
+    /**
+     * @return - the comparisionoperatation for the cfrule
+     */
+    public byte getComparisonOperation() {
+        return cfRuleRecord.getComparisonOperation();
+    }
+
+    public String getFormula1()
+    {
+        return toFormulaString(cfRuleRecord.getParsedExpression1());
+    }
+
+    public String getFormula2() {
+        byte conditionType = cfRuleRecord.getConditionType();
+        if (conditionType == CELL_COMPARISON) {
+            byte comparisonOperation = cfRuleRecord.getComparisonOperation();
+            switch(comparisonOperation) {
+                case ComparisonOperator.BETWEEN:
+                case ComparisonOperator.NOT_BETWEEN:
+                    return toFormulaString(cfRuleRecord.getParsedExpression2());
+            }
+        }
+        return null;
+    }
+
+    private String toFormulaString(Ptg[] parsedExpression) {
+        if(parsedExpression ==null) {
+            return null;
+        }
+        return HSSFFormulaParser.toFormulaString(workbook, parsedExpression);
+    }
 }
index 9bd15e9cfba76e5b65f2f8b80f8402f7398f3ccb..7be7945d172b501b25b94c2d10ed92bc24ccf050 100644 (file)
@@ -25,25 +25,23 @@ import org.apache.poi.ss.usermodel.Color;
 /**
  * High level representation for Conditional Formatting settings
  */
-public class HSSFPatternFormatting implements org.apache.poi.ss.usermodel.PatternFormatting
-{
+public class HSSFPatternFormatting implements org.apache.poi.ss.usermodel.PatternFormatting {
     private final HSSFWorkbook workbook;
-       private final CFRuleBase cfRuleRecord;
-       private final PatternFormatting patternFormatting;
-       
-       protected HSSFPatternFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook)
-       {
-           this.workbook = workbook;
-               this.cfRuleRecord = cfRuleRecord; 
-               this.patternFormatting = cfRuleRecord.getPatternFormatting();
-       }
-
-       protected PatternFormatting getPatternFormattingBlock()
-       {
-               return patternFormatting;
-       }
-
-       public HSSFColor getFillBackgroundColorColor() {
+    private final CFRuleBase cfRuleRecord;
+    private final PatternFormatting patternFormatting;
+
+    protected HSSFPatternFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook) {
+        this.workbook = workbook;
+        this.cfRuleRecord = cfRuleRecord; 
+        this.patternFormatting = cfRuleRecord.getPatternFormatting();
+    }
+
+    protected PatternFormatting getPatternFormattingBlock()
+    {
+        return patternFormatting;
+    }
+
+    public HSSFColor getFillBackgroundColorColor() {
         return workbook.getCustomPalette().getColor(getFillBackgroundColor());
     }
 
@@ -52,40 +50,40 @@ public class HSSFPatternFormatting implements org.apache.poi.ss.usermodel.Patter
     }
 
     /**
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillBackgroundColor()
-        */
-       public short getFillBackgroundColor()
-       {
-               return (short)patternFormatting.getFillBackgroundColor();
-       }
-
-       /**
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillForegroundColor()
-        */
-       public short getFillForegroundColor()
-       {
-               return (short)patternFormatting.getFillForegroundColor();
-       }
-
-       /**
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillPattern()
-        */
-       public short getFillPattern()
-       {
-               return (short)patternFormatting.getFillPattern();
-       }
-
-       public void setFillBackgroundColor(Color bg) {
-           if (bg != null && !(bg instanceof HSSFColor)) {
-               throw new IllegalArgumentException("Only HSSFColor objects are supported");
-           }
-           HSSFColor hcolor = (HSSFColor)bg;
-           if (hcolor == null) {
-               setFillBackgroundColor((short)0);
-           } else {
-               setFillBackgroundColor(hcolor.getIndex());
-           }
-       }
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillBackgroundColor()
+     */
+    public short getFillBackgroundColor()
+    {
+        return (short)patternFormatting.getFillBackgroundColor();
+    }
+
+    /**
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillForegroundColor()
+     */
+    public short getFillForegroundColor()
+    {
+        return (short)patternFormatting.getFillForegroundColor();
+    }
+
+    /**
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillPattern()
+     */
+    public short getFillPattern()
+    {
+        return (short)patternFormatting.getFillPattern();
+    }
+
+    public void setFillBackgroundColor(Color bg) {
+        if (bg != null && !(bg instanceof HSSFColor)) {
+            throw new IllegalArgumentException("Only HSSFColor objects are supported");
+        }
+        HSSFColor hcolor = (HSSFColor)bg;
+        if (hcolor == null) {
+            setFillBackgroundColor((short)0);
+        } else {
+            setFillBackgroundColor(hcolor.getIndex());
+        }
+    }
 
     public void setFillForegroundColor(Color fg) {
         if (fg != null && !(fg instanceof HSSFColor)) {
@@ -100,41 +98,41 @@ public class HSSFPatternFormatting implements org.apache.poi.ss.usermodel.Patter
     }
 
     /**
-        * @param bg
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillBackgroundColor(int)
-        */
-       public void setFillBackgroundColor(short bg)
-       {
-               patternFormatting.setFillBackgroundColor(bg);
-               if( bg != 0)
-               {
-                       cfRuleRecord.setPatternBackgroundColorModified(true);
-               }
-       }
-
-       /**
-        * @param fg
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillForegroundColor(int)
-        */
-       public void setFillForegroundColor(short fg)
-       {
-               patternFormatting.setFillForegroundColor(fg);
-               if( fg != 0)
-               {
-                       cfRuleRecord.setPatternColorModified(true);
-               }
-       }
-
-       /**
-        * @param fp
-        * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillPattern(int)
-        */
-       public void setFillPattern(short fp)
-       {
-               patternFormatting.setFillPattern(fp);
-               if( fp != 0)
-               {
-                       cfRuleRecord.setPatternStyleModified(true);
-               }
-       }
+     * @param bg
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillBackgroundColor(int)
+     */
+    public void setFillBackgroundColor(short bg)
+    {
+        patternFormatting.setFillBackgroundColor(bg);
+        if( bg != 0)
+        {
+            cfRuleRecord.setPatternBackgroundColorModified(true);
+        }
+    }
+
+    /**
+     * @param fg
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillForegroundColor(int)
+     */
+    public void setFillForegroundColor(short fg)
+    {
+        patternFormatting.setFillForegroundColor(fg);
+        if( fg != 0)
+        {
+            cfRuleRecord.setPatternColorModified(true);
+        }
+    }
+
+    /**
+     * @param fp
+     * @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillPattern(int)
+     */
+    public void setFillPattern(short fp)
+    {
+        patternFormatting.setFillPattern(fp);
+        if( fp != 0)
+        {
+            cfRuleRecord.setPatternStyleModified(true);
+        }
+    }
 }