mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
updated hgap to horizontalGap and vgap to verticalGap
This commit is contained in:
parent
f1e2bd67f0
commit
9a423825ad
@ -54,21 +54,19 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
* subcomponents as well as the spacing between subcomponents and the
|
||||
* borders of the target component.
|
||||
*
|
||||
* @serial
|
||||
* @see #getHgap()
|
||||
* @see #setHgap(int)
|
||||
* @see #getHorizontalGap()
|
||||
* @see #setHorizontalGap(int)
|
||||
*/
|
||||
private int hgap = 0;
|
||||
private int horizontalGap = 0;
|
||||
|
||||
/**
|
||||
* The vertical gap between neighboring rows as well as the spacing between
|
||||
* rows and the borders of the target component.
|
||||
*
|
||||
* @serial
|
||||
* @see #getVgap()
|
||||
* @see #setVgap(int)
|
||||
* @see #getVerticalGap()
|
||||
* @see #setVerticalGap(int)
|
||||
*/
|
||||
private int vgap = 0;
|
||||
private int verticalGap = 0;
|
||||
|
||||
/**
|
||||
* If true, subcomponents will be aligned on their bottom edge. Otherwise,
|
||||
@ -94,15 +92,16 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
/**
|
||||
* Constructs a new <code>WrapLayout</code>.
|
||||
*
|
||||
* @param vgap The vertical gap spacing between rows of subcomponents as
|
||||
* well as the spacing between the target component and rows.
|
||||
* @param hgap The horizontal gap spacing between neighboring subcomponents
|
||||
* as well as the spacing between the subcomponents and the
|
||||
* target component's border.
|
||||
* @param verticalGap The vertical gap spacing between rows of
|
||||
* subcomponents as well as the spacing between the
|
||||
* target component and rows.
|
||||
* @param horizontalGap The horizontal gap spacing between neighboring
|
||||
* subcomponents as well as the spacing between the
|
||||
* subcomponents and the target component's border.
|
||||
*/
|
||||
public WrapLayout(int vgap, int hgap) {
|
||||
this.vgap = vgap;
|
||||
this.hgap = hgap;
|
||||
public WrapLayout(int verticalGap, int horizontalGap) {
|
||||
this.verticalGap = verticalGap;
|
||||
this.horizontalGap = horizontalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,19 +136,20 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
* @return The horizontal gap between components and between the components
|
||||
* and the borders of the <code>Container</code>.
|
||||
*/
|
||||
public int getHgap() {
|
||||
return hgap;
|
||||
public int getHorizontalGap() {
|
||||
return horizontalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal gap between neighboring subcomponents as well as the
|
||||
* spacing between subcomponents and the borders of the target component.
|
||||
*
|
||||
* @param hgap The horizontal gap between components and between the
|
||||
* components and the borders of the <code>Container</code>.
|
||||
* @param horizontalGap The horizontal gap between components and between
|
||||
* the components and the borders of the
|
||||
* <code>Container</code>.
|
||||
*/
|
||||
public void setHgap(int hgap) {
|
||||
this.hgap = hgap;
|
||||
public void setHorizontalGap(int horizontalGap) {
|
||||
this.horizontalGap = horizontalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,19 +159,20 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
* @return The vertical gap between components and between the components
|
||||
* and the borders of the <code>Container</code>.
|
||||
*/
|
||||
public int getVgap() {
|
||||
return vgap;
|
||||
public int getVerticalGap() {
|
||||
return verticalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vertical gap between neighboring rows as well as the spacing
|
||||
* between rows and the borders of the target component.
|
||||
*
|
||||
* @param vgap The vertical gap between components and between the
|
||||
* components and the borders of the <code>Container</code>.
|
||||
* @param verticalGap The vertical gap between components and between the
|
||||
* components and the borders of the
|
||||
* <code>Container</code>.
|
||||
*/
|
||||
public void setVgap(int vgap) {
|
||||
this.vgap = vgap;
|
||||
public void setVerticalGap(int verticalGap) {
|
||||
this.verticalGap = verticalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,9 +297,9 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
boolean ltr = target.getComponentOrientation().isLeftToRight();
|
||||
boolean useBaseline = getAlignOnBaseline();
|
||||
|
||||
int rowY = targetDims.getInsets().top + getVgap();
|
||||
int leftX = targetDims.getInsets().left + getHgap();
|
||||
int rightX = targetDims.getOuterWidth() - targetDims.getInsets().right - getHgap();
|
||||
int rowY = targetDims.getInsets().top + getVerticalGap();
|
||||
int leftX = targetDims.getInsets().left + getHorizontalGap();
|
||||
int rightX = targetDims.getOuterWidth() - targetDims.getInsets().right - getHorizontalGap();
|
||||
|
||||
for (WrapLayoutRow row : rows) {
|
||||
int rowHeight = row.getHeight();
|
||||
@ -306,7 +307,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
int curX = 0;
|
||||
if (row.getComponents() != null) {
|
||||
for (Component origComp : row.getComponents()) {
|
||||
curX += setComponentDims(origComp, useBaseline, ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap();
|
||||
curX += setComponentDims(origComp, useBaseline, ltr, rowY, rowHeight, leftX, rightX, curX) + getHorizontalGap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,11 +316,11 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
// reverse opposite aligned for layout purposes since flipping ltr
|
||||
Collections.reverse(row.getOppositeAligned());
|
||||
for (Component oppAlignedComp : row.getOppositeAligned()) {
|
||||
curX += setComponentDims(oppAlignedComp, useBaseline, !ltr, rowY, rowHeight, leftX, rightX, curX) + getHgap();
|
||||
curX += setComponentDims(oppAlignedComp, useBaseline, !ltr, rowY, rowHeight, leftX, rightX, curX) + getHorizontalGap();
|
||||
}
|
||||
}
|
||||
|
||||
rowY += rowHeight + getVgap();
|
||||
rowY += rowHeight + getVerticalGap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +332,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container target) {
|
||||
Dimension minimum = layoutSize(target, false);
|
||||
minimum.width -= (getHgap() + 1);
|
||||
minimum.width -= (getHorizontalGap() + 1);
|
||||
return minimum;
|
||||
}
|
||||
|
||||
@ -408,7 +409,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
}
|
||||
|
||||
Insets insets = container.getInsets();
|
||||
int horizontalInsetsAndGap = insets.left + insets.right + (getHgap() * 2);
|
||||
int horizontalInsetsAndGap = insets.left + insets.right + (getHorizontalGap() * 2);
|
||||
int maxWidth = targetWidth - horizontalInsetsAndGap;
|
||||
|
||||
return new ParentDimensions(targetWidth, maxWidth, insets);
|
||||
@ -431,13 +432,13 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
Integer containerHeight = rows.stream().map((r) -> r.getHeight()).reduce(0, Integer::sum);
|
||||
// add in vertical gap between rows
|
||||
if (rows.size() > 1) {
|
||||
containerHeight += (rows.size() - 1) * getVgap();
|
||||
containerHeight += (rows.size() - 1) * getVerticalGap();
|
||||
}
|
||||
|
||||
containerHeight += targetDims.getInsets().top + targetDims.getInsets().bottom;
|
||||
|
||||
Integer containerWidth = rows.stream().map((r) -> r.getWidth()).reduce(0, Math::max);
|
||||
containerWidth += targetDims.getInsets().left + targetDims.getInsets().right + (getHgap() * 2);
|
||||
containerWidth += targetDims.getInsets().left + targetDims.getInsets().right + (getHorizontalGap() * 2);
|
||||
|
||||
// When using a scroll pane or the DecoratedLookAndFeel we need to
|
||||
// make sure the preferred size is less than the size of the
|
||||
@ -446,7 +447,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
|
||||
|
||||
if (scrollPane != null && target.isValid()) {
|
||||
containerWidth -= (getHgap() + 1);
|
||||
containerWidth -= (getHorizontalGap() + 1);
|
||||
}
|
||||
|
||||
return new Dimension(containerWidth, containerHeight);
|
||||
@ -572,7 +573,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
WrapLayoutRow lastOrig = originalRowSet.get(originalRowSet.size() - 1);
|
||||
WrapLayoutRow firstOpp = oppositeRowSet.get(0);
|
||||
|
||||
int proposedRowWidth = lastOrig.getWidth() + firstOpp.getWidth() + getHgap();
|
||||
int proposedRowWidth = lastOrig.getWidth() + firstOpp.getWidth() + getHorizontalGap();
|
||||
if (proposedRowWidth <= maxWidth) {
|
||||
WrapLayoutRow middleRow = new WrapLayoutRow(lastOrig.getComponents(), firstOpp.getOppositeAligned(),
|
||||
Math.max(lastOrig.getHeight(), firstOpp.getHeight()), proposedRowWidth);
|
||||
@ -623,7 +624,7 @@ public class WrapLayout implements LayoutManager, java.io.Serializable {
|
||||
|
||||
// Add a horizontal gap for all components after the first
|
||||
if (rowWidth != 0) {
|
||||
rowWidth += getHgap();
|
||||
rowWidth += getHorizontalGap();
|
||||
}
|
||||
|
||||
rowComponents.add(m);
|
||||
|
Loading…
x
Reference in New Issue
Block a user