Search in sources :

Example 1 with Style

use of ar.com.fdvs.dj.domain.Style in project jgnash by ccavanaugh.

the class BaseDynamicJasperReport method getPageFooterStyle.

private Style getPageFooterStyle() {
    Style style = new Style();
    style.setFont(ReportFactory.getDefaultProportionalFont(getBaseFontSize(), false, true));
    return style;
}
Also used : Style(ar.com.fdvs.dj.domain.Style)

Example 2 with Style

use of ar.com.fdvs.dj.domain.Style in project jgnash by ccavanaugh.

the class BaseDynamicJasperReport method buildTitle.

/**
     * Creates and add the default title to the report
     * 
     * @param drb {@code DynamicReportBuilder} to add title to
     */
private void buildTitle(final DynamicReportBuilder drb) {
    Font font = ReportFactory.getDefaultProportionalFont(getBaseFontSize());
    Style titleStyle = new Style();
    titleStyle.setFont(ReportFactory.getDefaultProportionalFont(getBaseFontSize() + 8, true));
    titleStyle.setHorizontalAlign(HorizontalAlign.CENTER);
    titleStyle.setVerticalAlign(VerticalAlign.BOTTOM);
    Style subtitleStyle = new Style();
    font.setItalic(true);
    subtitleStyle.setFont(font);
    subtitleStyle.setHorizontalAlign(HorizontalAlign.CENTER);
    subtitleStyle.setVerticalAlign(VerticalAlign.TOP);
    drb.setTitleStyle(titleStyle);
    drb.setSubtitleStyle(subtitleStyle);
    drb.setTitle(getReportName());
    drb.setSubtitle(getSubTitle());
}
Also used : Style(ar.com.fdvs.dj.domain.Style) Font(ar.com.fdvs.dj.domain.constants.Font)

Example 3 with Style

use of ar.com.fdvs.dj.domain.Style in project jgnash by ccavanaugh.

the class FontTest method getWidth.

@Test
public void getWidth() {
    Style style = new Style();
    style.setFont(ReportFactory.getDefaultMonoFont(12));
    int width = AWTFontUtilities.getStringWidth("test", style);
    assertTrue(width > 0);
}
Also used : Style(ar.com.fdvs.dj.domain.Style) Test(org.junit.Test)

Example 4 with Style

use of ar.com.fdvs.dj.domain.Style in project jgnash by ccavanaugh.

the class BaseDynamicJasperReport method getStyle.

private Style getStyle(final ColumnStyle style, final boolean formatForCSV) {
    switch(style) {
        case SHORT_DATE:
        case TIMESTAMP:
        case STRING:
            Style stringStyle = new Style();
            stringStyle.setFont(ReportFactory.getDefaultMonoFont(getBaseFontSize()));
            stringStyle.setHorizontalAlign(HorizontalAlign.LEFT);
            if (!formatForCSV) {
                stringStyle.setStretchWithOverflow(false);
            }
            return stringStyle;
        case AMOUNT_SUM:
        case BALANCE:
        case BALANCE_WITH_SUM:
        case BALANCE_WITH_SUM_AND_GLOBAL:
        case PERCENTAGE:
        case QUANTITY:
        case SHORT_AMOUNT:
            Style amountStyle = new Style();
            amountStyle.setFont(ReportFactory.getDefaultMonoFont(getBaseFontSize()));
            amountStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
            if (!formatForCSV) {
                amountStyle.setStretchWithOverflow(false);
            }
            return amountStyle;
        case CROSSTAB_TOTAL:
            Style totalStyle = new Style();
            totalStyle.setFont(ReportFactory.getDefaultMonoFont(getBaseFontSize(), true));
            totalStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
            if (!formatForCSV) {
                totalStyle.setStretchWithOverflow(false);
            }
            return totalStyle;
        case GROUP:
        case GROUP_NO_HEADER:
            return getTypeHeaderStyle();
    }
    System.err.println("Returning a null style");
    return null;
}
Also used : Style(ar.com.fdvs.dj.domain.Style)

Example 5 with Style

use of ar.com.fdvs.dj.domain.Style in project jgnash by ccavanaugh.

the class BaseDynamicJasperReport method getStyle.

private Style getStyle(final ColumnHeaderStyle style, final boolean formatForCSV) {
    Style headerStyle = new Style();
    headerStyle.setFont(ReportFactory.getDefaultProportionalFont(getBaseFontSize() + 1, true));
    headerStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
    headerStyle.setBorderTop(Border.THIN());
    headerStyle.setBorderBottom(Border.THIN());
    headerStyle.setBackgroundColor(Color.decode("#E0E9F1"));
    headerStyle.setTransparency(Transparency.OPAQUE);
    headerStyle.setVerticalAlign(VerticalAlign.MIDDLE);
    if (!formatForCSV) {
        headerStyle.setStretchWithOverflow(false);
    }
    switch(style) {
        case LEFT:
            headerStyle.setHorizontalAlign(HorizontalAlign.LEFT);
            break;
        case CENTER:
            headerStyle.setHorizontalAlign(HorizontalAlign.CENTER);
            break;
        case RIGHT:
            headerStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
            break;
        case NONE:
            headerStyle.setHorizontalAlign(HorizontalAlign.JUSTIFY);
            break;
    }
    return headerStyle;
}
Also used : Style(ar.com.fdvs.dj.domain.Style)

Aggregations

Style (ar.com.fdvs.dj.domain.Style)9 Test (org.junit.Test)2 ClassicLayoutManager (ar.com.fdvs.dj.core.layout.ClassicLayoutManager)1 AutoText (ar.com.fdvs.dj.domain.AutoText)1 DJGroupLabel (ar.com.fdvs.dj.domain.DJGroupLabel)1 DynamicReport (ar.com.fdvs.dj.domain.DynamicReport)1 ColumnBuilder (ar.com.fdvs.dj.domain.builders.ColumnBuilder)1 DynamicReportBuilder (ar.com.fdvs.dj.domain.builders.DynamicReportBuilder)1 GroupBuilder (ar.com.fdvs.dj.domain.builders.GroupBuilder)1 Font (ar.com.fdvs.dj.domain.constants.Font)1 DJGroup (ar.com.fdvs.dj.domain.entities.DJGroup)1 AbstractColumn (ar.com.fdvs.dj.domain.entities.columns.AbstractColumn)1 DecimalFormat (java.text.DecimalFormat)1 NumberFormat (java.text.NumberFormat)1 ArrayList (java.util.ArrayList)1 JRDataSource (net.sf.jasperreports.engine.JRDataSource)1 JRException (net.sf.jasperreports.engine.JRException)1 JasperPrint (net.sf.jasperreports.engine.JasperPrint)1 JRTableModelDataSource (net.sf.jasperreports.engine.data.JRTableModelDataSource)1