You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ph...@apache.org on 2011/09/29 12:18:54 UTC
svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java
pdf/PDFFactory.java
Author: phancock
Date: Thu Sep 29 10:18:53 2011
New Revision: 1177251
URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
Log:
Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BasicLink.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFFactory.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BasicLink.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BasicLink.java?rev=1177251&r1=1177250&r2=1177251&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BasicLink.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BasicLink.java Thu Sep 29 10:18:53 2011
@@ -22,9 +22,11 @@ package org.apache.fop.fo.flow;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.StructurePointerPropertySet;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_basic-link">
@@ -34,9 +36,14 @@ import org.apache.fop.fo.ValidationExcep
* and whether that link is external (uses a URI) or internal (an id
* reference).
*/
-public class BasicLink extends Inline {
+public class BasicLink extends InlineLevel implements StructurePointerPropertySet {
// The value of properties relevant for fo:basic-link.
+ private Length alignmentAdjust;
+ private int alignmentBaseline;
+ private Length baselineShift;
+ private int dominantBaseline;
+ private String ptr;
// private ToBeImplementedProperty destinationPlacementOffset;
private String externalDestination;
// private ToBeImplementedProperty indicateDestination;
@@ -65,6 +72,11 @@ public class BasicLink extends Inline {
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
+ alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
+ baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
+ dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
+ ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
// destinationPlacementOffset = pList.get(PR_DESTINATION_PLACEMENT_OFFSET);
externalDestination = pList.get(PR_EXTERNAL_DESTINATION).getString();
// indicateDestination = pList.get(PR_INDICATE_DESTINATION);
@@ -111,6 +123,31 @@ public class BasicLink extends Inline {
}
}
+ /** @return the "alignment-adjust" property */
+ public Length getAlignmentAdjust() {
+ return alignmentAdjust;
+ }
+
+ /** @return the "alignment-baseline" property */
+ public int getAlignmentBaseline() {
+ return alignmentBaseline;
+ }
+
+ /** @return the "baseline-shift" property */
+ public Length getBaselineShift() {
+ return baselineShift;
+ }
+
+ /** @return the "dominant-baseline" property */
+ public int getDominantBaseline() {
+ return dominantBaseline;
+ }
+
+ /** {@inheritDoc} */
+ public String getPtr() {
+ return ptr;
+ }
+
/**
* Get the value of the <code>internal-destination</code> property.
*
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=1177251&r1=1177250&r2=1177251&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Thu Sep 29 10:18:53 2011
@@ -32,6 +32,7 @@ import org.apache.fop.area.inline.Inline
import org.apache.fop.area.inline.InlineBlockParent;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.flow.BasicLink;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.InlineLevel;
import org.apache.fop.fo.flow.Leader;
@@ -136,6 +137,11 @@ public class InlineLayoutManager extends
alignmentBaseline = ((Leader)fobj).getAlignmentBaseline();
baselineShift = ((Leader)fobj).getBaselineShift();
dominantBaseline = ((Leader)fobj).getDominantBaseline();
+ } else if (fobj instanceof BasicLink) {
+ alignmentAdjust = ((BasicLink)fobj).getAlignmentAdjust();
+ alignmentBaseline = ((BasicLink)fobj).getAlignmentBaseline();
+ baselineShift = ((BasicLink)fobj).getBaselineShift();
+ dominantBaseline = ((BasicLink)fobj).getDominantBaseline();
}
if (borderProps != null) {
padding = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
@@ -209,8 +215,8 @@ public class InlineLayoutManager extends
} else {
area = new InlineBlockParent();
}
- if (fobj instanceof Inline) {
- TraitSetter.setProducerID(area, getInlineFO().getId());
+ if (fobj instanceof Inline || fobj instanceof BasicLink) {
+ TraitSetter.setProducerID(area, fobj.getId());
}
return area;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFFactory.java?rev=1177251&r1=1177250&r2=1177251&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFFactory.java Thu Sep 29 10:18:53 2011
@@ -64,7 +64,6 @@ import org.apache.fop.fonts.truetype.Fon
import org.apache.fop.fonts.truetype.TTFSubSetFile;
import org.apache.fop.fonts.type1.PFBData;
import org.apache.fop.fonts.type1.PFBParser;
-import org.apache.xmlgraphics.xmp.Metadata;
/**
* This class provides method to create and register PDF objects.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Glenn Adams <gl...@skynav.com>.
i just checked this change against the complex script branch, and it's ok
(doesn't regress); so if you want to leave it in, i won't object, though, in
general, i prefer the "if it ain't broke, don't fix it" rule;
i would also note that in the complex script branch i had previously
redefined BidiOverride to inherit from Inline in order to reuse a portion of
its implementation; i would not want to redefine it again merely to follow
the same path you have chosen for BasicLink;
also, just to note further, your change seems to have introduced a new
findbugs warning; perhaps you can fix:
CodeWarning UPMPrivate method
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getInlineFO() is never
called
Bug type UPM_UNCALLED_PRIVATE_METHOD (click for
details)<file:///Users/glenn/Work/fop/build/report_findbugs.html#UPM_UNCALLED_PRIVATE_METHOD>
In class org.apache.fop.layoutmgr.inline.InlineLayoutManager
In method org.apache.fop.layoutmgr.inline.InlineLayoutManager.getInlineFO()
At InlineLayoutManager.java:[line 111]
On Fri, Sep 30, 2011 at 10:54 PM, Glenn Adams <gl...@skynav.com> wrote:
> let's step back a minute; what was the problem you were trying to solve?
> what was broken? how did your change fix it?
>
> if you made this change just because you think instanceof Inline should
> return false on a BasicLink, then this change would seem gratuitous
>
> it is wholly reasonable that BasicLink may share the implementation of
> Inline as previously held; your change required you to copy/paste existing
> code from Inline into BasicLink and to alter InlineLayoutManager for no
> purpose other than accommodating your change
>
> IMO you should revert the change
>
> On Fri, Sep 30, 2011 at 9:18 PM, Peter Hancock <pe...@gmail.com>wrote:
>
>> By ancestor I refer to the relationship with respect to the fo:
>> element hierarchy: Since the definition of fo:basic-link does not
>> depend upon fo:inline, we cannot conclude that fo:basic-link is an
>> fo:inline.
>>
>> The parameter entity "%inline;" refers to inline-level fo elements,
>> fo:inline and fo:basic-link being members, and this is now reflected
>> on the FOP FO object hierarchy, where Inline and BasicLink extend
>> InlineLevel
>>
>> Have I understood the recommendation correctly, or have I missed anything?
>>
>> On Fri, Sep 30, 2011 at 1:18 PM, Glenn Adams <gl...@skynav.com> wrote:
>> > i'm not sure what you mean by 'ancestor', since containment relation is
>> not
>> > at issue here;
>> > your argument is counter to the definition of the parameter entity
>> %inline;
>> > defined in XSL 1.1 Section 6.2
>> >
>> > The parameter entity, "%inline;" in the content models below, contains
>> the
>> > following formatting objects:
>> >
>> > bidi-override
>> > character
>> > external-graphic
>> > instream-foreign-object
>> > inline
>> > inline-container
>> > leader
>> > page-number
>> > page-number-citation
>> > page-number-citation-last
>> > scaling-value-citation
>> > basic-link
>> > multi-toggle
>> > index-page-citation-list
>> >
>> > i believe you should first restore the previous state of affairs, and
>> then,
>> > if you wish to continue making the case that it is not inline, take it
>> up
>> > with the group and get consensus before making what appears to be a
>> possibly
>> > unjustified architectural change
>> >
>> > On Fri, Sep 30, 2011 at 5:31 PM, Peter Hancock <peter.hancock@gmail.com
>> >
>> > wrote:
>> >>
>> >> While fo:basic-link and fo:inline are both inline level elements, one
>> >> is not the ancestor of the other and so FOP's model of the FO elements
>> >> should reflect this, I believe.
>> >>
>> >> On Fri, Sep 30, 2011 at 8:43 AM, Glenn Adams <gl...@skynav.com> wrote:
>> >> > if I recall, I need this inheritance (from Inline) to work in the
>> >> > complex
>> >> > script branch as well
>> >> >
>> >> > On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <
>> spepping@leverkruid.eu>
>> >> > wrote:
>> >> >>
>> >> >> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.orgwrote:
>> >> >> > Author: phancock
>> >> >> > Date: Thu Sep 29 10:18:53 2011
>> >> >> > New Revision: 1177251
>> >> >> >
>> >> >> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
>> >> >> > Log:
>> >> >> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
>> >> >>
>> >> >> Why? A basic-link is an inline object which generates inline areas.
>> >> >>
>> >> >> Simon
>> >> >
>> >> >
>> >
>> >
>>
>
>
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Glenn Adams <gl...@skynav.com>.
let's step back a minute; what was the problem you were trying to solve?
what was broken? how did your change fix it?
if you made this change just because you think instanceof Inline should
return false on a BasicLink, then this change would seem gratuitous
it is wholly reasonable that BasicLink may share the implementation of
Inline as previously held; your change required you to copy/paste existing
code from Inline into BasicLink and to alter InlineLayoutManager for no
purpose other than accommodating your change
IMO you should revert the change
On Fri, Sep 30, 2011 at 9:18 PM, Peter Hancock <pe...@gmail.com>wrote:
> By ancestor I refer to the relationship with respect to the fo:
> element hierarchy: Since the definition of fo:basic-link does not
> depend upon fo:inline, we cannot conclude that fo:basic-link is an
> fo:inline.
>
> The parameter entity "%inline;" refers to inline-level fo elements,
> fo:inline and fo:basic-link being members, and this is now reflected
> on the FOP FO object hierarchy, where Inline and BasicLink extend
> InlineLevel
>
> Have I understood the recommendation correctly, or have I missed anything?
>
> On Fri, Sep 30, 2011 at 1:18 PM, Glenn Adams <gl...@skynav.com> wrote:
> > i'm not sure what you mean by 'ancestor', since containment relation is
> not
> > at issue here;
> > your argument is counter to the definition of the parameter entity
> %inline;
> > defined in XSL 1.1 Section 6.2
> >
> > The parameter entity, "%inline;" in the content models below, contains
> the
> > following formatting objects:
> >
> > bidi-override
> > character
> > external-graphic
> > instream-foreign-object
> > inline
> > inline-container
> > leader
> > page-number
> > page-number-citation
> > page-number-citation-last
> > scaling-value-citation
> > basic-link
> > multi-toggle
> > index-page-citation-list
> >
> > i believe you should first restore the previous state of affairs, and
> then,
> > if you wish to continue making the case that it is not inline, take it up
> > with the group and get consensus before making what appears to be a
> possibly
> > unjustified architectural change
> >
> > On Fri, Sep 30, 2011 at 5:31 PM, Peter Hancock <pe...@gmail.com>
> > wrote:
> >>
> >> While fo:basic-link and fo:inline are both inline level elements, one
> >> is not the ancestor of the other and so FOP's model of the FO elements
> >> should reflect this, I believe.
> >>
> >> On Fri, Sep 30, 2011 at 8:43 AM, Glenn Adams <gl...@skynav.com> wrote:
> >> > if I recall, I need this inheritance (from Inline) to work in the
> >> > complex
> >> > script branch as well
> >> >
> >> > On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <
> spepping@leverkruid.eu>
> >> > wrote:
> >> >>
> >> >> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
> >> >> > Author: phancock
> >> >> > Date: Thu Sep 29 10:18:53 2011
> >> >> > New Revision: 1177251
> >> >> >
> >> >> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
> >> >> > Log:
> >> >> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
> >> >>
> >> >> Why? A basic-link is an inline object which generates inline areas.
> >> >>
> >> >> Simon
> >> >
> >> >
> >
> >
>
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Peter Hancock <pe...@gmail.com>.
By ancestor I refer to the relationship with respect to the fo:
element hierarchy: Since the definition of fo:basic-link does not
depend upon fo:inline, we cannot conclude that fo:basic-link is an
fo:inline.
The parameter entity "%inline;" refers to inline-level fo elements,
fo:inline and fo:basic-link being members, and this is now reflected
on the FOP FO object hierarchy, where Inline and BasicLink extend
InlineLevel
Have I understood the recommendation correctly, or have I missed anything?
On Fri, Sep 30, 2011 at 1:18 PM, Glenn Adams <gl...@skynav.com> wrote:
> i'm not sure what you mean by 'ancestor', since containment relation is not
> at issue here;
> your argument is counter to the definition of the parameter entity %inline;
> defined in XSL 1.1 Section 6.2
>
> The parameter entity, "%inline;" in the content models below, contains the
> following formatting objects:
>
> bidi-override
> character
> external-graphic
> instream-foreign-object
> inline
> inline-container
> leader
> page-number
> page-number-citation
> page-number-citation-last
> scaling-value-citation
> basic-link
> multi-toggle
> index-page-citation-list
>
> i believe you should first restore the previous state of affairs, and then,
> if you wish to continue making the case that it is not inline, take it up
> with the group and get consensus before making what appears to be a possibly
> unjustified architectural change
>
> On Fri, Sep 30, 2011 at 5:31 PM, Peter Hancock <pe...@gmail.com>
> wrote:
>>
>> While fo:basic-link and fo:inline are both inline level elements, one
>> is not the ancestor of the other and so FOP's model of the FO elements
>> should reflect this, I believe.
>>
>> On Fri, Sep 30, 2011 at 8:43 AM, Glenn Adams <gl...@skynav.com> wrote:
>> > if I recall, I need this inheritance (from Inline) to work in the
>> > complex
>> > script branch as well
>> >
>> > On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <sp...@leverkruid.eu>
>> > wrote:
>> >>
>> >> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
>> >> > Author: phancock
>> >> > Date: Thu Sep 29 10:18:53 2011
>> >> > New Revision: 1177251
>> >> >
>> >> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
>> >> > Log:
>> >> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
>> >>
>> >> Why? A basic-link is an inline object which generates inline areas.
>> >>
>> >> Simon
>> >
>> >
>
>
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Glenn Adams <gl...@skynav.com>.
i'm not sure what you mean by 'ancestor', since containment relation is not
at issue here;
your argument is counter to the definition of the parameter entity %inline;
defined in XSL 1.1 Section 6.2
The parameter entity, "%inline;" in the content models below, contains the
following formatting objects:
bidi-override
character
external-graphic
instream-foreign-object
inline
inline-container
leader
page-number
page-number-citation
page-number-citation-last
scaling-value-citation
basic-link
multi-toggle
index-page-citation-list
i believe you should first restore the previous state of affairs, and then,
if you wish to continue making the case that it is not inline, take it up
with the group and get consensus before making what appears to be a possibly
unjustified architectural change
On Fri, Sep 30, 2011 at 5:31 PM, Peter Hancock <pe...@gmail.com>wrote:
> While fo:basic-link and fo:inline are both inline level elements, one
> is not the ancestor of the other and so FOP's model of the FO elements
> should reflect this, I believe.
>
> On Fri, Sep 30, 2011 at 8:43 AM, Glenn Adams <gl...@skynav.com> wrote:
> > if I recall, I need this inheritance (from Inline) to work in the complex
> > script branch as well
> >
> > On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <sp...@leverkruid.eu>
> > wrote:
> >>
> >> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
> >> > Author: phancock
> >> > Date: Thu Sep 29 10:18:53 2011
> >> > New Revision: 1177251
> >> >
> >> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
> >> > Log:
> >> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
> >>
> >> Why? A basic-link is an inline object which generates inline areas.
> >>
> >> Simon
> >
> >
>
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Peter Hancock <pe...@gmail.com>.
While fo:basic-link and fo:inline are both inline level elements, one
is not the ancestor of the other and so FOP's model of the FO elements
should reflect this, I believe.
On Fri, Sep 30, 2011 at 8:43 AM, Glenn Adams <gl...@skynav.com> wrote:
> if I recall, I need this inheritance (from Inline) to work in the complex
> script branch as well
>
> On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <sp...@leverkruid.eu>
> wrote:
>>
>> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
>> > Author: phancock
>> > Date: Thu Sep 29 10:18:53 2011
>> > New Revision: 1177251
>> >
>> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
>> > Log:
>> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
>>
>> Why? A basic-link is an inline object which generates inline areas.
>>
>> Simon
>
>
Re: svn commit: r1177251 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop:
fo/flow/BasicLink.java layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Glenn Adams <gl...@skynav.com>.
if I recall, I need this inheritance (from Inline) to work in the complex
script branch as well
On Fri, Sep 30, 2011 at 3:12 PM, Simon Pepping <sp...@leverkruid.eu>wrote:
> On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
> > Author: phancock
> > Date: Thu Sep 29 10:18:53 2011
> > New Revision: 1177251
> >
> > URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
> > Log:
> > Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
>
> Why? A basic-link is an inline object which generates inline areas.
>
> Simon
>
Re: svn commit: r1177251 - in
/xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/BasicLink.java
layoutmgr/inline/InlineLayoutManager.java pdf/PDFFactory.java
Posted by Simon Pepping <sp...@leverkruid.eu>.
On Thu, Sep 29, 2011 at 10:18:54AM -0000, phancock@apache.org wrote:
> Author: phancock
> Date: Thu Sep 29 10:18:53 2011
> New Revision: 1177251
>
> URL: http://svn.apache.org/viewvc?rev=1177251&view=rev
> Log:
> Fix FO tree hierarchy: BasicLink shouldn't inherit from Inline
Why? A basic-link is an inline object which generates inline areas.
Simon