aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-12-18 02:54:51 +0100
committerSven Gothel <[email protected]>2023-12-18 02:54:51 +0100
commitad8471401f7ca004df823f7f7436c2cbc4676195 (patch)
treedac6fad824e35e59599632e014b8677e58e11fd0 /src/graphui/classes/com
parent47061b4528953eea0632f04082013bf38f0fe863 (diff)
GraphUI Padding, Margin, Gap: Use zero value constant None instead of default ctor
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/GraphShape.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java12
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java8
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java8
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java8
6 files changed, 21 insertions, 21 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
index 856a0fe3c..b05c2bf11 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
@@ -257,7 +257,7 @@ public abstract class GraphShape extends Shape {
static protected void addRectangle(final Region region, final float sharpness, final AABBox box, final Padding padding, final float borderThickness, final Vec4f color) {
final OutlineShape shape = new OutlineShape();
- final Padding p = null != padding ? padding : new Padding();
+ final Padding p = null != padding ? padding : Padding.None;
final float x1 = box.getMinX() - p.left;
final float x2 = box.getMaxX() + p.right;
final float y1 = box.getMinY() - p.bottom;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
index f100554d5..d8e670fab 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
@@ -62,7 +62,7 @@ public class BoxLayout implements Group.Layout {
/**
*/
public BoxLayout() {
- this(0f, 0f, Alignment.None, new Margin(), null);
+ this(0f, 0f, Alignment.None, Margin.None, null);
}
/**
@@ -70,11 +70,11 @@ public class BoxLayout implements Group.Layout {
* @param padding {@link Padding} applied to each {@Shape} via {@link Shape#setPaddding(Padding)} and is scaled if {@link Alignment.Bit#Fill}
*/
public BoxLayout(final Padding padding) {
- this(0f, 0f, Alignment.None, new Margin(), padding);
+ this(0f, 0f, Alignment.None, Margin.None, padding);
}
public BoxLayout(final float cellWidth, final float cellHeight) {
- this(cellWidth, cellHeight, Alignment.None, new Margin(), null);
+ this(cellWidth, cellHeight, Alignment.None, Margin.None, null);
}
/**
@@ -84,7 +84,7 @@ public class BoxLayout implements Group.Layout {
* @param alignment
*/
public BoxLayout(final float cellWidth, final float cellHeight, final Alignment alignment) {
- this(cellWidth, cellHeight, alignment, new Margin(), null);
+ this(cellWidth, cellHeight, alignment, Margin.None, null);
}
/**
@@ -104,7 +104,7 @@ public class BoxLayout implements Group.Layout {
* @param padding {@link Padding} applied to each {@Shape} via {@link Shape#setPaddding(Padding)} and is scaled if {@link Alignment.Bit#Fill}
*/
public BoxLayout(final float cellWidth, final float cellHeight, final Padding padding) {
- this(cellWidth, cellHeight, Alignment.None, new Margin(), padding);
+ this(cellWidth, cellHeight, Alignment.None, Margin.None, padding);
}
/**
@@ -136,7 +136,7 @@ public class BoxLayout implements Group.Layout {
* @param padding {@link Padding} applied to each {@Shape} via {@link Shape#setPaddding(Padding)} and is scaled if {@link Alignment.Bit#Fill}
*/
public BoxLayout(final float cellWidth, final float cellHeight, final Alignment alignment, final Padding padding) {
- this(cellWidth, cellHeight, alignment, new Margin(), padding);
+ this(cellWidth, cellHeight, alignment, Margin.None, padding);
}
/**
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
index b29245ef0..9d832092d 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Gap.java
@@ -36,15 +36,15 @@ import com.jogamp.math.FloatUtil;
* </p>
*/
public class Gap {
+ /** Zero gap constant. */
+ public static final Gap None = new Gap();
+
/** Row gap value, vertical spacing. */
public final float row;
/** Column gap value, horizontal spacing. */
public final float column;
- /**
- * Ctor w/ zero values
- */
- public Gap() {
+ private Gap() {
row = 0f; column = 0f;
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
index 8175a8daf..b89529420 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java
@@ -80,7 +80,7 @@ public class GridLayout implements Group.Layout {
* @param alignment TODO
*/
public GridLayout(final int column_limit, final float cellWidth, final float cellHeight, final Alignment alignment) {
- this(alignment, Math.max(1, column_limit), -1, cellWidth, cellHeight, new Gap(), null);
+ this(alignment, Math.max(1, column_limit), -1, cellWidth, cellHeight, Gap.None, null);
}
/**
@@ -116,7 +116,7 @@ public class GridLayout implements Group.Layout {
* @param row_limit [1..inf)
*/
public GridLayout(final float cellWidth, final float cellHeight, final Alignment alignment, final int row_limit) {
- this(alignment, -1, Math.max(1, row_limit), cellWidth, cellHeight, new Gap(), null);
+ this(alignment, -1, Math.max(1, row_limit), cellWidth, cellHeight, Gap.None, null);
}
/**
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
index 629d3bb7b..9deca99ef 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Margin.java
@@ -39,6 +39,9 @@ import com.jogamp.math.FloatUtil;
* </p>
*/
public class Margin {
+ /** Zero margin constant. */
+ public static final Margin None = new Margin();
+
/** Top value */
public final float top;
/** Right value */
@@ -48,10 +51,7 @@ public class Margin {
/** Left value */
public final float left;
- /**
- * Ctor w/ zero values
- */
- public Margin() {
+ private Margin() {
this(0f);
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java b/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
index f686e8498..6aec0e398 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/Padding.java
@@ -36,6 +36,9 @@ import com.jogamp.math.FloatUtil;
* </p>
*/
public class Padding {
+ /** Zero padding constant. */
+ public static final Padding None = new Padding();
+
/** Top value */
public final float top;
/** Right value */
@@ -45,10 +48,7 @@ public class Padding {
/** Left value */
public final float left;
- /**
- * Ctor w/ zero values
- */
- public Padding() {
+ private Padding() {
this(0f);
}