ASF Bugzilla – Attachment 26943 Details for
Bug 18801
[PATCH] "visibility" property is not implemented
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Implement visibility for fo:block
visibility.patch (text/plain), 7.50 KB, created by
Jerome Robert
on 2011-04-29 17:24:40 UTC
(
hide
)
Description:
Implement visibility for fo:block
Filename:
MIME Type:
Creator:
Jerome Robert
Created:
2011-04-29 17:24:40 UTC
Size:
7.50 KB
patch
obsolete
>diff --git a/src/codegen/fo/foproperties.xml b/src/codegen/fo/foproperties.xml >index 9b87319..1dc2a95 100644 >--- a/src/codegen/fo/foproperties.xml >+++ b/src/codegen/fo/foproperties.xml >@@ -2054,10 +2054,17 @@ > <default></default> > </property> > <property> >+ <!-- from https://issues.apache.org/bugzilla/show_bug.cgi?id=18801 --> > <name>visibility</name> >- <inherited>false</inherited> >- <datatype>ToBeImplemented</datatype> >+ <inherited>true</inherited> > <default>visible</default> >+ <datatype>Enum</datatype> >+ <enumeration> >+ <value const="VISIBLE">visible</value> >+ <value const="HIDDEN">hidden</value> >+ <value const="COLLAPSE">collapse</value> >+ <value const="INHERIT">inherit</value> >+ </enumeration> > </property> > <property> > <name>z-index</name> >diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java >index 74969ed..4d26bbb 100644 >--- a/src/java/org/apache/fop/area/Trait.java >+++ b/src/java/org/apache/fop/area/Trait.java >@@ -26,6 +26,7 @@ import org.apache.xmlgraphics.image.loader.ImageInfo; > > import org.apache.fop.fonts.FontTriplet; > import org.apache.fop.traits.BorderProps; >+import org.apache.fop.traits.Visibility; > import org.apache.fop.util.ColorUtil; > > import static org.apache.fop.fo.Constants.EN_REPEAT; >@@ -156,8 +157,11 @@ public final class Trait implements Serializable { > /** The ptr trait. Used for accessibility */ > public static final Integer PTR = 37; > >+ /** Used to disable the rendering of a Block http://www.w3.org/TR/xsl/#rend-vis */ >+ public static final Integer VISIBILITY = 38; >+ > /** Maximum value used by trait keys */ >- public static final int MAX_TRAIT_KEY = 37; >+ public static final int MAX_TRAIT_KEY = 38; > > private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1]; > >@@ -221,6 +225,7 @@ public final class Trait implements Serializable { > put(SPACE_AFTER, new TraitInfo("space-after", Integer.class)); > put(IS_REFERENCE_AREA, new TraitInfo("is-reference-area", Boolean.class)); > put(IS_VIEWPORT_AREA, new TraitInfo("is-viewport-area", Boolean.class)); >+ put(VISIBILITY, new TraitInfo("visibility", Visibility.class)); > > } > >diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java >index 1afc186..6640b5a 100644 >--- a/src/java/org/apache/fop/fo/flow/Block.java >+++ b/src/java/org/apache/fop/fo/flow/Block.java >@@ -83,12 +83,12 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint > private Numeric widows; > private int wrapOption; > private int disableColumnBalancing; >+ private int visibility; > // Unused but valid items, commented out for performance: > // private CommonAccessibility commonAccessibility; > // private CommonAural commonAural; > // private Length textDepth; > // private Length textAltitude; >- // private int visibility; > // End of property values > > /** >@@ -135,6 +135,7 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint > widows = pList.get(PR_WIDOWS).getNumeric(); > wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); > disableColumnBalancing = pList.get(PR_X_DISABLE_COLUMN_BALANCING).getEnum(); >+ visibility = pList.get(PR_VISIBILITY).getEnum(); > } > > /** {@inheritDoc} */ >@@ -356,4 +357,7 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint > return FO_BLOCK; > } > >+ public int getVisibility() { >+ return visibility; >+ } > } >diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java >index 3ddaaf7..8f33b75 100644 >--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java >+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java >@@ -332,6 +332,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager > TraitSetter.addPtr(curBlockArea, getBlockFO().getPtr()); // used for accessibility > TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(), > effSpaceBefore, effSpaceAfter); >+ TraitSetter.setVisibility(curBlockArea, getBlockFO().getVisibility()); > flush(); > > curBlockArea = null; >diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java >index 674e35e..a78b0d4 100644 >--- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java >+++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java >@@ -35,6 +35,7 @@ import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; > import org.apache.fop.fonts.Font; > import org.apache.fop.traits.BorderProps; > import org.apache.fop.traits.MinOptMax; >+import org.apache.fop.traits.Visibility; > > /** > * This is a helper class used for setting common traits on areas. >@@ -612,4 +613,19 @@ public final class TraitSetter { > area.addTrait(Trait.PROD_ID, id); > } > } >+ >+ public static void setVisibility(Area area, int visibility) { >+ Visibility v; >+ switch (visibility) { >+ case Constants.EN_COLLAPSE: >+ v = Visibility.COLLAPSE; >+ break; >+ case Constants.EN_HIDDEN: >+ v = Visibility.HIDDEN; >+ break; >+ default: >+ v = Visibility.VISIBLE; >+ } >+ area.addTrait(Trait.VISIBILITY, v); >+ } > } >diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java >index f7a9f49..bd59210 100644 >--- a/src/java/org/apache/fop/render/AbstractRenderer.java >+++ b/src/java/org/apache/fop/render/AbstractRenderer.java >@@ -69,6 +69,7 @@ import org.apache.fop.area.inline.InlineViewport; > import org.apache.fop.area.inline.WordArea; > import org.apache.fop.fo.Constants; > import org.apache.fop.fonts.FontInfo; >+import org.apache.fop.traits.Visibility; > > /** > * Abstract base class for all renderers. The Abstract renderer does all the >@@ -579,7 +580,8 @@ public abstract class AbstractRenderer > > handleBlockTraits(block); > >- if (children != null) { >+ if (children != null && block.getTrait(Trait.VISIBILITY) != Visibility.HIDDEN) >+ { > renderBlocks(block, children); > } > >diff --git a/src/java/org/apache/fop/traits/Visibility.java b/src/java/org/apache/fop/traits/Visibility.java >new file mode 100644 >index 0000000..0bfb7a9 >--- /dev/null >+++ b/src/java/org/apache/fop/traits/Visibility.java >@@ -0,0 +1,24 @@ >+/* >+ * Licensed to the Apache Software Foundation (ASF) under one or more >+ * contributor license agreements. See the NOTICE file distributed with >+ * this work for additional information regarding copyright ownership. >+ * The ASF licenses this file to You under the Apache License, Version 2.0 >+ * (the "License"); you may not use this file except in compliance with >+ * the License. You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+package org.apache.fop.traits; >+ >+/** >+ * http://www.w3.org/TR/xsl/#visibility >+ * @author Jerome Robert >+ */ >+public enum Visibility { VISIBLE, HIDDEN, COLLAPSE }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18801
: 26943