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;
}
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());
}
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);
}
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;
}
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;
}
Aggregations