cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr TraitSetter.java

2005-02-07 Thread jeremias
jeremias2005/02/07 02:59:25

  Modified:src/java/org/apache/fop/layoutmgr TraitSetter.java
  Log:
  use hasBackground() as a fail-fast.
  
  Revision  ChangesPath
  1.17  +4 -3  
xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java
  
  Index: TraitSetter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TraitSetter.java  25 Jan 2005 12:53:29 -  1.16
  +++ TraitSetter.java  7 Feb 2005 10:59:25 -   1.17
  @@ -165,6 +165,9 @@
* @param backProps the background properties
*/
   public static void addBackground(Area area, 
CommonBorderPaddingBackground backProps) {
  +if (!backProps.hasBackground()) {
  +return;
  +}
   Trait.Background back = new Trait.Background();
   back.setColor(backProps.backgroundColor);
   
  @@ -213,9 +216,7 @@
   }
   }
   
  -if (back.getColor() != null || back.getFopImage() != null) {
  -area.addTrait(Trait.BACKGROUND, back);
  -}
  +area.addTrait(Trait.BACKGROUND, back);
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr TraitSetter.java BlockLayoutManager.java

2005-01-07 Thread jeremias
jeremias2005/01/07 00:21:21

  Modified:src/java/org/apache/fop/fo/properties CommonMarginBlock.java
   src/java/org/apache/fop/layoutmgr TraitSetter.java
BlockLayoutManager.java
  Log:
  Bugfix for start-indent calculation for nested blocks. The inherited 
start-indent wasn't taken into account as described in 5.3.2 of the spec.
  Minor style and javadoc improvements on the way.
  
  Revision  ChangesPath
  1.5   +34 -2 
xml-fop/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
  
  Index: CommonMarginBlock.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CommonMarginBlock.java28 Oct 2004 10:00:24 -  1.4
  +++ CommonMarginBlock.java7 Jan 2005 08:21:21 -   1.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 1999-2004 The Apache Software Foundation.
  + * Copyright 1999-2005 The Apache Software Foundation.
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
  @@ -70,6 +70,16 @@
   public Length endIndent;
   
   /**
  + * The inherited "start-indent" property.
  + */
  +public Length inheritedStartIndent;
  +
  +/**
  + * The inherited "end-indent" property.
  + */
  +public Length inheritedEndIndent;
  +
  +/**
* Create a CommonMarginBlock object.
* @param pList The PropertyList with propery values.
*/
  @@ -84,5 +94,27 @@
   
   startIndent = pList.get(Constants.PR_START_INDENT).getLength();
   endIndent = pList.get(Constants.PR_END_INDENT).getLength();
  +
  +if (!pList.getFObj().generatesReferenceAreas()) {
  +inheritedStartIndent = pList.getParentPropertyList()
  +.get(Constants.PR_START_INDENT).getLength();
  +inheritedEndIndent = pList.getParentPropertyList()
  +.get(Constants.PR_END_INDENT).getLength();
  +}
  +}
  +
  +/** @see java.lang.Object#toString() */
  +public String toString() {
  +return "CommonMarginBlock:\n" 
  ++ "Margins (top, bottom, left, right): (" 
  ++ marginTop + ", " + marginBottom + ", " 
  ++ marginLeft + ", " + marginRight + ")\n"
  ++ "Space (before, after): (" 
  ++ spaceBefore + ", " + spaceAfter + ")\n" 
  ++ "Indents (start, end): ("
  ++ startIndent + ", " + endIndent + ")\n"
  ++ "Indents inherited (start, end): (" 
  ++ inheritedStartIndent + ", " + inheritedEndIndent + ")\n";
   }
  +
   }
  
  
  
  1.11  +33 -22
xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java
  
  Index: TraitSetter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TraitSetter.java  20 Oct 2004 11:55:32 -  1.10
  +++ TraitSetter.java  7 Jan 2005 08:21:21 -   1.11
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 1999-2004 The Apache Software Foundation.
  + * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
  @@ -33,6 +33,8 @@
* Sets border and padding traits on areas.
* @param area area to set the traits on
* @param bpProps border and padding properties
  + * @param bNotFirst True if the area is not the first area
  + * @param bNotLast True if the area is not the last area
*/
   public static void setBorderPaddingTraits(Area area,
   CommonBorderPaddingBackground bpProps, boolean bNotFirst, 
boolean bNotLast) {
  @@ -96,45 +98,45 @@
* Add borders to an area.
* Layout managers that create areas with borders can use this to
* add the borders to the area.
  - * @param curBlock area to set the traits on
  + * @param area the area to set the traits on.
* @param bordProps border properties
*/
  -public static void addBorders(Area curBlock, 
CommonBorderPaddingBackground bordProps) {
  +public static void addBorders(Area area, CommonBorderPaddingBackground 
bordProps) {
   BorderProps bps = getBorderProps(bordProps, 
CommonBorderPaddingBackground.BEFORE);
   if (bps.width != 0) {
  -curBlock.addTrait(Trait.BORDER_BEFORE, bps);
  +area.addTrait(Trait.BORDER_BEFORE, bps);
   }
   bps = getBorderProps(bordProps, CommonBorderPaddingBackground.AFTER);
   if (bps.width != 0) {
  -curBlock.a

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr TraitSetter.java

2004-06-16 Thread jeremias
jeremias2004/06/16 14:29:11

  Modified:src/java/org/apache/fop/layoutmgr TraitSetter.java
  Log:
  Removed illegal tab character

  Removed some of the checkstyle warnings while at it.
  
  Revision  ChangesPath
  1.8   +7 -7  xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java
  
  Index: TraitSetter.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TraitSetter.java  27 May 2004 10:52:33 -  1.7
  +++ TraitSetter.java  16 Jun 2004 21:29:11 -  1.8
  @@ -185,23 +185,23 @@
   public static void addMargins(Area curBlock,
 CommonBorderAndPadding bpProps,
 CommonMarginBlock marginProps) {
  -int spaceStart = marginProps.startIndent -
  -bpProps.getBorderStartWidth(false) -
  -bpProps.getPaddingStart(false);
  +int spaceStart = marginProps.startIndent 
  +- bpProps.getBorderStartWidth(false)
  +- bpProps.getPaddingStart(false);
   if (spaceStart != 0) {
   curBlock.addTrait(Trait.SPACE_START, new Integer(spaceStart));
   }
   
  -int spaceEnd = marginProps.endIndent -
  -   bpProps.getBorderEndWidth(false) -
  -   bpProps.getPaddingEnd(false);
  +int spaceEnd = marginProps.endIndent
  +- bpProps.getBorderEndWidth(false)
  +- bpProps.getPaddingEnd(false);
   if (spaceEnd != 0) {
   curBlock.addTrait(Trait.SPACE_END, new Integer(spaceEnd));
   }
   }
   
   public static void addBreaks(Area curArea, LayoutProps layoutProps) {
  - curArea.addTrait(Trait.BREAK_AFTER, new Integer(layoutProps.breakAfter));
  +curArea.addTrait(Trait.BREAK_AFTER, new Integer(layoutProps.breakAfter));
   curArea.addTrait(Trait.BREAK_BEFORE, new Integer(layoutProps.breakBefore));
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]