protected JRBand createDetailBand(List<FillColumn> fillColumns) { final JRDesignBand detailBand = new JRDesignBand(); detailBand.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(detailBand, BandTypeEnum.DETAIL.getName()); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { DetailBandCreator subVisitor = new DetailBandCreator( bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); return detailBand; }
protected JRDesignBand createColumnHeader(List<FillColumn> fillColumns) { JRDesignBand columnHeader = new JRDesignBand(); columnHeader.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(columnHeader, BandTypeEnum.COLUMN_HEADER.getName()); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { ColumnHeaderCreator subVisitor = new ColumnHeaderCreator( bandInfo, subcolumn, xOffset, 0, 0, headerHtmlBaseProperties, new AtomicBoolean()); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, true); if (columnHeader.getHeight() == 0) { columnHeader = null; } return columnHeader; }
protected JRDesignBand createPageFooter(List<FillColumn> fillColumns) { JRDesignBand pageFooter = new JRDesignBand(); pageFooter.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(pageFooter, BandTypeEnum.PAGE_FOOTER.getName()); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { PageFooterCreator subVisitor = new PageFooterCreator( bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); if (pageFooter.getHeight() == 0) { pageFooter = null; } return pageFooter; }
protected JRDesignBand createTitle(List<FillColumn> fillColumns) { JRDesignBand title = new JRDesignBand(); title.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(title, BandTypeEnum.TITLE.getName()); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { TitleCreator subVisitor = new TitleCreator( bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); if (title.getHeight() == 0) //FIXMETABLE not sure we actually need this; maybe check the section is truly empty; do the same for the other sections as well { title = null; } return title; }
protected JRDesignBand createSummary(List<FillColumn> fillColumns) { JRDesignBand summary = new JRDesignBand(); summary.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(summary, BandTypeEnum.SUMMARY.getName()); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { SummaryCreator subVisitor = new SummaryCreator( bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); if (summary.getHeight() == 0) { summary = null; } return summary; }
protected JRBand createGroupHeader(String groupName, List<FillColumn> fillColumns) { JRDesignBand header = new JRDesignBand(); header.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(header, BandTypeEnum.GROUP_HEADER + "-" + groupName); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { GroupHeaderCreator subVisitor = new GroupHeaderCreator(groupName, bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); if (header.getHeight() == 0) { header = null; } return header; }
protected JRBand createGroupFooter(String groupName, List<FillColumn> fillColumns) { JRDesignBand footer = new JRDesignBand(); footer.setSplitType(SplitTypeEnum.PREVENT); ReportBandInfo bandInfo = new ReportBandInfo(footer, BandTypeEnum.GROUP_FOOTER + "-" + groupName); int xOffset = 0; for (FillColumn subcolumn : fillColumns) { GroupFooterCreator subVisitor = new GroupFooterCreator(groupName, bandInfo, subcolumn, xOffset, 0, 0); subVisitor.visit(); xOffset = subVisitor.xOffset; } setPdfTags(bandInfo, false); if (footer.getHeight() == 0) { footer = null; } return footer; }
@DataProvider public Object[][] stringMasks() { return new Object[][] { {""}, {"foo"}, {"bar"}, {BandTypeEnum.TITLE.name()}, {BandTypeEnum.SUMMARY.name()}, {BandTypeEnum.PAGE_HEADER.name()}, {BandTypeEnum.PAGE_FOOTER.name()}, {BandTypeEnum.COLUMN_FOOTER.name()}, {BandTypeEnum.COLUMN_HEADER.name()}, {BandTypeEnum.DETAIL.name()}, {BandTypeEnum.GROUP_HEADER.name() + "-foo"}, {BandTypeEnum.GROUP_FOOTER.name() + "-foo"}, }; }
/** * Gets the band location. * * @param b * the b * @param jd * the jd * @return the band location */ public static int getBandLocation(JRBand b, JasperDesign jd) { int yLocation = jd.getTopMargin(); List<JRBand> bands = ModelUtils.getBands(jd); for (JRBand tmpBand : bands) { // Detached background... if (tmpBand instanceof JRDesignBand) { if (((JRDesignBand) tmpBand).getOrigin().getBandTypeValue().equals(BandTypeEnum.BACKGROUND)) { // if (IReportManager.getInstance().isBackgroundSeparated()) // { // yLocation += jd.getTopMargin(); // yLocation += jd.getBottomMargin(); // yLocation += 40; // } } } if (tmpBand == b) return yLocation; yLocation += tmpBand.getHeight(); } return yLocation; }
public String getDisplayText() { JRDesignBand value = (JRDesignBand) getValue(); String hiddenText = new String(); if (!isVisible()){ hiddenText = Messages.MBand_hiddenLabel; } if (bandType.equals(BandTypeEnum.DETAIL)) { String index = ""; //$NON-NLS-1$ if (bandIndex != -1) index = " " + String.valueOf(bandIndex); //$NON-NLS-1$ if (value != null) return Messages.MBand_detail + index + " [" + value.getHeight() + "px]"+hiddenText;// + value.hashCode(); //$NON-NLS-1$ //$NON-NLS-2$ return Messages.MBand_detail + index + " "; //$NON-NLS-1$ } if (value == null) return MessagesByKeys.getString(bandType.getName()); return MessagesByKeys.getString(value.getOrigin().getBandTypeValue().getName()+hiddenText); }
public MBandGroup(ANode parent, JRDesignGroup jrGroup, JRBand jrband, BandTypeEnum bandtype, int newIndex){ super(parent, jrband, bandtype, newIndex); this.jrGroup = jrGroup; mGroup = new MGroup(null, jrGroup, -1); setChildListener(mGroup); mGroupBand = new MGroupBand(jrGroup); // Fix missing jasper configuration if (parent != null) { JasperReportsConfiguration jconfig = parent.getJasperConfiguration(); if (jconfig != null) { mGroup.setJasperConfiguration(jconfig); mGroupBand.setJasperConfiguration(jconfig); } } bandIndex = -1; refreshIndex(); }
protected IFigure createFigure() { JRDesignBand jrBand = getBand(); BandTypeEnum bandTypeValue = jrBand.getOrigin().getBandTypeValue(); boolean drawColumns = bandTypeValue.equals(BandTypeEnum.COLUMN_FOOTER) || bandTypeValue.equals(BandTypeEnum.COLUMN_HEADER) || bandTypeValue.equals(BandTypeEnum.GROUP_FOOTER) || bandTypeValue.equals(BandTypeEnum.GROUP_HEADER) || bandTypeValue.equals(BandTypeEnum.COLUMN_HEADER) || bandTypeValue.equals(BandTypeEnum.DETAIL); BandFigure rect = new BandFigure(drawColumns, getModel()); rect.setForegroundColor(ColorConstants.blue); setupBandFigure(rect); figure = rect; setBandNameShowing(rect); setMarginColor(); return rect; }
@Override protected Command createCommand() { List<Object> bands = editor.getSelectionCache().getSelectionModelForType(MBand.class); if (bands.isEmpty()) return null; MBand firstBand = (MBand)bands.get(0); JSSCompoundCommand cmd = new JSSCompoundCommand(firstBand); for(Object obj : bands){ MBand bandNode = (MBand)obj; if ( bandNode.getBandType() == BandTypeEnum.GROUP_FOOTER || bandNode.getBandType() == BandTypeEnum.GROUP_HEADER){ cmd.add(new ReorderBandCommandByRelativeIndex((MBandGroupFooter) bandNode, 1)); } else if (bandNode.getBandType() == BandTypeEnum.DETAIL) { cmd.add(new ReorderBandCommandByRelativeIndex(bandNode, (MReport) bandNode.getParent(), 1)); } } return cmd.isEmpty() ? null : cmd; }
@Override protected Command createCommand() { List<Object> bands = editor.getSelectionCache().getSelectionModelForType(MBand.class); if (bands.isEmpty()) return null; MBand firstBand = (MBand)bands.get(0); JSSCompoundCommand cmd = new JSSCompoundCommand(firstBand); for(Object obj : bands){ MBand bandNode = (MBand)obj; if ( bandNode.getBandType() == BandTypeEnum.GROUP_FOOTER || bandNode.getBandType() == BandTypeEnum.GROUP_HEADER){ cmd.add(new ReorderBandCommandByRelativeIndex((MBandGroupFooter) bandNode, -1)); } else if (bandNode.getBandType() == BandTypeEnum.DETAIL) { cmd.add(new ReorderBandCommandByRelativeIndex(bandNode, (MReport) bandNode.getParent(), -1)); } } return cmd.isEmpty() ? null : cmd; }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignComponentElement element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { ((StandardMapComponent)(element.getComponent())).setEvaluationTime(EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignComponentElement element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { ((SpiderChartComponent)(element.getComponent())).setEvaluationTime(EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignComponentElement element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { ((SortComponent)(element.getComponent())).setEvaluationTime(EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignComponentElement element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { ((HtmlComponent)(element.getComponent())).setEvaluationTime(EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
public static int getBandLocation(JRBand b, JasperDesign jd) { int yLocation = jd.getTopMargin(); List<JRBand> bands = ModelUtils.getBands(jd); for (JRBand tmpBand : bands) { // Detached background... if (tmpBand instanceof JRDesignBand) { if (((JRDesignBand)tmpBand).getOrigin().getBandTypeValue() == BandTypeEnum.BACKGROUND) { if (IReportManager.getInstance().isBackgroundSeparated()) { yLocation += jd.getTopMargin(); yLocation += jd.getBottomMargin(); yLocation += 40; } } } if (tmpBand == b) return yLocation; yLocation += tmpBand.getHeight(); } return yLocation; }
public NullBandNode(JasperDesign jd, NullBand band,Lookup doLkp) { super (Children.LEAF, new ProxyLookup( doLkp, Lookups.fixed(jd, band))); this.jd = jd; this.band = band; setDisplayName ( ModelUtils.nameOf(band.getOrigin())); if (band.getOrigin().getBandTypeValue() == BandTypeEnum.GROUP_FOOTER) { setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/groupfooter-16.png"); } else if (band.getOrigin().getBandTypeValue() == BandTypeEnum.GROUP_HEADER) { setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/groupheader-16.png"); } else { setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/band-16.png"); } }
@Override public Action[] getActions(boolean popup) { java.util.List<Action> list = new ArrayList<Action>(); list.add( SystemAction.get(AddBandAction.class)); if (band.getOrigin().getBandTypeValue() == BandTypeEnum.BACKGROUND) { list.add(SystemAction.get(MaximizeBackgroundAction.class)); } JRDesignGroup group = getGroup(); if (group != null) { list.add( null ); list.add( SystemAction.get(MoveGroupUpAction.class)); list.add( SystemAction.get(MoveGroupDownAction.class)); list.add( DeleteGroupAction.getInstance() ); } return list.toArray(new Action[list.size()]); }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignChart element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { element.setEvaluationTime( EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
private boolean isInDetailBand(Point location) { Scene scene = OutlineTopComponent.getDefault().getCurrentJrxmlVisualView().getReportDesignerPanel().getActiveScene(); if (scene != null && scene instanceof ReportObjectScene) { JasperDesign jd = ((ReportObjectScene)scene).getJasperDesign(); Point p = scene.convertViewToScene(location); JRDesignBand band = ModelUtils.getBandAt(jd, p); if (band != null && band.getOrigin().getBandTypeValue().equals(BandTypeEnum.DETAIL)) { return true; } } return false; }
public void addBandSeparatorWidget(JRBand b, int yLocation) { if (b == null) return; if (b instanceof JRDesignBand && ((JRDesignBand)b).getOrigin().getBandTypeValue() == BandTypeEnum.BACKGROUND) { ((JRDesignBand)b).getEventSupport().removePropertyChangeListener(JRDesignBand.PROPERTY_HEIGHT, this); if (IReportManager.getInstance().isBackgroundSeparated() && b.getHeight() == 0) { ((JRDesignBand)b).getEventSupport().addPropertyChangeListener(JRDesignBand.PROPERTY_HEIGHT, this); return; } } BandSeparatorWidget bbw = new BandSeparatorWidget(this, b); bbw.getActions().addAction( new BandMoveAction(true, InputEvent.SHIFT_DOWN_MASK) ); bbw.getActions().addAction( new BandMoveAction() ); bbw.getActions().addAction( new BandDblClickResizeAction()); bandSeparatorsLayer.addChild(bbw); bandLayer.addChild(new BandWidget(this, b)); }
@Override public Object createObject(Attributes atts) { return new JROrigin( atts.getValue(JRXmlConstants.ATTRIBUTE_report), atts.getValue(JRXmlConstants.ATTRIBUTE_group), BandTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_band)) ); }
protected void setSectionOrigin(JRSection section, BandTypeEnum type) { if (section instanceof JRDesignSection) { JROrigin origin = new JROrigin(null, getName(), type); ((JRDesignSection) section).setOrigin(origin); } }
protected void setBandOrigin(JRBand band, BandTypeEnum type) { if (band instanceof JRDesignBand) { JROrigin origin = new JROrigin(null, getName(), type); ((JRDesignBand) band).setOrigin(origin); } }
@SuppressWarnings("deprecation") public JasperDesign(JasperReportsContext context) { setMainDataset(new JRDesignDataset(context, true)); detailSection = new JRDesignSection(new JROrigin(BandTypeEnum.DETAIL)); }
/** * Sets the background band. */ public void setBackground(JRBand background) { Object old = this.background; this.background = background; setBandOrigin(this.background, BandTypeEnum.BACKGROUND); getEventSupport().firePropertyChange(PROPERTY_BACKGROUND, old, this.background); }
/** * Sets the title band. */ public void setTitle(JRBand title) { Object old = this.title; this.title = title; setBandOrigin(this.title, BandTypeEnum.TITLE); getEventSupport().firePropertyChange(PROPERTY_TITLE, old, this.title); }
/** * Sets the summary band. */ public void setSummary(JRBand summary) { Object old = this.summary; this.summary = summary; setBandOrigin(this.summary, BandTypeEnum.SUMMARY); getEventSupport().firePropertyChange(PROPERTY_SUMMARY, old, this.summary); }
/** * Sets the noData band. */ public void setNoData(JRBand noData) { Object old = this.noData; this.noData = noData; setBandOrigin(this.noData, BandTypeEnum.NO_DATA); getEventSupport().firePropertyChange(PROPERTY_NO_DATA, old, this.noData); }
/** * Sets the page header band. */ public void setPageHeader(JRBand pageHeader) { Object old = this.pageHeader; this.pageHeader = pageHeader; setBandOrigin(this.pageHeader, BandTypeEnum.PAGE_HEADER); getEventSupport().firePropertyChange(PROPERTY_PAGE_HEADER, old, this.pageHeader); }
/** * Sets the page footer band. */ public void setPageFooter(JRBand pageFooter) { Object old = this.pageFooter; this.pageFooter = pageFooter; setBandOrigin(this.pageFooter, BandTypeEnum.PAGE_FOOTER); getEventSupport().firePropertyChange(PROPERTY_PAGE_FOOTER, old, this.pageFooter); }
/** * Sets the last page footer band. */ public void setLastPageFooter(JRBand lastPageFooter) { Object old = this.lastPageFooter; this.lastPageFooter = lastPageFooter; setBandOrigin(this.lastPageFooter, BandTypeEnum.LAST_PAGE_FOOTER); getEventSupport().firePropertyChange(PROPERTY_LAST_PAGE_FOOTER, old, this.lastPageFooter); }
/** * Sets the column header band. */ public void setColumnHeader(JRBand columnHeader) { Object old = this.columnHeader; this.columnHeader = columnHeader; setBandOrigin(this.columnHeader, BandTypeEnum.COLUMN_HEADER); getEventSupport().firePropertyChange(PROPERTY_COLUMN_HEADER, old, this.columnHeader); }
/** * Sets the column footer band. */ public void setColumnFooter(JRBand columnFooter) { Object old = this.columnFooter; this.columnFooter = columnFooter; setBandOrigin(this.columnFooter, BandTypeEnum.COLUMN_FOOTER); getEventSupport().firePropertyChange(PROPERTY_COLUMN_FOOTER, old, this.columnFooter); }
protected void setBandOrigin(JRBand band, BandTypeEnum type) { if (band instanceof JRDesignBand) { JROrigin origin = new JROrigin(type); ((JRDesignBand) band).setOrigin(origin); } }
protected void setSectionOrigin(JRSection section, BandTypeEnum type) { if (section instanceof JRDesignSection) { JROrigin origin = new JROrigin(type); ((JRDesignSection) section).setOrigin(origin); } }
/** * */ public JROrigin( BandTypeEnum bandType ) { this(null, null, bandType); }