All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.craigburke.document.builder.render.Renderable.groovy Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package com.craigburke.document.builder.render

import com.craigburke.document.builder.PdfDocument

/**
 * Trait shared by render elements
 */
trait Renderable {
    float startX
    PdfDocument pdfDocument
    
    abstract void parse(float maxHeight)
    abstract boolean getFullyParsed()
    abstract float getTotalHeight()
    abstract float getParsedHeight()
    abstract void renderElement(float startY)
    int renderCount = 0
    
    void render(float startY) {
        float currentX = pdfDocument.x
        float currentY = pdfDocument.y        
        pdfDocument.y = startY
        pdfDocument.x = startX
        renderElement(startY)
        pdfDocument.x = currentX
        pdfDocument.y = currentY
        renderCount = renderCount + 1
    }

    boolean getOnFirstPage() {
        (renderCount <= 1)
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy