private void collectAlignableElements( final Section section, final List<Element> collectedElements) { if (section instanceof CrosstabGroup) { return; } final int theElementCount = section.getElementCount(); for (int i = 0; i < theElementCount; i++) { final ReportElement reportElement = section.getElement(i); if (reportElement instanceof Section) { collectAlignableElements((Section) reportElement, collectedElements); } final CachedLayoutData cachedLayoutData = ModelUtility.getCachedLayoutData((Element) reportElement); final long layoutAge = cachedLayoutData.getLayoutAge(); if (layoutAge != -1) { if (reportElement instanceof RootLevelBand) { continue; } if (reportElement instanceof Band || reportElement instanceof Section == false) { collectedElements.add((Element) reportElement); } } } }
public void resizeProportional() { final float originalPageWidth = originalPageDefinition.getWidth(); final float currentPageWidth = currentPageDefinition.getWidth(); final float scaleFactor = currentPageWidth / originalPageWidth; for (int i = 0; i < visualElements.length; i++) { // Resize the element. final CachedLayoutData cachedLayoutData = ModelUtility.getCachedLayoutData(visualElements[i]); final double elementWidth = StrictGeomUtility.toExternalValue(cachedLayoutData.getWidth()); final Element theElement = visualElements[i]; final ElementStyleSheet styleSheet = theElement.getStyle(); styleSheet.setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float(elementWidth * scaleFactor)); // Reposition the element. final double origin = StrictGeomUtility.toExternalValue(cachedLayoutData.getX()); final double destination = scaleFactor * origin; final int theShift = (int) (destination - origin); final Element[] theElements = new Element[1]; theElements[0] = theElement; align(theShift, theElements); } registerChanges(); }
private long computeFarRightPostion() { long theFarRightPostion = 0; for (int i = 0; i < visualElements.length; i++) { final CachedLayoutData theElementData = ModelUtility.getCachedLayoutData(visualElements[i]); final long theCurrentPosition = theElementData.getX() + theElementData.getWidth(); if (i == 0) { theFarRightPostion = theCurrentPosition; } else if (theCurrentPosition > theFarRightPostion) { theFarRightPostion = theCurrentPosition; } } return theFarRightPostion; }