private String generatedName() { int parentGroupCounter = 0; Section parent = getParentSection(); while ( parent != null && parent instanceof ReportDefinition == false ) { if ( parent instanceof Group ) { parentGroupCounter += 1; } parent = parent.getParentSection(); } return "::group-" + parentGroupCounter; }
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 ); } }
final Section parentSection = g.getParentSection(); if ( parentSection == null ) { return false;