You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TableStepper.java 20KB

Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 660979,660998,661276,661310,661999,662009,662203 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r660979 | vhennebert | 2008-05-28 16:24:23 +0100 (Wed, 28 May 2008) | 3 lines Bugzilla 37579: added support for footnotes in lists and table bodies (not header nor footer). This is /not/ to be considered a final fix: similar code is duplicated over several classes (LineLayoutManager, ListItemLayoutManager and to less extent TableStepper). Footnotes should probably be handled another way. ........ r660998 | maxberger | 2008-05-28 17:10:32 +0100 (Wed, 28 May 2008) | 1 line Implemented Font auto-selection word-by-word ........ r661276 | vhennebert | 2008-05-29 10:58:06 +0100 (Thu, 29 May 2008) | 2 lines Set svn:keywords and svn:eol-style properties for files added in revision 660998 ........ r661310 | maxberger | 2008-05-29 13:03:48 +0100 (Thu, 29 May 2008) | 1 line Added docs for my recent commit (word-by-word character selection) ........ r661999 | adelmelle | 2008-05-31 11:56:05 +0100 (Sat, 31 May 2008) | 3 lines Bugzilla 45097: Leading/trailing white-space not removed from nested inline-content when there is no preceding/following text. ........ r662009 | maxberger | 2008-05-31 12:45:55 +0100 (Sat, 31 May 2008) | 1 line Code Cleanups (no functional change) ........ r662203 | maxberger | 2008-06-01 12:57:33 +0100 (Sun, 01 Jun 2008) | 1 line More code Cleanups (no functional changes) ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@662442 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 660979,660998,661276,661310,661999,662009,662203 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r660979 | vhennebert | 2008-05-28 16:24:23 +0100 (Wed, 28 May 2008) | 3 lines Bugzilla 37579: added support for footnotes in lists and table bodies (not header nor footer). This is /not/ to be considered a final fix: similar code is duplicated over several classes (LineLayoutManager, ListItemLayoutManager and to less extent TableStepper). Footnotes should probably be handled another way. ........ r660998 | maxberger | 2008-05-28 17:10:32 +0100 (Wed, 28 May 2008) | 1 line Implemented Font auto-selection word-by-word ........ r661276 | vhennebert | 2008-05-29 10:58:06 +0100 (Thu, 29 May 2008) | 2 lines Set svn:keywords and svn:eol-style properties for files added in revision 660998 ........ r661310 | maxberger | 2008-05-29 13:03:48 +0100 (Thu, 29 May 2008) | 1 line Added docs for my recent commit (word-by-word character selection) ........ r661999 | adelmelle | 2008-05-31 11:56:05 +0100 (Sat, 31 May 2008) | 3 lines Bugzilla 45097: Leading/trailing white-space not removed from nested inline-content when there is no preceding/following text. ........ r662009 | maxberger | 2008-05-31 12:45:55 +0100 (Sat, 31 May 2008) | 1 line Code Cleanups (no functional change) ........ r662203 | maxberger | 2008-06-01 12:57:33 +0100 (Sun, 01 Jun 2008) | 1 line More code Cleanups (no functional changes) ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@662442 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 660979,660998,661276,661310,661999,662009,662203 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r660979 | vhennebert | 2008-05-28 16:24:23 +0100 (Wed, 28 May 2008) | 3 lines Bugzilla 37579: added support for footnotes in lists and table bodies (not header nor footer). This is /not/ to be considered a final fix: similar code is duplicated over several classes (LineLayoutManager, ListItemLayoutManager and to less extent TableStepper). Footnotes should probably be handled another way. ........ r660998 | maxberger | 2008-05-28 17:10:32 +0100 (Wed, 28 May 2008) | 1 line Implemented Font auto-selection word-by-word ........ r661276 | vhennebert | 2008-05-29 10:58:06 +0100 (Thu, 29 May 2008) | 2 lines Set svn:keywords and svn:eol-style properties for files added in revision 660998 ........ r661310 | maxberger | 2008-05-29 13:03:48 +0100 (Thu, 29 May 2008) | 1 line Added docs for my recent commit (word-by-word character selection) ........ r661999 | adelmelle | 2008-05-31 11:56:05 +0100 (Sat, 31 May 2008) | 3 lines Bugzilla 45097: Leading/trailing white-space not removed from nested inline-content when there is no preceding/following text. ........ r662009 | maxberger | 2008-05-31 12:45:55 +0100 (Sat, 31 May 2008) | 1 line Code Cleanups (no functional change) ........ r662203 | maxberger | 2008-06-01 12:57:33 +0100 (Sun, 01 Jun 2008) | 1 line More code Cleanups (no functional changes) ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@662442 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 660979,660998,661276,661310,661999,662009,662203 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r660979 | vhennebert | 2008-05-28 16:24:23 +0100 (Wed, 28 May 2008) | 3 lines Bugzilla 37579: added support for footnotes in lists and table bodies (not header nor footer). This is /not/ to be considered a final fix: similar code is duplicated over several classes (LineLayoutManager, ListItemLayoutManager and to less extent TableStepper). Footnotes should probably be handled another way. ........ r660998 | maxberger | 2008-05-28 17:10:32 +0100 (Wed, 28 May 2008) | 1 line Implemented Font auto-selection word-by-word ........ r661276 | vhennebert | 2008-05-29 10:58:06 +0100 (Thu, 29 May 2008) | 2 lines Set svn:keywords and svn:eol-style properties for files added in revision 660998 ........ r661310 | maxberger | 2008-05-29 13:03:48 +0100 (Thu, 29 May 2008) | 1 line Added docs for my recent commit (word-by-word character selection) ........ r661999 | adelmelle | 2008-05-31 11:56:05 +0100 (Sat, 31 May 2008) | 3 lines Bugzilla 45097: Leading/trailing white-space not removed from nested inline-content when there is no preceding/following text. ........ r662009 | maxberger | 2008-05-31 12:45:55 +0100 (Sat, 31 May 2008) | 1 line Code Cleanups (no functional change) ........ r662203 | maxberger | 2008-06-01 12:57:33 +0100 (Sun, 01 Jun 2008) | 1 line More code Cleanups (no functional changes) ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@662442 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 655489,655500,655522,655531,655578,655601,655603,655614,655766,655771,655775 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r655489 | vhennebert | 2008-05-12 13:30:42 +0100 (Mon, 12 May 2008) | 2 lines Replaced hack in TableStepper to get the steps' penalty values with a more proper implementation. Allows in the same time to avoid skimming, at each step, through the active cells' LinkedLists of elements, which may have a negative impact on performance ........ r655500 | adelmelle | 2008-05-12 14:42:49 +0100 (Mon, 12 May 2008) | 2 lines Extended caching to CondLengthProperty CommonBorderPaddingBackground.BorderInfo and CommonBorderPaddingBackground. ........ r655522 | adelmelle | 2008-05-12 16:24:06 +0100 (Mon, 12 May 2008) | 2 lines Tweak: avoid preloading the background-image with each pass through the constructor; only do so for non-cached instances ........ r655531 | adelmelle | 2008-05-12 16:34:49 +0100 (Mon, 12 May 2008) | 2 lines Avoid an error if unspecified... ........ r655578 | spepping | 2008-05-12 18:53:21 +0100 (Mon, 12 May 2008) | 3 lines Restore the previous behaviour of the column-number property, viz. if it is negative, it is set the next free column ........ r655601 | adelmelle | 2008-05-12 20:06:04 +0100 (Mon, 12 May 2008) | 1 line Added missing file from r655500 ........ r655603 | adelmelle | 2008-05-12 20:11:00 +0100 (Mon, 12 May 2008) | 1 line Re-enabled testcases that pass again after r655578 ........ r655614 | vhennebert | 2008-05-12 20:37:39 +0100 (Mon, 12 May 2008) | 3 lines Put the resolutions of collapsed borders together into the CollapsingBorderResolver class. The previous scheme allowed for early resolution of borders where possible, but made it hard to understand since the resolution was spread in the various table classes. Now everything is done inside a single class ........ r655766 | adelmelle | 2008-05-13 08:58:31 +0100 (Tue, 13 May 2008) | 2 lines Added support for auto-generated initial value for the "id" property. ........ r655771 | adelmelle | 2008-05-13 09:11:12 +0100 (Tue, 13 May 2008) | 1 line Alter auto-id naming to avoid confusion with URI fragment identifiers ........ r655775 | adelmelle | 2008-05-13 09:20:57 +0100 (Tue, 13 May 2008) | 1 line Javadoc fixups ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@655782 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 655489,655500,655522,655531,655578,655601,655603,655614,655766,655771,655775 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r655489 | vhennebert | 2008-05-12 13:30:42 +0100 (Mon, 12 May 2008) | 2 lines Replaced hack in TableStepper to get the steps' penalty values with a more proper implementation. Allows in the same time to avoid skimming, at each step, through the active cells' LinkedLists of elements, which may have a negative impact on performance ........ r655500 | adelmelle | 2008-05-12 14:42:49 +0100 (Mon, 12 May 2008) | 2 lines Extended caching to CondLengthProperty CommonBorderPaddingBackground.BorderInfo and CommonBorderPaddingBackground. ........ r655522 | adelmelle | 2008-05-12 16:24:06 +0100 (Mon, 12 May 2008) | 2 lines Tweak: avoid preloading the background-image with each pass through the constructor; only do so for non-cached instances ........ r655531 | adelmelle | 2008-05-12 16:34:49 +0100 (Mon, 12 May 2008) | 2 lines Avoid an error if unspecified... ........ r655578 | spepping | 2008-05-12 18:53:21 +0100 (Mon, 12 May 2008) | 3 lines Restore the previous behaviour of the column-number property, viz. if it is negative, it is set the next free column ........ r655601 | adelmelle | 2008-05-12 20:06:04 +0100 (Mon, 12 May 2008) | 1 line Added missing file from r655500 ........ r655603 | adelmelle | 2008-05-12 20:11:00 +0100 (Mon, 12 May 2008) | 1 line Re-enabled testcases that pass again after r655578 ........ r655614 | vhennebert | 2008-05-12 20:37:39 +0100 (Mon, 12 May 2008) | 3 lines Put the resolutions of collapsed borders together into the CollapsingBorderResolver class. The previous scheme allowed for early resolution of borders where possible, but made it hard to understand since the resolution was spread in the various table classes. Now everything is done inside a single class ........ r655766 | adelmelle | 2008-05-13 08:58:31 +0100 (Tue, 13 May 2008) | 2 lines Added support for auto-generated initial value for the "id" property. ........ r655771 | adelmelle | 2008-05-13 09:11:12 +0100 (Tue, 13 May 2008) | 1 line Alter auto-id naming to avoid confusion with URI fragment identifiers ........ r655775 | adelmelle | 2008-05-13 09:20:57 +0100 (Tue, 13 May 2008) | 1 line Javadoc fixups ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@655782 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 651323,651333,651538,651540,651543-651544,651551,651558 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651323 | spepping | 2008-04-24 18:46:31 +0100 (Thu, 24 Apr 2008) | 3 lines Improve table-unit computation if proportional-column-width() is used as a subexpression. Fixes bug 44658. ........ r651333 | spepping | 2008-04-24 19:19:06 +0100 (Thu, 24 Apr 2008) | 4 lines Make the eventResourceGenerator task for the test files a separate task. Now one can do: ant codegen, compile outside of ant, ant compile-copy-resources, ant junit-compile-copy-resources. ........ r651538 | jeremias | 2008-04-25 09:42:02 +0100 (Fri, 25 Apr 2008) | 1 line Javadocs ........ r651540 | jeremias | 2008-04-25 09:44:39 +0100 (Fri, 25 Apr 2008) | 1 line Cleanup ........ r651543 | adelmelle | 2008-04-25 09:59:56 +0100 (Fri, 25 Apr 2008) | 3 lines Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas. Additionally: some javadoc updates in BlockContainer.java ........ r651544 | acumiskey | 2008-04-25 10:04:06 +0100 (Fri, 25 Apr 2008) | 1 line Removed the tab characters that were causing a big moan from eclipse ........ r651551 | adelmelle | 2008-04-25 10:30:09 +0100 (Fri, 25 Apr 2008) | 3 lines Cleanup: removal of commented block/methods + some javadoc updates ........ r651558 | jeremias | 2008-04-25 11:07:58 +0100 (Fri, 25 Apr 2008) | 1 line Second part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-with-next/previous.within-column for all block-level FOs. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651570 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
Merged revisions 665691 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r665691 | jeremias | 2008-06-09 15:01:53 +0100 (Mon, 09 Jun 2008) | 82 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-664698 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r638937 | jeremias | 2008-03-19 18:08:57 +0100 (Mi, 19 Mrz 2008) | 1 line A nit. ........ r640889 | vhennebert | 2008-03-25 17:43:55 +0100 (Di, 25 Mrz 2008) | 2 lines Set the final release date and added a news item about the 0.95beta release (the change was made before updating the website) ........ r642906 | jeremias | 2008-03-31 09:12:40 +0200 (Mo, 31 Mrz 2008) | 3 lines Added version number to xml-apis-ext (as suggested by Karel Vervaeke). Moved xml-apis to same version as xml-apis-ext. Added missing licensing info about xml-apis-ext. ........ r647403 | jeremias | 2008-04-12 11:02:01 +0200 (Sa, 12 Apr 2008) | 1 line Fixed NullPointerException when loading a TrueType font using XML font metric files. ........ r647537 | jeremias | 2008-04-13 09:36:00 +0200 (So, 13 Apr 2008) | 1 line Performance improvement when encoding images: Fixed an important hotspot by extending CloseBlocker from ProxyOutputStream instead of FilterOutputStream as the latter routes all write(byte[]) calls through write(int). ........ r648984 | jeremias | 2008-04-17 09:00:22 +0200 (Do, 17 Apr 2008) | 1 line HeadURL was missing in the properties. ........ r649006 | jeremias | 2008-04-17 10:42:52 +0200 (Do, 17 Apr 2008) | 1 line Fixed text extraction problem with ZapfDingbats and Symbol font in PDF output. These fonts are symbolic and must not use an Encoding value in PDF. Applies to the built-in base 14 variant and to the case where these fonts are explicitely embedded. ........ r649014 | jeremias | 2008-04-17 11:10:15 +0200 (Do, 17 Apr 2008) | 1 line Added missing change information. ........ r650550 | vhennebert | 2008-04-22 17:22:31 +0200 (Di, 22 Apr 2008) | 4 lines Bugzilla 41621: - length of the penalty now correctly computed; - AssertionError fixed. ........ r651302 | jeremias | 2008-04-24 18:08:53 +0200 (Do, 24 Apr 2008) | 3 lines Fixed regression causing bad positioning of block-containers if used as descendant of a table-cell. This was not caught because of the lack of a test case that would have shown the problem in visual testing with BatchDiffer. See also: http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200804.mbox/%3c20080424164128.973A.DEV@jeremias-maerki.ch%3e ........ r653537 | vhennebert | 2008-05-05 19:47:28 +0200 (Mo, 05 Mai 2008) | 2 lines Bugfix: the before border of cells below a column-spanning cell had their value taken from the leading case, instead of the normal one. ........ r654453 | jeremias | 2008-05-08 11:14:04 +0200 (Do, 08 Mai 2008) | 2 lines Added /usr/local/share/fonts as additional possible location for fonts on Unixes. ........ r656286 | jeremias | 2008-05-14 16:16:49 +0200 (Mi, 14 Mai 2008) | 1 line Restored plug-in API compatibility with FOP 0.94. Fixes a NoSuchMethodError when Barcode4J is run. ........ r656524 | jeremias | 2008-05-15 09:07:18 +0200 (Do, 15 Mai 2008) | 1 line Fixed rendering of fixed block-containers in AFP output. The break-out was actually never implemented which is necessary for supporting fixed positioned viewports. ........ r657520 | maxberger | 2008-05-18 11:38:45 +0200 (So, 18 Mai 2008) | 1 line Updated as per suggestions in bug 45019 ........ r661580 | maxberger | 2008-05-30 08:42:17 +0200 (Fr, 30 Mai 2008) | 1 line added my key to KEYS, it is used for signing mvn artifacts ........ r663482 | jeremias | 2008-06-05 09:06:37 +0200 (Do, 05 Jun 2008) | 1 line Fixed positioning of absolutely positioned block-containers in multi-column documents. ........ r664692 | jeremias | 2008-06-09 14:49:45 +0200 (Mo, 09 Jun 2008) | 1 line Restored PSImageUtils. I had deleted it prematurely. Extensions like Barcode4J rely on this class. ........ ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@665697 13f79535-47bb-0310-9956-ffa450edef68
16 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.layoutmgr.table;
  19. import java.util.Iterator;
  20. import java.util.LinkedList;
  21. import java.util.List;
  22. import org.apache.commons.logging.Log;
  23. import org.apache.commons.logging.LogFactory;
  24. import org.apache.fop.fo.Constants;
  25. import org.apache.fop.fo.flow.table.EffRow;
  26. import org.apache.fop.fo.flow.table.GridUnit;
  27. import org.apache.fop.fo.flow.table.PrimaryGridUnit;
  28. import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
  29. import org.apache.fop.layoutmgr.BreakElement;
  30. import org.apache.fop.layoutmgr.KeepUtil;
  31. import org.apache.fop.layoutmgr.KnuthBlockBox;
  32. import org.apache.fop.layoutmgr.KnuthBox;
  33. import org.apache.fop.layoutmgr.KnuthElement;
  34. import org.apache.fop.layoutmgr.KnuthGlue;
  35. import org.apache.fop.layoutmgr.KnuthPenalty;
  36. import org.apache.fop.layoutmgr.LayoutContext;
  37. import org.apache.fop.layoutmgr.Position;
  38. import org.apache.fop.util.BreakUtil;
  39. /**
  40. * This class processes row groups to create combined element lists for tables.
  41. */
  42. public class TableStepper {
  43. /** Logger **/
  44. private static Log log = LogFactory.getLog(TableStepper.class);
  45. private TableContentLayoutManager tclm;
  46. private EffRow[] rowGroup;
  47. /** Number of columns in the row group. */
  48. private int columnCount;
  49. private int totalHeight;
  50. private int previousRowsLength;
  51. private int activeRowIndex;
  52. private boolean rowFinished;
  53. /** Cells spanning the current row. */
  54. private List activeCells = new LinkedList();
  55. /** Cells that will start the next row. */
  56. private List nextActiveCells = new LinkedList();
  57. /**
  58. * True if the next row is being delayed, that is, if cells spanning the current and
  59. * the next row have steps smaller than the next row's first step. In this case the
  60. * next row may be extended to offer additional break possibilities.
  61. */
  62. private boolean delayingNextRow;
  63. /**
  64. * The first step for a row. This is the minimal step necessary to include some
  65. * content from all the cells starting the row.
  66. */
  67. private int rowFirstStep;
  68. /**
  69. * Flag used to produce an infinite penalty if the height of the current row is
  70. * smaller than the first step for that row (may happen with row-spanning cells).
  71. *
  72. * @see #considerRowLastStep(int)
  73. */
  74. private boolean rowHeightSmallerThanFirstStep;
  75. /**
  76. * The class of the next break. One of {@link Constants#EN_AUTO},
  77. * {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
  78. * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}. Defaults to
  79. * EN_AUTO.
  80. */
  81. private int nextBreakClass;
  82. /**
  83. * Main constructor
  84. * @param tclm The parent TableContentLayoutManager
  85. */
  86. public TableStepper(TableContentLayoutManager tclm) {
  87. this.tclm = tclm;
  88. this.columnCount = tclm.getTableLM().getTable().getNumberOfColumns();
  89. }
  90. /**
  91. * Initializes the fields of this instance to handle a new row group.
  92. *
  93. * @param rows the new row group to handle
  94. */
  95. private void setup(EffRow[] rows) {
  96. rowGroup = rows;
  97. previousRowsLength = 0;
  98. activeRowIndex = 0;
  99. activeCells.clear();
  100. nextActiveCells.clear();
  101. delayingNextRow = false;
  102. rowFirstStep = 0;
  103. rowHeightSmallerThanFirstStep = false;
  104. }
  105. private void calcTotalHeight() {
  106. totalHeight = 0;
  107. for (int i = 0; i < rowGroup.length; i++) {
  108. totalHeight += rowGroup[i].getHeight().opt;
  109. }
  110. if (log.isDebugEnabled()) {
  111. log.debug("totalHeight=" + totalHeight);
  112. }
  113. }
  114. private int getMaxRemainingHeight() {
  115. int maxW = 0;
  116. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  117. ActiveCell activeCell = (ActiveCell) iter.next();
  118. int remain = activeCell.getRemainingLength();
  119. PrimaryGridUnit pgu = activeCell.getPrimaryGridUnit();
  120. for (int i = activeRowIndex + 1; i < pgu.getRowIndex() - rowGroup[0].getIndex()
  121. + pgu.getCell().getNumberRowsSpanned(); i++) {
  122. remain -= rowGroup[i].getHeight().opt;
  123. }
  124. maxW = Math.max(maxW, remain);
  125. }
  126. for (int i = activeRowIndex + 1; i < rowGroup.length; i++) {
  127. maxW += rowGroup[i].getHeight().opt;
  128. }
  129. return maxW;
  130. }
  131. /**
  132. * Creates ActiveCell instances for cells starting on the row at the given index.
  133. *
  134. * @param activeCellList the list that will hold the active cells
  135. * @param rowIndex the index of the row from which cells must be activated
  136. */
  137. private void activateCells(List activeCellList, int rowIndex) {
  138. EffRow row = rowGroup[rowIndex];
  139. for (int i = 0; i < columnCount; i++) {
  140. GridUnit gu = row.getGridUnit(i);
  141. if (!gu.isEmpty() && gu.isPrimary()) {
  142. activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex,
  143. previousRowsLength, getTableLM()));
  144. }
  145. }
  146. }
  147. /**
  148. * Creates the combined element list for a row group.
  149. * @param context Active LayoutContext
  150. * @param rows the row group
  151. * @param bodyType Indicates what type of body is processed (body, header or footer)
  152. * @return the combined element list
  153. */
  154. public LinkedList getCombinedKnuthElementsForRowGroup(LayoutContext context, EffRow[] rows,
  155. int bodyType) {
  156. setup(rows);
  157. activateCells(activeCells, 0);
  158. calcTotalHeight();
  159. int cumulateLength = 0; // Length of the content accumulated before the break
  160. TableContentPosition lastTCPos = null;
  161. LinkedList returnList = new LinkedList();
  162. int laststep = 0;
  163. int step = getFirstStep();
  164. do {
  165. int maxRemainingHeight = getMaxRemainingHeight();
  166. int penaltyOrGlueLen = step + maxRemainingHeight - totalHeight;
  167. int boxLen = step - cumulateLength - Math.max(0, penaltyOrGlueLen)/* penalty, if any */;
  168. cumulateLength += boxLen + Math.max(0, -penaltyOrGlueLen)/* the glue, if any */;
  169. if (log.isDebugEnabled()) {
  170. log.debug("Next step: " + step + " (+" + (step - laststep) + ")");
  171. log.debug(" max remaining height: " + maxRemainingHeight);
  172. if (penaltyOrGlueLen >= 0) {
  173. log.debug(" box = " + boxLen + " penalty = " + penaltyOrGlueLen);
  174. } else {
  175. log.debug(" box = " + boxLen + " glue = " + (-penaltyOrGlueLen));
  176. }
  177. }
  178. LinkedList footnoteList = new LinkedList();
  179. //Put all involved grid units into a list
  180. List cellParts = new java.util.ArrayList(columnCount);
  181. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  182. ActiveCell activeCell = (ActiveCell) iter.next();
  183. CellPart part = activeCell.createCellPart();
  184. cellParts.add(part);
  185. activeCell.addFootnotes(footnoteList);
  186. }
  187. //Create elements for step
  188. TableContentPosition tcpos = new TableContentPosition(getTableLM(),
  189. cellParts, rowGroup[activeRowIndex]);
  190. if (delayingNextRow) {
  191. tcpos.setNewPageRow(rowGroup[activeRowIndex + 1]);
  192. }
  193. if (returnList.size() == 0) {
  194. tcpos.setFlag(TableContentPosition.FIRST_IN_ROWGROUP, true);
  195. }
  196. lastTCPos = tcpos;
  197. // TODO TableStepper should remain as footnote-agnostic as possible
  198. if (footnoteList.isEmpty()) {
  199. returnList.add(new KnuthBox(boxLen, tcpos, false));
  200. } else {
  201. returnList.add(new KnuthBlockBox(boxLen, footnoteList, tcpos, false));
  202. }
  203. int effPenaltyLen = Math.max(0, penaltyOrGlueLen);
  204. TableHFPenaltyPosition penaltyPos = new TableHFPenaltyPosition(getTableLM());
  205. if (bodyType == TableRowIterator.BODY) {
  206. if (!getTableLM().getTable().omitHeaderAtBreak()) {
  207. effPenaltyLen += tclm.getHeaderNetHeight();
  208. penaltyPos.headerElements = tclm.getHeaderElements();
  209. }
  210. if (!getTableLM().getTable().omitFooterAtBreak()) {
  211. effPenaltyLen += tclm.getFooterNetHeight();
  212. penaltyPos.footerElements = tclm.getFooterElements();
  213. }
  214. }
  215. int strength = BlockLevelLayoutManager.KEEP_AUTO;
  216. int stepPenalty = 0;
  217. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  218. ActiveCell activeCell = (ActiveCell) iter.next();
  219. strength = Math.max(strength, activeCell.getKeepWithNextStrength());
  220. stepPenalty = Math.max(stepPenalty, activeCell.getPenaltyValue());
  221. }
  222. if (!rowFinished) {
  223. strength = Math.max(strength, rowGroup[activeRowIndex].getKeepTogetherStrength());
  224. //The above call doesn't take the penalty from the table into account, so...
  225. strength = Math.max(strength, getTableLM().getKeepTogetherStrength());
  226. } else if (activeRowIndex < rowGroup.length - 1) {
  227. strength = Math.max(strength,
  228. rowGroup[activeRowIndex].getKeepWithNextStrength());
  229. strength = Math.max(strength,
  230. rowGroup[activeRowIndex + 1].getKeepWithPreviousStrength());
  231. nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
  232. rowGroup[activeRowIndex].getBreakAfter());
  233. nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
  234. rowGroup[activeRowIndex + 1].getBreakBefore());
  235. }
  236. int p = KeepUtil.getPenaltyForKeep(strength);
  237. if (rowHeightSmallerThanFirstStep) {
  238. rowHeightSmallerThanFirstStep = false;
  239. p = KnuthPenalty.INFINITE;
  240. }
  241. if (p > -KnuthElement.INFINITE) {
  242. p = Math.max(p, stepPenalty);
  243. }
  244. if (nextBreakClass != Constants.EN_AUTO) {
  245. log.trace("Forced break encountered");
  246. p = -KnuthPenalty.INFINITE; //Overrides any keeps (see 4.8 in XSL 1.0)
  247. }
  248. returnList.add(new BreakElement(penaltyPos, effPenaltyLen, p, nextBreakClass, context));
  249. if (penaltyOrGlueLen < 0) {
  250. returnList.add(new KnuthGlue(-penaltyOrGlueLen, 0, 0, new Position(null), true));
  251. }
  252. laststep = step;
  253. step = getNextStep();
  254. } while (step >= 0);
  255. assert !returnList.isEmpty();
  256. lastTCPos.setFlag(TableContentPosition.LAST_IN_ROWGROUP, true);
  257. return returnList;
  258. }
  259. /**
  260. * Returns the first step for the current row group.
  261. *
  262. * @return the first step for the current row group
  263. */
  264. private int getFirstStep() {
  265. computeRowFirstStep(activeCells);
  266. signalRowFirstStep();
  267. int minStep = considerRowLastStep(rowFirstStep);
  268. signalNextStep(minStep);
  269. return minStep;
  270. }
  271. /**
  272. * Returns the next break possibility.
  273. *
  274. * @return the next step
  275. */
  276. private int getNextStep() {
  277. if (rowFinished) {
  278. if (activeRowIndex == rowGroup.length - 1) {
  279. // The row group is finished, no next step
  280. return -1;
  281. }
  282. rowFinished = false;
  283. removeCellsEndingOnCurrentRow();
  284. log.trace("Delaying next row");
  285. delayingNextRow = true;
  286. }
  287. if (delayingNextRow) {
  288. int minStep = computeMinStep();
  289. if (minStep < 0 || minStep >= rowFirstStep
  290. || minStep > rowGroup[activeRowIndex].getExplicitHeight().max) {
  291. if (log.isTraceEnabled()) {
  292. log.trace("Step = " + minStep);
  293. }
  294. delayingNextRow = false;
  295. minStep = rowFirstStep;
  296. switchToNextRow();
  297. signalRowFirstStep();
  298. minStep = considerRowLastStep(minStep);
  299. }
  300. signalNextStep(minStep);
  301. return minStep;
  302. } else {
  303. int minStep = computeMinStep();
  304. minStep = considerRowLastStep(minStep);
  305. signalNextStep(minStep);
  306. return minStep;
  307. }
  308. }
  309. /**
  310. * Computes the minimal necessary step to make the next row fit. That is, so such as
  311. * cell on the next row can contribute some content.
  312. *
  313. * @param cells the cells occupying the next row (may include cells starting on
  314. * previous rows and spanning over this one)
  315. */
  316. private void computeRowFirstStep(List cells) {
  317. for (Iterator iter = cells.iterator(); iter.hasNext();) {
  318. ActiveCell activeCell = (ActiveCell) iter.next();
  319. rowFirstStep = Math.max(rowFirstStep, activeCell.getFirstStep());
  320. }
  321. }
  322. /**
  323. * Computes the next minimal step.
  324. *
  325. * @return the minimal step from the active cells, &lt; 0 if there is no such step
  326. */
  327. private int computeMinStep() {
  328. int minStep = Integer.MAX_VALUE;
  329. boolean stepFound = false;
  330. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  331. ActiveCell activeCell = (ActiveCell) iter.next();
  332. int nextStep = activeCell.getNextStep();
  333. if (nextStep >= 0) {
  334. stepFound = true;
  335. minStep = Math.min(minStep, nextStep);
  336. }
  337. }
  338. if (stepFound) {
  339. return minStep;
  340. } else {
  341. return -1;
  342. }
  343. }
  344. /**
  345. * Signals the first step to the active cells, to allow them to add more content to
  346. * the step if possible.
  347. *
  348. * @see ActiveCell#signalRowFirstStep(int)
  349. */
  350. private void signalRowFirstStep() {
  351. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  352. ActiveCell activeCell = (ActiveCell) iter.next();
  353. activeCell.signalRowFirstStep(rowFirstStep);
  354. }
  355. }
  356. /**
  357. * Signals the next selected step to the active cells.
  358. *
  359. * @param step the next step
  360. */
  361. private void signalNextStep(int step) {
  362. nextBreakClass = Constants.EN_AUTO;
  363. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  364. ActiveCell activeCell = (ActiveCell) iter.next();
  365. nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
  366. activeCell.signalNextStep(step));
  367. }
  368. }
  369. /**
  370. * Determines if the given step will finish the current row, and if so switch to the
  371. * last step for this row.
  372. * <p>If the row is finished then the after borders for the cell may change (their
  373. * conditionalities no longer apply for the cells ending on the current row). Thus the
  374. * final step may grow with respect to the given one.</p>
  375. * <p>In more rare occasions, the given step may correspond to the first step of a
  376. * row-spanning cell, and may be greater than the height of the current row (consider,
  377. * for example, an unbreakable cell spanning three rows). In such a case the returned
  378. * step will correspond to the row height and a flag will be set to produce an
  379. * infinite penalty for this step. This will prevent the breaking algorithm from
  380. * choosing this break, but still allow to create the appropriate TableContentPosition
  381. * for the cells ending on the current row.</p>
  382. *
  383. * @param step the next step
  384. * @return the updated step if any
  385. */
  386. private int considerRowLastStep(int step) {
  387. rowFinished = true;
  388. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  389. ActiveCell activeCell = (ActiveCell) iter.next();
  390. if (activeCell.endsOnRow(activeRowIndex)) {
  391. rowFinished &= activeCell.finishes(step);
  392. }
  393. }
  394. if (rowFinished) {
  395. if (log.isTraceEnabled()) {
  396. log.trace("Step = " + step);
  397. log.trace("Row finished, computing last step");
  398. }
  399. int maxStep = 0;
  400. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  401. ActiveCell activeCell = (ActiveCell) iter.next();
  402. if (activeCell.endsOnRow(activeRowIndex)) {
  403. maxStep = Math.max(maxStep, activeCell.getLastStep());
  404. }
  405. }
  406. if (log.isTraceEnabled()) {
  407. log.trace("Max step: " + maxStep);
  408. }
  409. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  410. ActiveCell activeCell = (ActiveCell) iter.next();
  411. activeCell.endRow(activeRowIndex);
  412. if (!activeCell.endsOnRow(activeRowIndex)) {
  413. activeCell.signalRowLastStep(maxStep);
  414. }
  415. }
  416. if (maxStep < step) {
  417. log.trace("Row height smaller than first step, produced penalty will be infinite");
  418. rowHeightSmallerThanFirstStep = true;
  419. }
  420. step = maxStep;
  421. prepareNextRow();
  422. }
  423. return step;
  424. }
  425. /**
  426. * Pre-activates the cells that will start the next row, and computes the first step
  427. * for that row.
  428. */
  429. private void prepareNextRow() {
  430. if (activeRowIndex < rowGroup.length - 1) {
  431. previousRowsLength += rowGroup[activeRowIndex].getHeight().opt;
  432. activateCells(nextActiveCells, activeRowIndex + 1);
  433. if (log.isTraceEnabled()) {
  434. log.trace("Computing first step for row " + (activeRowIndex + 2));
  435. }
  436. computeRowFirstStep(nextActiveCells);
  437. if (log.isTraceEnabled()) {
  438. log.trace("Next first step = " + rowFirstStep);
  439. }
  440. }
  441. }
  442. private void removeCellsEndingOnCurrentRow() {
  443. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  444. ActiveCell activeCell = (ActiveCell) iter.next();
  445. if (activeCell.endsOnRow(activeRowIndex)) {
  446. iter.remove();
  447. }
  448. }
  449. }
  450. /**
  451. * Actually switches to the next row, increasing activeRowIndex and transferring to
  452. * activeCells the cells starting on the next row.
  453. */
  454. private void switchToNextRow() {
  455. activeRowIndex++;
  456. if (log.isTraceEnabled()) {
  457. log.trace("Switching to row " + (activeRowIndex + 1));
  458. }
  459. for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
  460. ActiveCell activeCell = (ActiveCell) iter.next();
  461. activeCell.nextRowStarts();
  462. }
  463. activeCells.addAll(nextActiveCells);
  464. nextActiveCells.clear();
  465. }
  466. /** @return the table layout manager */
  467. private TableLayoutManager getTableLM() {
  468. return this.tclm.getTableLM();
  469. }
  470. }