/** * Clones the group list and all contained groups. * * @return a clone of this list. * @throws CloneNotSupportedException * if cloning the element failed. * @see Cloneable */ public Object clone() throws CloneNotSupportedException { final GroupList l = (GroupList) super.clone(); final Group[] groups = getGroupCache(); l.backend = (ArrayList) backend.clone(); l.backend.clear(); final int length = groups.length; l.cache = new RelationalGroup[length]; for ( int i = 0; i < length; i++ ) { final RelationalGroup group = (RelationalGroup) groups[i].clone(); l.backend.add( group ); l.cache[i] = group; } return l; }
protected void removeElement( final Element element ) { if ( element == null ) { throw new NullPointerException(); } if ( body == element ) { this.body.setParent( null ); this.body = createDefaultBody(); this.body.setParent( this ); notifyNodeChildRemoved( element ); notifyNodeChildAdded( this.body ); } // Else: Ignore the request, none of my childs. }
/** * Clones the report. * * @return the clone. */ public SubGroupBody derive( final boolean preserveElementInstanceIds ) { final SubGroupBody o = (SubGroupBody) super.derive( preserveElementInstanceIds ); o.group = (Group) group.derive( preserveElementInstanceIds ); o.registerAsChild( o.group ); return o; }
/** * Constructs a group with no fields, and an empty header and footer. */ protected Group() { this.body = createDefaultBody(); registerAsChild( body ); }
private Group getInnerMostGroup() { Group existingGroup = rootGroup; while ( existingGroup != null ) { Group next = existingGroup.getBody().getGroup(); if ( next == null ) { return existingGroup; } existingGroup = next; } throw new IllegalStateException( "We shall never reach this point." ); }
public void removeGroup( final RelationalGroup deleteGroup ) { // Checks if we have a group to remove if not then throw an exception if ( deleteGroup == null ) { throw new NullPointerException( "AbstractReporDefinition.addGroup(..) : Null not permitted" ); } // Special case check to see if we're removing the root group. if ( rootGroup == deleteGroup ) { // If we're at root then removeRootGroup(); // Remove it an exit return; } // Walk through the groups and find the one that we need to remove Group currentGroup = rootGroup; Group parentGroup = null; GroupBody currentGroupBody = currentGroup.getBody(); while ( currentGroupBody instanceof SubGroupBody && currentGroup != deleteGroup ) { parentGroup = currentGroup; final SubGroupBody sgb = (SubGroupBody) currentGroupBody; currentGroup = sgb.getGroup(); currentGroupBody = currentGroup.getBody(); } if ( currentGroup == deleteGroup ) { // if this is true then we found the group we need to remove parentGroup.setBody( currentGroupBody ); final SubGroupBody subGroupBody = (SubGroupBody) currentGroup.getParentSection(); subGroupBody.setParent( parentGroup ); } }
protected void processGroupHeaders( final Group group ) { final int elementCount = group.getElementCount(); for ( int i = 0; i < elementCount; i += 1 ) { final Element e = group.getElement( i ); final ElementMetaData.TypeClassification reportElementType = e.getMetaData().getReportElementType(); if ( ( reportElementType != ElementMetaData.TypeClassification.RELATIONAL_HEADER ) && ( reportElementType != ElementMetaData.TypeClassification.HEADER ) ) { continue; } final Band b = (Band) e; processRootBand( b ); } }
public boolean matches( final String name ) { if ( ObjectUtilities.equal( name, getName() ) ) { return true; } return ObjectUtilities.equal( name, getGeneratedName() ); }
/** * Adds a group to the report. This replaces the group body on the group with a new data-group-body composed of the * existing itemband and no-databand. * * @param group * the group. */ public void addGroup( final RelationalGroup group ) { if ( group == null ) { throw new NullPointerException( "AbstractReporDefinition.addGroup(..) : Null not permitted" ); } final Group existingGroup = getInnerMostRelationalGroup(); final GroupBody gb = existingGroup.getBody(); existingGroup.setBody( new SubGroupBody( group ) ); group.setBody( gb ); }
private void removeRootGroup() { final Group group = rootGroup; final GroupBody rootBody = rootGroup.getBody(); if ( group instanceof CrosstabGroup ) { rootGroup = new CrosstabGroup(); rootGroup.setBody( rootBody ); } else { if ( rootBody instanceof SubGroupBody ) { final SubGroupBody newRootGroup = (SubGroupBody) rootBody; rootGroup.removeElement( rootBody ); rootGroup = newRootGroup.getGroup(); registerAsChild( rootGroup ); } else { rootGroup = new RelationalGroup(); rootGroup.setBody( rootBody ); } } unregisterAsChild( group ); registerAsChild( rootGroup ); notifyNodeChildRemoved( group ); notifyNodeChildAdded( rootGroup ); }
public void summaryRowSelection( final ReportEvent event ) { if ( rowbandingOnGroup == false ) { return; } if ( StringUtils.isEmpty( group ) ) { final Group group = event.getReport().getGroup( event.getState().getCurrentGroupIndex() ); if ( group instanceof CrosstabRowGroup ) { final GroupBody body = group.getBody(); if ( body instanceof CrosstabColumnGroupBody ) { if ( Boolean.TRUE.equals( group.getAttribute( AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY ) ) ) { triggerVisibleStateCrosstab( event ); } } } } else { if ( FunctionUtilities.isDefinedGroup( group, event ) ) { final Group group = event.getReport().getGroup( event.getState().getCurrentGroupIndex() ); if ( Boolean.TRUE.equals( group.getAttribute( AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY ) ) ) { triggerVisibleStateCrosstab( event ); } } } }
private List<SortConstraint> collectSortData( final Group rootGroup, final ArrayList<SortConstraint> sorts ) { sorts.addAll( rootGroup.getSortingConstraint() ); GroupBody body = rootGroup.getBody(); Group group = body.getGroup(); if ( group == null ) { // todo: Allow additional sorting based on item/detail data? return sorts; } return collectSortData( group, sorts ); } }
final AbstractReportDefinition report = (AbstractReportDefinition) super.clone(); report.eventListeners = null; report.rootGroup = rootGroup.clone(); report.watermark = (Watermark) watermark.clone(); report.pageFooter = (PageFooter) pageFooter.clone(); report.expressions = expressions.clone(); report.dataSchemaDefinition = (DataSchemaDefinition) dataSchemaDefinition.clone(); report.rootGroup.setParent( report ); report.reportHeader.setParent( report ); report.reportFooter.setParent( report );
public AbstractReportDefinition derive( final boolean preserveElementInstanceIds ) { final AbstractReportDefinition report = (AbstractReportDefinition) super.derive( preserveElementInstanceIds ); report.eventListeners = null; report.rootGroup = rootGroup.derive( preserveElementInstanceIds ); report.watermark = (Watermark) watermark.derive( preserveElementInstanceIds ); report.pageFooter = (PageFooter) pageFooter.derive( preserveElementInstanceIds ); report.pageHeader = (PageHeader) pageHeader.derive( preserveElementInstanceIds ); report.reportFooter = (ReportFooter) reportFooter.derive( preserveElementInstanceIds ); report.reportHeader = (ReportHeader) reportHeader.derive( preserveElementInstanceIds ); report.expressions = expressions.clone(); report.dataSchemaDefinition = (DataSchemaDefinition) dataSchemaDefinition.clone(); report.rootGroup.setParent( report ); report.reportHeader.setParent( report ); report.reportFooter.setParent( report ); report.pageHeader.setParent( report ); report.pageFooter.setParent( report ); report.watermark.setParent( report ); final ReportPreProcessor[] reportPreProcessors = report.getPreProcessors(); for ( int i = 0; i < reportPreProcessors.length; i++ ) { reportPreProcessors[i] = reportPreProcessors[i].clone(); } report.setAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.PREPROCESSORS, reportPreProcessors ); final StructureFunction[] structureFunctions = report.getStructureFunctions(); for ( int i = 0; i < structureFunctions.length; i++ ) { structureFunctions[i] = (StructureFunction) structureFunctions[i].getInstance(); } report.setAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.STRUCTURE_FUNCTIONS, structureFunctions ); return report; }
/** * Returns the details header band. * * @return The details header band. */ public DetailsHeader getDetailsHeader() { return (DetailsHeader) getInnerMostGroup().getChildElementByType( DetailsHeaderType.INSTANCE ); }
public String getName() { final String name = super.getName(); if ( StringUtils.isEmpty( name ) ) { return getGeneratedName(); } else { return name; } }
public String getGeneratedName() { final String generatedName = this.generatedName; if ( generatedName != null ) { return generatedName; } final String name = generatedName(); this.generatedName = name; return name; }
public boolean isAscendingSortOrder() { Object attribute = getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.SORT_ORDER ); if ( Boolean.FALSE.equals( attribute ) ) { return false; } return true; }
public CrosstabCellBody getCrosstabCellBody() { final Group group = getInnerMostGroup(); final GroupBody body = group.getBody(); if ( body instanceof CrosstabCellBody ) { return (CrosstabCellBody) body; } return null; }