use of ar.com.fdvs.dj.domain.ImageBanner in project DynamicJasper by intive-FDV.
the class ClassicLayoutManager method applyImageBannersToBand.
/**
* Create the image elements for the banners tha goes into the
* title band
* @param printWhenExpression
*/
protected void applyImageBannersToBand(JRDesignBand band, Collection imageBanners, JRDesignExpression printWhenExpression, boolean placeOnTop) {
int maxHeight = 0;
if (placeOnTop) {
for (Object imageBanner1 : imageBanners) {
ImageBanner imageBanner = (ImageBanner) imageBanner1;
if (imageBanner.getHeight() > maxHeight)
maxHeight = imageBanner.getHeight();
}
} else {
maxHeight = LayoutUtils.findVerticalOffset(band);
}
if (band != null) {
// move everything down
if (placeOnTop) {
for (JRChild jrChild : band.getChildren()) {
JRDesignElement element = (JRDesignElement) jrChild;
element.setY(element.getY() + maxHeight);
}
}
int yPosition = 0;
if (!placeOnTop)
yPosition = maxHeight + 1;
for (Object imageBanner1 : imageBanners) {
ImageBanner imageBanner = (ImageBanner) imageBanner1;
String path = "\"" + imageBanner.getImagePath().replaceAll("\\\\", "/") + "\"";
JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
JRDesignExpression imageExp = new JRDesignExpression();
imageExp.setText(path);
imageExp.setValueClass(String.class);
image.setExpression(imageExp);
image.setHeight(imageBanner.getHeight());
image.setWidth(imageBanner.getWidth());
image.setPrintWhenExpression(printWhenExpression);
image.setRemoveLineWhenBlank(true);
image.setScaleImage(ScaleImageEnum.getByValue(imageBanner.getScaleMode().getValue()));
if (imageBanner.getAlign() == ImageBanner.Alignment.Left)
image.setX(0);
else if (imageBanner.getAlign() == ImageBanner.Alignment.Right)
image.setX(getReport().getOptions().getPage().getWidth() - getReport().getOptions().getLeftMargin() - getReport().getOptions().getRightMargin() - imageBanner.getWidth());
else if (imageBanner.getAlign() == ImageBanner.Alignment.Center) {
int x = (getReport().getOptions().getPage().getWidth() - getReport().getOptions().getRightMargin() - getReport().getOptions().getLeftMargin() - imageBanner.getWidth()) / 2;
image.setX(getReport().getOptions().getLeftMargin() + x);
}
image.setY(yPosition);
band.addElement(image);
}
band.setHeight(band.getHeight() + maxHeight);
}
}
use of ar.com.fdvs.dj.domain.ImageBanner in project DynamicJasper by intive-FDV.
the class DynamicReportBuilder method addFooterImageBanner.
public DynamicReportBuilder addFooterImageBanner(String path, int width, int height, ImageBanner.Alignment alignment, ImageScaleMode scaleMode) {
ImageBanner banner = new ImageBanner(path, width, height, alignment);
banner.setScaleMode(scaleMode);
options.getFooterImageBanners().put(alignment, banner);
return this;
}
use of ar.com.fdvs.dj.domain.ImageBanner in project DynamicJasper by intive-FDV.
the class DynamicReportBuilder method addFooterImageBanner.
@Deprecated
public DynamicReportBuilder addFooterImageBanner(String path, int width, int height, byte align, ImageScaleMode scaleMode) {
ImageBanner.Alignment alignment = ImageBanner.Alignment.fromValue(align);
if (alignment == null)
throw new DJException("Invalid ImageBanner.Alignment");
ImageBanner banner = new ImageBanner(path, width, height, alignment);
banner.setScaleMode(scaleMode);
options.getFooterImageBanners().put(alignment, banner);
return this;
}
use of ar.com.fdvs.dj.domain.ImageBanner in project DynamicJasper by intive-FDV.
the class DynamicReportBuilder method addFirstPageImageBanner.
public DynamicReportBuilder addFirstPageImageBanner(String path, int width, int height, ImageBanner.Alignment align) {
ImageBanner banner = new ImageBanner(path, width, height, align);
options.getFirstPageImageBanners().put(align, banner);
return this;
}
use of ar.com.fdvs.dj.domain.ImageBanner in project DynamicJasper by intive-FDV.
the class DynamicReportBuilder method addFirstPageFooterImageBanner.
public DynamicReportBuilder addFirstPageFooterImageBanner(String path, int width, int height, ImageBanner.Alignment alignment) {
ImageBanner banner = new ImageBanner(path, width, height, alignment);
options.getFirstPageFooterImageBanners().put(alignment, banner);
return this;
}
Aggregations