From c3ac99e58b7c66fe8fe23b32930f93d66cb59581 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Mon, 28 Apr 2014 19:22:32 +0000 Subject: Renamed value of auto-toggle property to select-first-fitting git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_WhitespaceManagement@1590754 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/Constants.java | 4 +- src/java/org/apache/fop/fo/FOPropertyMapping.java | 5 +- src/java/org/apache/fop/fo/flow/MultiSwitch.java | 6 +- .../fop/layoutmgr/MultiSwitchLayoutManager.java | 3 +- .../standard-testcases/multi-switch_best-fit.xml | 51 -------- .../multi-switch_best-fit_forced_page_break.xml | 67 ----------- .../multi-switch_best-fit_middle-page.xml | 63 ---------- .../multi-switch_best-fit_multiple-variants.xml | 130 --------------------- ...i-switch_best-fit_multiple_dynamic_contents.xml | 98 ---------------- .../multi-switch_best-fit_padding.xml | 70 ----------- .../multi-switch_select-first-fitting.xml | 51 ++++++++ ...itch_select-first-fitting_forced-page-break.xml | 67 +++++++++++ ...lti-switch_select-first-fitting_middle-page.xml | 63 ++++++++++ ...itch_select-first-fitting_multiple-variants.xml | 130 +++++++++++++++++++++ .../multi-switch_select-first-fitting_padding.xml | 70 +++++++++++ ...h_select-first-fitting_several-multi-switch.xml | 98 ++++++++++++++++ 16 files changed, 490 insertions(+), 486 deletions(-) delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit.xml delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit_forced_page_break.xml delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit_middle-page.xml delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit_multiple-variants.xml delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit_multiple_dynamic_contents.xml delete mode 100644 test/layoutengine/standard-testcases/multi-switch_best-fit_padding.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting_forced-page-break.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting_middle-page.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting_multiple-variants.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting_padding.xml create mode 100644 test/layoutengine/standard-testcases/multi-switch_select-first-fitting_several-multi-switch.xml diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java index 3fae008b5..2d53d1d46 100644 --- a/src/java/org/apache/fop/fo/Constants.java +++ b/src/java/org/apache/fop/fo/Constants.java @@ -1263,6 +1263,8 @@ public interface Constants { int EN_TB_LR = 205; // for top-to-bottom, left-to-right writing mode /** Enumeration constant -- for fo:retrieve-table-marker */ int EN_FIRST_INCLUDING_CARRYOVER = 206; + /** Enumeration constant -- for auto-toggle */ + int EN_SELECT_FIRST_FITTING = 207; /** Number of enumeration constants defined */ - int ENUM_COUNT = 206; + int ENUM_COUNT = 207; } diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java index 26ead3bd0..16f7ab457 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java @@ -2618,9 +2618,10 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("fox:alt-text", m); // fox:auto-toggle, used only in fo:multi-switch - m = new StringProperty.Maker(PR_X_AUTO_TOGGLE); + m = new EnumProperty.Maker(PR_X_AUTO_TOGGLE); m.setInherited(false); - m.setDefault(""); + m.addEnum("select-first-fitting", getEnumProperty(EN_SELECT_FIRST_FITTING, "SELECT_FIRST_FITTING")); + m.setDefault("select-first-fitting"); addPropertyMaker("fox:auto-toggle", m); // fox:border-*-radius-* diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index f681f1695..1248d1ca4 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -38,7 +38,7 @@ public class MultiSwitch extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - private String autoToggle; + private int autoToggle; /** * Base constructor @@ -53,7 +53,7 @@ public class MultiSwitch extends FObj { @Override public void bind(PropertyList pList) throws FOPException { super.bind(pList); - autoToggle = pList.get(PR_X_AUTO_TOGGLE).getString(); + autoToggle = pList.get(PR_X_AUTO_TOGGLE).getEnum(); // autoRestore = pList.get(PR_AUTO_RESTORE); } @@ -95,7 +95,7 @@ public class MultiSwitch extends FObj { return FO_MULTI_SWITCH; } - public String getAutoToggle() { + public int getAutoToggle() { return autoToggle; } diff --git a/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java b/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java index 2aff34e14..1310fb888 100644 --- a/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java @@ -21,6 +21,7 @@ import java.util.LinkedList; import java.util.List; import org.apache.fop.area.Area; +import org.apache.fop.fo.Constants; import org.apache.fop.fo.FObj; import org.apache.fop.fo.flow.MultiSwitch; @@ -118,7 +119,7 @@ public class MultiSwitchLayoutManager extends BlockStackingLayoutManager { public MultiSwitchLayoutManager(FObj node) { super(node); MultiSwitch multiSwitchNode = (MultiSwitch) node; - if (multiSwitchNode.getAutoToggle().equals("best-fit")) { + if (multiSwitchNode.getAutoToggle() == Constants.EN_SELECT_FIRST_FITTING) { knuthGen = new WhitespaceManagement(); } else { knuthGen = new DefaultKnuthListGenerator(); diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit.xml deleted file mode 100644 index d41fa1c13..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - -

- Basic test for fo:multi-switch using the whitespace management extension. -

-
- - - - - - - - - - - - First variant - - - Second variant - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit_forced_page_break.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit_forced_page_break.xml deleted file mode 100644 index 6b47dcf32..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit_forced_page_break.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - -

- Test forced page breaks. -

-
- - - - - - - - - - - Block 1 page 1 - - - MS1 Variant 1 - - - - - - MS2 Variant 1 - - - - Block 2 page 3 - - - MS3 Variant 1 - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit_middle-page.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit_middle-page.xml deleted file mode 100644 index 6b9342b85..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit_middle-page.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - -

- Dynamic content in the middle of a page: the first variant is selected. -

-
- - - - - - - - - - Before the multi-switch - - - First variant - - - Second variant - Second variant - - - After the multi-switch - Filler 1 - Filler 2 - This should be on page 2. - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple-variants.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple-variants.xml deleted file mode 100644 index 11b3cfe7d..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple-variants.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - -

- Check that the right variant is being selected (if any), depending on the space left on the - page. -

-
- - - - - - - - - - Page 1 line 1 - Page 1 line 2 - Page 1 line 3 - Filler - Before the multi-switch - - - Variant 1 line 1 - Variant 1 line 2 - - - Variant 2 line 1 - - - This text should be on page 3. - - - - - - Page 1 line 1 - Page 1 line 2 - Page 2 line 1 - Filler - Before the multi-switch - - - Variant 1 line 1 - Variant 1 line 2 - - - Variant 2 line 1 - - - This text should be on page 3. - - - - - - Page 1 line 1 - Page 1 line 2 - Page 2 line 1 - Page 2 line 2 - Filler - Before the multi-switch - - - Variant 1 line 1 - Variant 1 line 2 - - - Variant 2 line 1 - - - This text should be on page 3. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple_dynamic_contents.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple_dynamic_contents.xml deleted file mode 100644 index df4c59f74..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit_multiple_dynamic_contents.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - -

- Test that multiple whitespace managment elements on the same page are handled nicely. -

-
- - - - - - - - - - - - MS 1 Variant 1 - - - - - MS 2 Variant 1 - - - - - MS 3 Variant 1 - - - - - - - - - - MS 1 Variant 1 - - - - - MS 2 Variant 1 - - - - - MS 3 Variant 1 - - - MS 3 Variant 2 - - - - - MS 4 Variant 1 - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_best-fit_padding.xml b/test/layoutengine/standard-testcases/multi-switch_best-fit_padding.xml deleted file mode 100644 index 5f11ce57d..000000000 --- a/test/layoutengine/standard-testcases/multi-switch_best-fit_padding.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - -

- Test padding properties. -

-
- - - - - - - - - - - - MS1 Variant 1 - - - - - MS2 Variant 1 - - - - - - MS3 Variant 1 - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting.xml new file mode 100644 index 000000000..2c8aa44ca --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting.xml @@ -0,0 +1,51 @@ + + + + +

+ Basic test for fo:multi-switch using the whitespace management extension. +

+
+ + + + + + + + + + + + First variant + + + Second variant + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_forced-page-break.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_forced-page-break.xml new file mode 100644 index 000000000..dd9ed615c --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_forced-page-break.xml @@ -0,0 +1,67 @@ + + + + + +

+ Test forced page breaks. +

+
+ + + + + + + + + + + Block 1 page 1 + + + MS1 Variant 1 + + + + + + MS2 Variant 1 + + + + Block 2 page 3 + + + MS3 Variant 1 + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_middle-page.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_middle-page.xml new file mode 100644 index 000000000..dabc10e52 --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_middle-page.xml @@ -0,0 +1,63 @@ + + + + +

+ Dynamic content in the middle of a page: the first variant is selected. +

+
+ + + + + + + + + + Before the multi-switch + + + First variant + + + Second variant + Second variant + + + After the multi-switch + Filler 1 + Filler 2 + This should be on page 2. + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_multiple-variants.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_multiple-variants.xml new file mode 100644 index 000000000..8ab004151 --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_multiple-variants.xml @@ -0,0 +1,130 @@ + + + + +

+ Check that the right variant is being selected (if any), depending on the space left on the + page. +

+
+ + + + + + + + + + Page 1 line 1 + Page 1 line 2 + Page 1 line 3 + Filler + Before the multi-switch + + + Variant 1 line 1 + Variant 1 line 2 + + + Variant 2 line 1 + + + This text should be on page 3. + + + + + + Page 1 line 1 + Page 1 line 2 + Page 2 line 1 + Filler + Before the multi-switch + + + Variant 1 line 1 + Variant 1 line 2 + + + Variant 2 line 1 + + + This text should be on page 3. + + + + + + Page 1 line 1 + Page 1 line 2 + Page 2 line 1 + Page 2 line 2 + Filler + Before the multi-switch + + + Variant 1 line 1 + Variant 1 line 2 + + + Variant 2 line 1 + + + This text should be on page 3. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_padding.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_padding.xml new file mode 100644 index 000000000..1ec9e2975 --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_padding.xml @@ -0,0 +1,70 @@ + + + + + +

+ Test padding properties. +

+
+ + + + + + + + + + + + MS1 Variant 1 + + + + + MS2 Variant 1 + + + + + + MS3 Variant 1 + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_several-multi-switch.xml b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_several-multi-switch.xml new file mode 100644 index 000000000..969a4786b --- /dev/null +++ b/test/layoutengine/standard-testcases/multi-switch_select-first-fitting_several-multi-switch.xml @@ -0,0 +1,98 @@ + + + + +

+ Test that multiple whitespace managment elements on the same page are handled nicely. +

+
+ + + + + + + + + + + + MS 1 Variant 1 + + + + + MS 2 Variant 1 + + + + + MS 3 Variant 1 + + + + + + + + + + MS 1 Variant 1 + + + + + MS 2 Variant 1 + + + + + MS 3 Variant 1 + + + MS 3 Variant 2 + + + + + MS 4 Variant 1 + + + + + + + + + + + + + + + + + + + + + + +
-- cgit v1.2.3