for (int j = 0; j < cells[i].length; j++) {
Cell cell = cells[i][j];
if (cell != null) {
- int effectivePadding;
+ int reservedMargin;
if (cell.rowspan + j >= cells[i].length) {
// Make room for layout padding for cells reaching the
// bottom of the layout
- effectivePadding = paddingBottom;
+ reservedMargin = paddingBottom;
} else {
- effectivePadding = 0;
+ reservedMargin = 0;
}
- cell.layoutVertically(y, effectivePadding);
+ cell.layoutVertically(y, reservedMargin);
}
y += rowHeights[j] + verticalSpacing;
}
for (int j = 0; j < cells[i].length; j++) {
Cell cell = cells[i][j];
if (cell != null) {
- int effectivePadding;
+ int reservedMargin;
// Make room for layout padding for cells reaching the
// right edge of the layout
if (i + cell.colspan >= cells.length) {
- effectivePadding = paddingRight;
+ reservedMargin = paddingRight;
} else {
- effectivePadding = 0;
+ reservedMargin = 0;
}
- cell.layoutHorizontally(x, effectivePadding);
+ cell.layoutHorizontally(x, reservedMargin);
}
}
x += columnWidths[i] + horizontalSpacing;
return height;
}
- public void layoutHorizontally(int x, int paddingRight) {
+ public void layoutHorizontally(int x, int marginRight) {
if (slot != null) {
- slot.positionHorizontally(x, getAvailableWidth(), paddingRight);
+ slot.positionHorizontally(x, getAvailableWidth(), marginRight);
}
}
- public void layoutVertically(int y, int paddingBottom) {
+ public void layoutVertically(int y, int marginBottom) {
if (slot != null) {
- slot.positionVertically(y, getAvailableHeight(), paddingBottom);
+ slot.positionVertically(y, getAvailableHeight(), marginBottom);
}
}
}
public void positionHorizontally(double currentLocation,
- double allocatedSpace, double paddingRight) {
+ double allocatedSpace, double marginRight) {
Style style = wrapper.getStyle();
double availableWidth = allocatedSpace;
boolean captionAboveCompnent;
if (caption == null) {
captionAboveCompnent = false;
+ style.clearPaddingRight();
} else {
captionAboveCompnent = !caption.shouldBePlacedAfterComponent();
if (!captionAboveCompnent) {
availableWidth -= captionWidth;
captionStyle.clearLeft();
- captionStyle.setRight(paddingRight, Unit.PX);
- paddingRight += captionWidth;
+ captionStyle.setRight(0, Unit.PX);
+ style.setPaddingRight(captionWidth, Unit.PX);
} else {
captionStyle.setLeft(0, Unit.PX);
captionStyle.clearRight();
+ style.clearPaddingRight();
}
}
- if (paddingRight > 0) {
- style.setPaddingRight(paddingRight, Unit.PX);
+ if (marginRight > 0) {
+ style.setMarginRight(marginRight, Unit.PX);
} else {
- style.clearPaddingRight();
+ style.clearMarginRight();
}
if (isRelativeWidth()) {
}
public void positionVertically(double currentLocation,
- double allocatedSpace, double paddingBottom) {
+ double allocatedSpace, double marginBottom) {
Style style = wrapper.getStyle();
double contentHeight = allocatedSpace;
style.setPaddingTop(captionHeight, Unit.PX);
}
- if (paddingBottom > 0) {
- style.setPaddingBottom(paddingBottom, Unit.PX);
+ if (marginBottom > 0) {
+ style.setMarginBottom(marginBottom, Unit.PX);
} else {
- style.clearPaddingBottom();
+ style.clearMarginBottom();
}
if (isRelativeHeight()) {
}
public void positionInDirection(double currentLocation,
- double allocatedSpace, double endingPadding, boolean isVertical) {
+ double allocatedSpace, double endingMargin, boolean isVertical) {
if (isVertical) {
- positionVertically(currentLocation, allocatedSpace, endingPadding);
+ positionVertically(currentLocation, allocatedSpace, endingMargin);
} else {
- positionHorizontally(currentLocation, allocatedSpace, endingPadding);
+ positionHorizontally(currentLocation, allocatedSpace, endingMargin);
}
}