[ 
https://issues.apache.org/jira/browse/PDFBOX-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14544638#comment-14544638
 ] 

John Hewson commented on PDFBOX-2459:
-------------------------------------

While the getInheritableAttribute() is obviously an important and useful API, 
as seen in PDPageTree, in PDField we also see that it has two counterparts 
setInheritableAttribute() and removeInheritableAttribute(). However, those 
methods are not meaningful, as rather than inheriting values down the 
hierarchy, they attempt to propagate new values back up the hierarchy.

Setting and removing attributes must always be done on the local tree node, 
it's not meaningful to try and propagate such changes upwards. For example, in 
a form in which a group of fields all inherit the same value, e.g. "Please fill 
this field", whenever we call setValue() on a given field, 
setInheritableAttribute() will not set the local field value, but the parent 
value, causing all fields to change their value and preventing the child fields 
from ever having unique values. The same applies to any other inheritable 
attribute, setting the border style of a child field will cause all its 
siblings to be changed too.

Instead, all field operations should be local, except for getting attributes, 
which use getInheritableAttribute(). This is what the commit above does.

> Share functionality between Page Tree and Field Tree
> ----------------------------------------------------
>
>                 Key: PDFBOX-2459
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2459
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Maruan Sahyoun
>            Assignee: John Hewson
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> The PDFs page tree and AcroForms field tree share some common functionality 
> e.g. resolving inheritable attributes, iterating through leafs and such which 
> could be combined into a PDTree class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to