Difference between revisions of "Granule Code"
From DocDataFlow
Line 12: | Line 12: | ||
* <code>granule.getData()</code>: retrieve the core data for this granule. In most cases this is a reference to the document-specific data structure for the granule. E.g. if the granule is an InDesignTextFrameGranule, the granule.getData() will retrieve the associated InDesign TextFrame object (or a proxy thereof). | * <code>granule.getData()</code>: retrieve the core data for this granule. In most cases this is a reference to the document-specific data structure for the granule. E.g. if the granule is an InDesignTextFrameGranule, the granule.getData() will retrieve the associated InDesign TextFrame object (or a proxy thereof). | ||
+ | |||
+ | * <code>granule.getParentGranule()</code>: retrieve the parent granule for this granule. Eventually will lead to an AppGranule - appGranules are the root(s) for the granule hierarchy. | ||
+ | |||
+ | * <code>granule.comparePosition(sortList, compareWithGranule)</code>: return an int (< 0, == 0, > 0) after comparing the granules. The sortList is a linear list of [[GranuleSort|granule sort]]. |
Revision as of 01:59, 30 December 2013
The Granule class is the root class from which all granule types are derived.
It has a class identifier of com.rorohiko.granule
Granules are 'constant': once created they don't change. Any 'live' data related to the granule is carried in the associated context data structure.
It has the following methods:
-
granule.getId()
: get the unique identifier for this granule.
-
granule.getContext()
: retrieve the context for this granule.
-
granule.getData()
: retrieve the core data for this granule. In most cases this is a reference to the document-specific data structure for the granule. E.g. if the granule is an InDesignTextFrameGranule, the granule.getData() will retrieve the associated InDesign TextFrame object (or a proxy thereof).
-
granule.getParentGranule()
: retrieve the parent granule for this granule. Eventually will lead to an AppGranule - appGranules are the root(s) for the granule hierarchy.
-
granule.comparePosition(sortList, compareWithGranule)
: return an int (< 0, == 0, > 0) after comparing the granules. The sortList is a linear list of granule sort.