FOray
|
FOray Modules: FOTreeContentsIntroductionFOTree is essentially a data structure. The processing that it does is essentially validating the data as it goes into the structure, and the mechanics of retrieving the data when it is called for by the client application. The following is a list of notable features in FOrayFOTree:
Eager vs. Patient ProcessingFOray FOTree uses a SAX-like event system to make the client application aware that data is ready. Currently, events are fired when a page-sequence is complete and when the whole document is complete. Clients can use or ignore these events as they see fit. A client can also request to have events fired when each FO object is complete. This gives the client the opportunity to manage the processing in a more “eager” manner if it wishes to. It is kind of like having the SAX concept and the DOM concept rolled into one package. If you want the view-one-piece-at-a-time approach (like SAX), request events for each FO object. If you want the let-me-see-the-whole-thing approach (like DOM), then simply respond to the end-of-document event. If you want something in between, respond to the end-of-page-sequence event. APIThe API for FOray FOTree is intended to be very straightforward. As expected, all of the FO objects are organized in a tree. Each parent in the tree knows all of its children (through the getChildren() method, and each child in the tree knows its parent (through the getParent() method. In general, the FOTree is designed to be independent of the other document-processing modules, such as Layout, AreaTree, and Renderers. It is also designed to be independent of any particular implementation (i.e. it can be used by applications other than FOray), and to be reusable (i.e. it can be used by LayoutStrategy A, then used again by LayoutStrategy B). This means that, in general, FOTree clients can read data all they want from the FOTree, but should not write data to it. The one current exception to this rule is that each FObj encapsulates one Object instance called “shadow”, which can be used by an FOTree client to hold whatever data it likes. In general, this approach is deprecated, but we have made it available to handle some legacy code. We may discontinue this “feature” in the future. If this capability is critically important to your application for some reason, please let us know. Please note that, although the “shadow” concept was added to handle layout-specific data, the current Pioneer layout strategy used by FORay still writes to some other fields within the FOray FOTree. This is a legacy issue, and these fields will be systematically removed in the future. In general, your application should not write to any field in the FOTree except for the shadow. If you wish to reuse an already-built FOTree, and you are using shadow instances to cache data, you can use the FOTreeBuilder.resetShadow() method to set all of the shadow instances in the FOTree to null. The API for properties and traits requires more explanation. For the most part, FOray does not expose property values to FOTree clients, instead exposing, where possible, the computed, refined “trait” values, which are suitable for creating an AreaTree. Methods for obtaining trait values start with the word “trait”. Virtually any trait can be requested from any FO object, although only some of them make sense. As the spec mentions, many trait names are derived directly from the name of the property which is its source. So, for example, to get the value of the column-width property, use the traitColumnWidth method(). Because some traits depend on actual Area Tree dimensions, those properties require parameters to be passed to them that provide that information. If it seems unnatural to have FO Objects with “trait” properties, understand that the methods are really returning the applicable trait values that apply to areas generated by the FO Object. The following are exceptions to the above trait method naming convetion:
List of TraitsThe following is intended to eventually be a comprehensive list of traits and the properties from which they are derived. Rows in the butterscotch color are those which do not have a one-to-one relationship between the two. Please note that this list is not currently complete or correct. It is being currently being used as a checklist by the developers.
Note: Although “width” and “height” do not have “trait” methods, they do have convenience “get” methods which map to the appropriate inline-progression-dimension or block-progression-dimension trait, depending on the writing mode. The same is true for margin-top, margin-bottom, margin-left, and margin-right, which map to one of space-before, space-after, start-indent, or end-indent, depending on the writing-mode. Possible Future Enhancements
|