private void addFieldHeader(GridColumnVO columnVO) { JRDesignBand bHeader = (JRDesignBand) jasperDesign.getColumnHeader(); JRDesignStaticText text = new JRDesignStaticText(); text.setText(columnVO.getTitle()); text.setWidth(columnVO.getWidth()); text.setHeight(bHeader.getHeight()); text.setX(px); // Set syle text.setFontName(gridReportVO.getHeaderBandStyle().getFontName()); text.setFontSize(new Float(gridReportVO.getHeaderBandStyle().getFontSize())); text.setForecolor(gridReportVO.getHeaderBandStyle().getForeColor()); text.setBold(gridReportVO.getHeaderBandStyle().isBold()); text.setItalic(gridReportVO.getHeaderBandStyle().isItalic()); text.setUnderline(gridReportVO.getHeaderBandStyle().isUnderline()); if (log4j.isDebugEnabled()) log4j.debug("Field Header, field: " + columnVO.getTitle() + " Width: " + columnVO.getWidth() + " X: " + px); bHeader.addElement(text); }
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; }
/** * Gets the band4 point. * * @param jd * the jd * @param point * the point * @return the band4 point */ public static MBand getBand4Point(INode jd, Point point) { INode res = jd; INode rNode = jd; // root node from drag&drop operation int xband = jd.getJasperDesign().getTopMargin(); // iterate IGraphicElements, and look at their position // find the top level container for this element for (INode n : rNode.getChildren()) { if (n instanceof IGraphicElement) { Object de = n.getValue(); if (de instanceof JRDesignBand) { JRDesignBand deband = (JRDesignBand) de; res = (ANode) n; if (point.y >= xband && point.y < xband + deband.getHeight()) { // go to children, we have the band allready break; } xband += deband.getHeight(); } } } if (res instanceof MBand) return (MBand) res; return null; }
/** * 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 Object getPropertyValue(Object id) { JRDesignBand jrband = (JRDesignBand) getValue(); if (jrband != null) { if (id.equals(JRDesignBand.PROPERTY_HEIGHT)) return new Integer(jrband.getHeight()); if (id.equals(JRDesignBand.PROPERTY_SPLIT_TYPE)) return splitStyleD.getEnumValue(jrband.getSplitTypeValue()); if (id.equals(JRDesignBand.PROPERTY_PRINT_WHEN_EXPRESSION)) { return ExprUtil.getExpression(jrband.getPrintWhenExpression()); } if (id.equals(MGraphicElement.PROPERTY_MAP)) { // to avoid duplication I remove it first return jrband.getPropertiesMap().cloneProperties(); } } return null; }
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); } } }
public Rectangle getBounds() { INode parent = getParent(); Rectangle parentBounds = ((IGraphicElement) parent).getBounds(); Rectangle bounds = new Rectangle(parentBounds); if (getValue() == null) { return parentBounds; } else { bounds.setSize(parentBounds.width, ((JRDesignBand) getValue()).getHeight()); int h = 0; for (INode b : parent.getChildren()) { if (b == this) break; if (b instanceof MBand) { if (b.getValue() != null) h += ((JRDesignBand) b.getValue()).getHeight() + BAND_GAP; } } bounds.setLocation(parentBounds.x, h + getJasperDesign().getTopMargin()); } return bounds; }
/** * Handle band changed. * * @param evt * the evt */ private void handleBandChanged(PropertyChangeEvent evt) { for (Iterator<?> it = getChildren().iterator(); it.hasNext();) { ANode node = (ANode) it.next(); if (node instanceof MBand) { MBand mBand = (MBand) node; if (evt.getPropertyName().equals(mBand.getBandType().getName())) { mBand.setValue(evt.getNewValue()); if (evt.getNewValue() != null) ReportFactory.createElementsForBand(mBand, ((JRDesignBand) evt.getNewValue()).getChildren()); else mBand.removeChildren(); mBand.propertyChange(new PropertyChangeEvent(mBand, "VALUE", evt.getOldValue(), evt.getNewValue())); //$NON-NLS-1$ break; } } } }
/** * Create a very minimal jasperdesign where the static text is placed. It is cached * since we don't need to create it everytime */ private static void createDesign() { jasperDesign = new JasperDesign(); JRDesignBand jrBand = new JRDesignBand(); jasperDesign.setTitle(jrBand); textElement = new JRDesignStaticText(); jasperDesign.setLeftMargin(0); jasperDesign.setRightMargin(0); jasperDesign.setTopMargin(0); jasperDesign.setBottomMargin(0); jrBand.addElement(textElement); jrBand.setSplitType(SplitTypeEnum.STRETCH); textElement.setStretchType(StretchTypeEnum.NO_STRETCH); textElement.setPrintRepeatedValues(false); textElement.setPrintWhenDetailOverflows(true); }
public ResizeCommand(int alignement, MGraphicElement m) { super(); this.alignement = alignement; jrElement = (JRDesignElement) m.getValue(); INode n = m.getParent(); //Get the real parent of the element if it's inside a subeditor if (n instanceof MPage){ MPage page = (MPage)n; n = page.getRealParent(); } if (n instanceof IContainer) { if (n instanceof MBand) { // height of band, width of Report - margins JRDesignBand band = (JRDesignBand) ((MBand) n).getValue(); int h = band.getHeight(); JasperDesign jasperDesign = m.getJasperDesign(); int w = jasperDesign.getPageWidth() - jasperDesign.getLeftMargin() - jasperDesign.getRightMargin(); parent = new Dimension(w, h); } else if (n instanceof IGraphicElementContainer) parent = ((IGraphicElementContainer) n).getSize(); } }
public AlignCommand(int alignement, MGraphicElement m){ super(); this.alignement = alignement; jrElement = (JRDesignElement) m.getValue(); INode n = m.getParent(); if (n instanceof IContainer) { if (n instanceof MBand) { // height of band, width of Report - margins int h = ((JRDesignBand) ((MBand) n).getValue()).getHeight(); JasperDesign jasperDesign = m.getJasperDesign(); int w = jasperDesign.getPageWidth() - jasperDesign.getLeftMargin() - jasperDesign.getRightMargin(); parent = new Dimension(w, h); } else if (n instanceof IGraphicElementContainer) parent = ((IGraphicElementContainer) n).getSize(); } }
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; }
private static void addBands(List<ColumnFieldTO> columnFields, JasperDesign jasperDesign, boolean isGrid, Locale locale) { JRDesignBand band; // Title if (!isGrid) { band = buildTitleBand(jasperDesign); jasperDesign.setTitle(band); } // Page header band = buildPageHeaderBand(columnFields, jasperDesign, isGrid); jasperDesign.setPageHeader(band); // Column header // Detail band = buildDetailBand(columnFields, jasperDesign, isGrid, locale); ((JRDesignSection) jasperDesign.getDetailSection()).addBand(band); // Column footer // Page footer if (!isGrid) { band = buildPageFooterBand(); jasperDesign.setPageFooter(band); } // Summary }
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 void propertyChange(PropertyChangeEvent evt) { Runnable r = null; if (evt.getPropertyName() == null) return; if (evt.getPropertyName().equals( JRDesignBand.PROPERTY_HEIGHT)) { r = new Runnable(){ public void run() { ((ReportObjectScene)getScene()).refreshDocument(); }}; } else if (evt.getPropertyName().equals( JRDesignBand.PROPERTY_CHILDREN)) { r = new Runnable(){ public void run() { //((ReportObjectScene)getScene()).refreshElementGroup( (JRDesignBand)band); }}; } if (r != null) { ThreadUtils.invokeInAWTThread(r); } }
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); }
@Override public void undo() throws CannotUndoException { super.undo(); if (oldBand != null && newBand != oldBand) { int y1 = ModelUtils.getBandLocation(newBand, getJasperDesign()); int y0 = ModelUtils.getBandLocation(oldBand, getJasperDesign()); int deltaBand = y0 - y1; // Update element band... newBand.getChildren().remove(getElement()); //oldBand.removeElement(dew.getElement()); // Update the element coordinates... getElement().setElementGroup(oldBand); getElement().setY(getElement().getY() - deltaBand); oldBand.getChildren().add(getElement()); newBand.getEventSupport().firePropertyChange(JRDesignBand.PROPERTY_CHILDREN, null, null); oldBand.getEventSupport().firePropertyChange(JRDesignBand.PROPERTY_CHILDREN, null, null); } }
@Override public void redo() throws CannotRedoException { super.redo(); if (newBand != null && newBand != oldBand) { int y1 = ModelUtils.getBandLocation(newBand, getJasperDesign()); int y0 = ModelUtils.getBandLocation(oldBand, getJasperDesign()); int deltaBand = y0 - y1; // Update element band... oldBand.getChildren().remove(getElement()); //oldBand.removeElement(dew.getElement()); // Update the element coordinates... getElement().setElementGroup(newBand); getElement().setY(getElement().getY() + deltaBand); newBand.getChildren().add(getElement()); newBand.getEventSupport().firePropertyChange(JRDesignBand.PROPERTY_CHILDREN, null, null); oldBand.getEventSupport().firePropertyChange(JRDesignBand.PROPERTY_CHILDREN, null, null); } }
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; }
private void addElement(JRDesignElement element, JRElementGroup elementGroup) { if (elementGroup instanceof JRDesignElementGroup) { ((JRDesignElementGroup)elementGroup).addElement(element); } else if (elementGroup instanceof JRDesignBand) { ((JRDesignBand)elementGroup).addElement(element); } else if (elementGroup instanceof JRDesignCellContents) { ((JRDesignCellContents)elementGroup).addElement(element); } else if (elementGroup instanceof JRDesignFrame) { ((JRDesignFrame)elementGroup).addElement(element); } }
private void addElementGroup(JRDesignElementGroup element, JRElementGroup elementGroup) { if (elementGroup instanceof JRDesignElementGroup) { ((JRDesignElementGroup)elementGroup).addElementGroup(element); } else if (elementGroup instanceof JRDesignBand) { ((JRDesignBand)elementGroup).addElementGroup(element); } else if (elementGroup instanceof JRDesignCellContents) { ((JRDesignCellContents)elementGroup).addElementGroup(element); } else if (elementGroup instanceof JRDesignFrame) { ((JRDesignFrame)elementGroup).addElementGroup(element); } }
private void removeElementGroup(JRDesignElementGroup element, JRElementGroup elementGroup) { if (elementGroup instanceof JRDesignElementGroup) { ((JRDesignElementGroup)elementGroup).removeElementGroup(element); } else if (elementGroup instanceof JRDesignBand) { ((JRDesignBand)elementGroup).removeElementGroup(element); } else if (elementGroup instanceof JRDesignCellContents) { ((JRDesignCellContents)elementGroup).removeElementGroup(element); } else if (elementGroup instanceof JRDesignFrame) { ((JRDesignFrame)elementGroup).removeElementGroup(element); } }
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)); }
public BandWidget(ReportObjectScene scene, JRBand band) { super(scene, Orientation.HORIZONTAL); this.band = band; // We set a border to improve the sensible area.... // setBorder( BorderFactory.createEmptyBorder(0, 3) ); // setCursor( Cursor.getPredefinedCursor( Cursor.S_RESIZE_CURSOR) ); // setForeground(ReportObjectScene.DESIGN_LINE_COLOR); // Add a listener to the band changes... if (band instanceof JRDesignBand) { ((JRDesignBand)band).getEventSupport().addPropertyChangeListener(this); } setToolTipText(ModelUtils.nameOf(band, scene.getJasperDesign())); updateBounds(); }
public void propertyChange(PropertyChangeEvent evt) { Runnable r = null; if (evt.getPropertyName() == null) return; if (evt.getPropertyName().equals( JRDesignBand.PROPERTY_HEIGHT)) { r = new Runnable(){ public void run() { ((ReportObjectScene)getScene()).refreshDocument(); }}; } // The children update is performed by the band separators widget!!!! // else if (evt.getPropertyName().equals( JRDesignBand.PROPERTY_CHILDREN)) // { // r = new Runnable(){ // public void run() { // ((ReportObjectScene)getScene()).refreshElementGroup( (JRDesignBand)band); // }}; // } if (r != null) { ThreadUtils.invokeInAWTThread(r); } }
public BandSeparatorWidget(ReportObjectScene scene, JRBand b) { super(scene, Orientation.HORIZONTAL); this.band=b; // We set a border to improve the sensible area.... setBorder( BorderFactory.createEmptyBorder(0, 3) ); setCursor( Cursor.getPredefinedCursor( Cursor.S_RESIZE_CURSOR) ); setForeground(ReportObjectScene.DESIGN_LINE_COLOR); // Add a listener to the band changes... if (b instanceof JRDesignBand) { ((JRDesignBand)b).getEventSupport().addPropertyChangeListener(this); if (((JRDesignBand)b).getOrigin().getGroupName() != null) { String gname = ((JRDesignBand)b).getOrigin().getGroupName(); JRDesignGroup group = (JRDesignGroup) scene.getJasperDesign().getGroupsMap().get(gname); if (group != null) { group.getEventSupport().addPropertyChangeListener(JRDesignGroup.PROPERTY_NAME , this ); } } } updateBounds(); }
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; }
/** * 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; }
/** * 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; }