本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignBand.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignBand.setHeight方法的具体用法?Java JRDesignBand.setHeight怎么用?Java JRDesignBand.setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignBand
的用法示例。
在下文中一共展示了JRDesignBand.setHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPropertyValue
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
public void setPropertyValue(Object id, Object value) {
JRDesignBand jrband = (JRDesignBand) getValue();
if (jrband != null) {
if (id.equals(JRDesignBand.PROPERTY_HEIGHT)) {
jrband.setHeight(Math.max(0, (Integer) Misc.nvl(value, Integer.valueOf(0))));
} else if (id.equals(JRDesignBand.PROPERTY_SPLIT_TYPE))
jrband.setSplitType((SplitTypeEnum) splitStyleD.getEnumValue(value));
else if (id.equals(JRDesignBand.PROPERTY_PRINT_WHEN_EXPRESSION))
jrband.setPrintWhenExpression(ExprUtil.setValues(jrband.getPrintWhenExpression(), value, null));
else if (id.equals(MGraphicElement.PROPERTY_MAP)) {
JRPropertiesMap v = (JRPropertiesMap) value;
String[] names = jrband.getPropertiesMap().getPropertyNames();
for (int i = 0; i < names.length; i++) {
jrband.getPropertiesMap().removeProperty(names[i]);
}
names = v.getPropertyNames();
for (int i = 0; i < names.length; i++)
jrband.getPropertiesMap().setProperty(names[i], v.getProperty(names[i]));
this.getPropertyChangeSupport().firePropertyChange(MGraphicElement.PROPERTY_MAP, false, true);
}
}
}
示例2: createTitle
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
public JRBand createTitle(final ReportInfo report, final String title) throws Exception {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(93);
final JRDesignTextField headerLine1 = h1("$P{report}.getInstitution()").toTextField();
addDesignElementTo(retval, headerLine1, 0, 0, 356, 30);
final JRDesignStaticText headerLine2 = h5(title + " for # ").toStaticText();
addDesignElementTo(retval, headerLine2, 0, 31, 426, 24);
final JRDesignTextField headerLine3 = h5("$P{report}.getTripId()").toTextField();
addDesignElementTo(retval, headerLine3, 275, 31, 146, 24);
final JRDesignStaticText headerLine4 = h5("Purpose: ").toStaticText();
addDesignElementTo(retval, headerLine4, 0, 52, 100, 20);
final JRDesignStaticText headerLine5 = h5("Dates: ").toStaticText();
addDesignElementTo(retval, headerLine5, 0, 72, 100, 20);
final JRDesignTextField headerLine4Field1 = h5("$P{report}.getPurpose()").toTextField();
addDesignElementTo(retval, headerLine4Field1, 65, 52, 472, 20);
final JRDesignTextField headerLine5Field1 = h5("$P{report}.getBeginDate()").toTextField(java.util.Date.class);
addDesignElementTo(retval, headerLine5Field1, 45, 72, 75, 20);
final JRDesignTextField headerLine5Field2 = h5("$P{report}.getEndDate()").toTextField(java.util.Date.class);
addDesignElementTo(retval, headerLine5Field2, 150, 72, 75, 20);
return retval;
}
示例3: createDetail
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* Create a detail section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
* {@link Detail} annotation and processes that {@link Detail} field.
*/
public JRBand createDetail(final Field subReport) throws Exception {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(SUBREPORT_HEIGHT - 25);
LOG.debug("Subreport Detail band has height of "+ retval.getHeight());
// In this case, we are creating a subreport and subreports have either a crosstab or not
LOG.debug("Checking if "+ subReport+ " is a crosstab "+ isCrosstab(subReport));
if (isCrosstab(subReport)) {
final JRDesignCrosstab crosstab = createCrosstab();
LOG.debug("Got crosstab of height "+ crosstab.getHeight()+
" and width "+ crosstab.getWidth()+
" adding to design of height "+ retval.getHeight());
retval.addElement(crosstab);
}
return retval;
}
示例4: createSummary
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* Create a summary section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
* {@link Summary} annotation and processes that {@link Summary} field.
*
* @return subreport is the {@link SubReport} {@link Field}
* @return {@link JRBand} of the summary that goes into a subreport
*/
public JRBand createSummary(final Field subReport) throws Exception {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(SUBREPORT_HEIGHT);
LOG.debug("Summary band has height of "+ retval.getHeight());
// In this case, we are creating a subreport and subreports have either a crosstab or not
LOG.debug("Checking if "+ subReport+ " is a crosstab "+ isCrosstab(subReport));
if (isCrosstab(subReport)) {
final JRDesignCrosstab crosstab = createCrosstab();
LOG.debug("Got crosstab of height "+ crosstab.getHeight()+ " and width "+ crosstab.getWidth()+ " adding to design of height "+ retval.getHeight());
retval.addElement(crosstab);
}
return retval;
}
示例5: createGroupHeader
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* Constructs a header for the {@link JRDesignGroup}
*
* @return {@link JRBand} instance that is your header
*/
protected JRBand createGroupHeader(final ReportInfo report) {
final JRDesignBand retval = new JRDesignBand();
retval.setHeight(PAGEHEADER_HEIGHT * 4);
final JRDesignTextField expenseType = h4("$F{expenseType}").toTextField();
addDesignElementTo(retval, expenseType, 0, PAGEHEADER_HEIGHT, CT_HEADER_WIDTH, CELL_HEIGHT + 10);
final JRDesignStaticText nameField = h5("Expense").toStaticText();
addDesignElementTo(retval, nameField, (CELL_WIDTH * 3 + 5) * 0, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
final JRDesignStaticText dateField = h5("Date").toStaticText();
addDesignElementTo(retval, dateField, (CELL_WIDTH * 3 + 5) * 1, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
final JRDesignStaticText amountField = h5("Amount").toStaticText();
addDesignElementTo(retval, amountField, (CELL_WIDTH * 3 + 5) * 2, PAGEHEADER_HEIGHT * 2 + CELL_HEIGHT, CELL_WIDTH * 3, CELL_HEIGHT);
return retval;
}
示例6: mergeExistingTitleWithTemplateTitle
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* we are now dropping the existing title on the ground in favour of the
* dynamically generated one based on the template
*
* @param designFile
* @param newTitle
* @param yoffset
*/
private void mergeExistingTitleWithTemplateTitle(JasperDesign designFile, JRDesignBand newTitle, int yoffset)
{
int maxY = 0;
// for (JRElement element : designFile.getTitle().getElements())
// {
//
// JRDesignElement de = (JRDesignElement) element;
// de.setY(de.getY() + yoffset);
// maxY = Math.max(maxY, de.getY() + element.getHeight());
// newTitle.addElement(element);
// }
newTitle.setHeight(Math.max(maxY + 2, yoffset + 2));
designFile.setTitle(newTitle);
}
示例7: createObject
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JRDesignBand band = new JRDesignBand();
String height = atts.getValue(JRXmlConstants.ATTRIBUTE_height);
if (height != null && height.length() > 0)
{
band.setHeight(Integer.parseInt(height));
}
String isSplitAllowed = atts.getValue(JRXmlConstants.ATTRIBUTE_isSplitAllowed);
if (isSplitAllowed != null && isSplitAllowed.length() > 0)
{
if (log.isWarnEnabled())
{
log.warn("The 'isSplitAllowed' attribute is deprecated. Use the 'splitType' attribute instead.");
}
if (Boolean.valueOf(isSplitAllowed).booleanValue())
{
band.setSplitType(SplitTypeEnum.STRETCH);
}
else
{
band.setSplitType(SplitTypeEnum.PREVENT);
}
}
SplitTypeEnum splitType = SplitTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_splitType));
if (splitType != null)
{
band.setSplitType(splitType);
}
return band;
}
示例8: getBandResizeCommand
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
public Command getBandResizeCommand(MBand mband, JasperDesign jDesign) {
JRDesignBand band = mband.getValue();
int w = jDesign.getPageWidth() - jDesign.getLeftMargin() - jDesign.getRightMargin();
// Check if the size is valid
int maxHeight = BandResizeTracker.getMaxBandHeight(band, jDesign);
if (band.getHeight() > maxHeight) {
band.setHeight(maxHeight - 1);
}
Dimension d = new Dimension(w, band.getHeight());
ILayout layout = LayoutManager.getLayout(new JRPropertiesHolder[] { band }, jDesign, null);
return new LayoutCommand(band, layout, d);
}
示例9: buildPageFooterBand
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* Build the page footer band
*
* @return
*/
private static JRDesignBand buildPageFooterBand() {
JRDesignBand band = new JRDesignBand();
band.setHeight(20);
JRDesignTextField rightText = new JRDesignTextField();
rightText.setY(0);
rightText.setWidth(300);
rightText.setHeight(15);
rightText.setHorizontalTextAlign(HorizontalTextAlignEnum.LEFT);
JRDesignExpression rightExpression = new JRDesignExpression();
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
rightExpression.setText("\" (C) " + calendar.get(Calendar.YEAR) + " \" + $R{" +
ApplicationBean.getInstance().getLicenseHolder() + " - " + RESOURCE_KEYS.RIGHTS + "}");
rightText.setExpression(rightExpression);
band.addElement(rightText);
JRDesignTextField pageText = new JRDesignTextField();
pageText.setX(720);
pageText.setY(0);
pageText.setWidth(60);
pageText.setHeight(15);
pageText.setHorizontalTextAlign(HorizontalTextAlignEnum.RIGHT);
JRDesignExpression pageExpression = new JRDesignExpression();
pageExpression.setText("$R{" + RESOURCE_KEYS.PAGE + "} + \" \" + $V{PAGE_NUMBER}");
pageText.setExpression(pageExpression);
band.addElement(pageText);
return band;
}
示例10: performAction
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
protected void performAction(org.openide.nodes.Node[] activatedNodes) {
JRDesignBand band = ((BandNode)activatedNodes[0]).getBand();
int height = ModelUtils.getMaxBandHeight(band, ((BandNode)activatedNodes[0]).getJasperDesign() );
int oldValue = band.getHeight();
if (oldValue < height)
{
band.setHeight(height);
ObjectPropertyUndoableEdit undo = new ObjectPropertyUndoableEdit(band,"Height",Integer.TYPE,oldValue,height);
IReportManager.getInstance().addUndoableEdit(undo);
IReportManager.getInstance().notifyReportChange();
}
}
示例11: performAction
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
protected void performAction(org.openide.nodes.Node[] activatedNodes) {
JRDesignGroup group = ((BandNode)activatedNodes[0]).getGroup();
JRDesignBand band = new JRDesignBand();
band.setHeight(50);
((JRDesignSection)group.getGroupHeaderSection()).addBand(band);
AddBandUndoableEdit undo = new AddBandUndoableEdit(band,((BandNode)activatedNodes[0]).getJasperDesign());
IReportManager.getInstance().addUndoableEdit(undo);
}
示例12: performAction
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
protected void performAction(org.openide.nodes.Node[] activatedNodes) {
JasperDesign jd = IReportManager.getInstance().getActiveReport();
if (jd != null)
{
JRDesignBand band = new JRDesignBand();
band.setHeight(50);
((JRDesignSection)jd.getDetailSection()).addBand(band);
AddBandUndoableEdit undo = new AddBandUndoableEdit(band,jd);
IReportManager.getInstance().addUndoableEdit(undo);
}
}
示例13: mousePressed
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event)
{
if (event.getButton() == MouseEvent.BUTTON1 &&
event.getClickCount() == 2 &&
widget instanceof BandSeparatorWidget)
{
JRDesignBand band = (JRDesignBand) ((BandSeparatorWidget)widget).getBand();
// Find the lowest coordinate of a contained element...
int height = 0;
List children = band.getChildren();
for (int i=0; i<children.size(); ++i)
{
if (children.get(i) instanceof JRDesignElement)
{
JRDesignElement ele = (JRDesignElement)children.get(i);
if (ele.getY() + ele.getHeight() > height)
{
height = ele.getY() + ele.getHeight();
}
}
}
if (height> 0 && height != band.getHeight())
{
band.setHeight(height);
}
}
return WidgetAction.State.REJECTED; // let someone use it...
}
示例14: performAction
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
protected void performAction(org.openide.nodes.Node[] activatedNodes) {
JRDesignGroup group = ((BandNode)activatedNodes[0]).getGroup();
JRDesignBand band = new JRDesignBand();
band.setHeight(50);
((JRDesignSection)group.getGroupFooterSection()).addBand(band);
AddBandUndoableEdit undo = new AddBandUndoableEdit(band,((BandNode)activatedNodes[0]).getJasperDesign());
IReportManager.getInstance().addUndoableEdit(undo);
}
示例15: createDetailForSummary
import net.sf.jasperreports.engine.design.JRDesignBand; //导入方法依赖的package包/类
/**
* Create a detail section in a {@link JasperReport}. Checks the {@link JasperReport} fields for a
* {@link Detail} annotation and processes that {@link Detail} field.
*/
protected JRBand createDetailForSummary(final ReportInfo report) throws Exception {
final JRDesignBand retval = new JRDesignBand();
int maxHeight = DETAIL_HEIGHT;
LOG.debug("Summary: Initial height is "+ DETAIL_HEIGHT);
retval.setHeight(CELL_HEIGHT + 5);
LOG.debug("Summary: Detail band has height of "+ maxHeight);
int y = 0;
LOG.info("Summary: Adding fields for detail");
final Field summaryField = getFieldWithAnnotation(report, Summary.class);
if (isCrosstab(summaryField)) {
// If the summary has a crosstab, then we want to use the Summary section for rendering the crosstab.
final Collection<JRChild> elements = processFields(report, Summary.class, Crosstab.class);
for (final JRChild element : elements) {
final JRDesignCrosstab crosstab = (JRDesignCrosstab) element;
LOG.debug("Adding crosstab to summary "+ crosstab+ " with height "+ crosstab.getHeight());
crosstab.setY(y);
retval.addElement(crosstab);
y += crosstab.getHeight() + PAGEHEADER_HEIGHT;
retval.setHeight(y);
}
}
else {
// No crosstab, so use the detail
final JRDesignTextField nameField = normal("$F{name}").toTextField();
addDesignElementTo(retval, nameField, (CELL_WIDTH * 3 + 5) * 0, 0, CELL_WIDTH * 3, CELL_HEIGHT);
final JRDesignTextField amountField = normal("$F{amount}").toTextField(java.math.BigDecimal.class);
addDesignElementTo(retval, amountField, (CELL_WIDTH * 3 + 5) * 1, 0, CELL_WIDTH * 3, CELL_HEIGHT);
}
return retval;
}