protected void layout(Composite composite, boolean flushCache) { Rectangle bounds = composite.getBounds(); // offset the rectangle to allow for the margins bounds.x = marginLeft; bounds.y = marginTop; bounds.width -= (marginLeft + marginRight); bounds.height -= (marginTop + marginBottom); // If we were called directly we need to fill the caches if (lines.size() == 0) { if (horizontal) computeSize(composite, bounds.width, SWT.DEFAULT, true); else computeSize(composite, SWT.DEFAULT, bounds.height, true); } if (lines.size() == 0) return; for (TrimLine curLine : lines) { tileLine(curLine, bounds); if (horizontal) bounds.y += curLine.minor + wrapSpacing; else bounds.x += curLine.minor + wrapSpacing; } }
@Override protected void layout(Composite composite, boolean flushCache) { if (flushCache) { // Clear the current cache lines.clear(); } Rectangle bounds = composite.getBounds(); // offset the rectangle to allow for the margins bounds.x = marginLeft; bounds.y = marginTop; bounds.width -= (marginLeft + marginRight); bounds.height -= (marginTop + marginBottom); // If we were called directly we need to fill the caches if (lines.isEmpty()) { if (horizontal) computeSize(composite, bounds.width, SWT.DEFAULT, true); else computeSize(composite, SWT.DEFAULT, bounds.height, true); } if (lines.isEmpty()) return; for (TrimLine curLine : lines) { tileLine(curLine, bounds); if (horizontal) bounds.y += curLine.minor + wrapSpacing; else bounds.x += curLine.minor + wrapSpacing; } }