You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2015/07/14 20:35:05 UTC

svn commit: r1691049 - in /poi/trunk/src/java/org/apache/poi/hssf/usermodel: HSSFConditionalFormattingRule.java HSSFPatternFormatting.java

Author: nick
Date: Tue Jul 14 18:35:04 2015
New Revision: 1691049

URL: http://svn.apache.org/r1691049
Log:
Fix inconsistent whitespace/formatting

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java?rev=1691049&r1=1691048&r2=1691049&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java Tue Jul 14 18:35:04 2015
@@ -35,182 +35,179 @@ import org.apache.poi.ss.usermodel.Condi
  * 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 static final byte CELL_COMPARISON = CFRuleRecord.CONDITION_TYPE_CELL_VALUE_IS;
 
-	private final CFRuleBase cfRuleRecord;
-	private final HSSFWorkbook workbook;
+    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();
-	}
+    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);
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java?rev=1691049&r1=1691048&r2=1691049&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java Tue Jul 14 18:35:04 2015
@@ -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;
-	}
+    private final CFRuleBase cfRuleRecord;
+    private final PatternFormatting patternFormatting;
 
-	public HSSFColor getFillBackgroundColorColor() {
+    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 imple
     }
 
     /**
-	 * @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 imple
     }
 
     /**
-	 * @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);
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org