diff options
author | Tore Engvig <tore@apache.org> | 2001-07-30 20:29:35 +0000 |
---|---|---|
committer | Tore Engvig <tore@apache.org> | 2001-07-30 20:29:35 +0000 |
commit | e0edd215721150e6c04ac49706622d6189cb0b42 (patch) | |
tree | 6b59b872d9c0e93f99316ea2f421209b71a97755 /src/org/apache/fop/layout/SpanArea.java | |
parent | eb57915dec9bcd907e495595efac60dbf3579ad8 (diff) | |
download | xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.tar.gz xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.zip |
Formatted code according to code standards.
Changed license to use short license.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/layout/SpanArea.java')
-rw-r--r-- | src/org/apache/fop/layout/SpanArea.java | 193 |
1 files changed, 93 insertions, 100 deletions
diff --git a/src/org/apache/fop/layout/SpanArea.java b/src/org/apache/fop/layout/SpanArea.java index 6cf6cd6f0..6ba58db1b 100644 --- a/src/org/apache/fop/layout/SpanArea.java +++ b/src/org/apache/fop/layout/SpanArea.java @@ -1,4 +1,5 @@ -/* $Id$ +/* + * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -16,116 +17,108 @@ import java.util.Vector; import java.util.Enumeration; public class SpanArea extends AreaContainer { - - private int columnCount; - private int currentColumn = 1; - private int columnGap = 0; - - // has the area been balanced? - private boolean isBalanced = false; - + + private int columnCount; + private int currentColumn = 1; + private int columnGap = 0; + + // has the area been balanced? + private boolean isBalanced = false; + public SpanArea(FontState fontState, int xPosition, int yPosition, - int allocationWidth, int maxHeight, - int columnCount, int columnGap) { - super(fontState, xPosition, yPosition, allocationWidth, - maxHeight, Position.ABSOLUTE); - - this.contentRectangleWidth = allocationWidth; - this.columnCount = columnCount; - this.columnGap = columnGap; - - int columnWidth = - (allocationWidth - columnGap*(columnCount-1)) / columnCount; - for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) - { - int colXPosition = (xPosition + columnIndex*(columnWidth + columnGap)); - int colYPosition = yPosition; - ColumnArea colArea = new ColumnArea(fontState, colXPosition, colYPosition, - columnWidth, maxHeight, columnCount); - addChild(colArea); - colArea.setColumnIndex(columnIndex+1); - } + int allocationWidth, int maxHeight, int columnCount, + int columnGap) { + super(fontState, xPosition, yPosition, allocationWidth, maxHeight, + Position.ABSOLUTE); + + this.contentRectangleWidth = allocationWidth; + this.columnCount = columnCount; + this.columnGap = columnGap; + + int columnWidth = (allocationWidth - columnGap * (columnCount - 1)) + / columnCount; + for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { + int colXPosition = (xPosition + + columnIndex * (columnWidth + columnGap)); + int colYPosition = yPosition; + ColumnArea colArea = new ColumnArea(fontState, colXPosition, + colYPosition, columnWidth, + maxHeight, columnCount); + addChild(colArea); + colArea.setColumnIndex(columnIndex + 1); + } } public void render(Renderer renderer) { - renderer.renderSpanArea(this); + renderer.renderSpanArea(this); } - public void end() { + public void end() {} + + public void start() {} + + public int spaceLeft() { + return maxHeight - currentHeight; } - public void start() { + public int getColumnCount() { + return columnCount; } - public int spaceLeft() { - return maxHeight - currentHeight; + public int getCurrentColumn() { + return currentColumn; + } + + public void setCurrentColumn(int currentColumn) { + if (currentColumn <= columnCount) + this.currentColumn = currentColumn; + else + this.currentColumn = columnCount; + } + + public AreaContainer getCurrentColumnArea() { + return (AreaContainer)getChildren().elementAt(currentColumn - 1); } - - public int getColumnCount() - { - return columnCount; - } - - public int getCurrentColumn() - { - return currentColumn; - } - - public void setCurrentColumn(int currentColumn) - { - if (currentColumn <= columnCount) - this.currentColumn = currentColumn; - else - this.currentColumn = columnCount; - } - - public AreaContainer getCurrentColumnArea() - { - return (AreaContainer)getChildren().elementAt(currentColumn-1); - } - - public boolean isBalanced() - { - return isBalanced; - } - - public void setIsBalanced() - { - this.isBalanced = true; - } - - public int getTotalContentHeight() - { - int totalContentHeight = 0; - for (Enumeration e = getChildren().elements(); e.hasMoreElements(); ) - { - totalContentHeight += ((AreaContainer)e.nextElement()).getContentHeight(); - } - return totalContentHeight; - } - - public int getMaxContentHeight() - { - int maxContentHeight = 0; - for (Enumeration e = getChildren().elements(); e.hasMoreElements(); ) - { - AreaContainer nextElm = (AreaContainer)e.nextElement(); - if (nextElm.getContentHeight() > maxContentHeight) - maxContentHeight = nextElm.getContentHeight(); - } - return maxContentHeight; - } - + + public boolean isBalanced() { + return isBalanced; + } + + public void setIsBalanced() { + this.isBalanced = true; + } + + public int getTotalContentHeight() { + int totalContentHeight = 0; + for (Enumeration e = getChildren().elements(); + e.hasMoreElements(); ) { + totalContentHeight += + ((AreaContainer)e.nextElement()).getContentHeight(); + } + return totalContentHeight; + } + + public int getMaxContentHeight() { + int maxContentHeight = 0; + for (Enumeration e = getChildren().elements(); + e.hasMoreElements(); ) { + AreaContainer nextElm = (AreaContainer)e.nextElement(); + if (nextElm.getContentHeight() > maxContentHeight) + maxContentHeight = nextElm.getContentHeight(); + } + return maxContentHeight; + } + public void setPage(Page page) { - this.page = page; - for (Enumeration e = getChildren().elements(); e.hasMoreElements(); ) - { - ((AreaContainer)e.nextElement()).setPage(page); - } + this.page = page; + for (Enumeration e = getChildren().elements(); + e.hasMoreElements(); ) { + ((AreaContainer)e.nextElement()).setPage(page); + } } - - public boolean isLastColumn() - { - return (currentColumn == columnCount); - } + + public boolean isLastColumn() { + return (currentColumn == columnCount); + } + } |