"[100]3[200,fill]"
or through API (E.g.
* new AC().size("100").gap("3").size("200").fill()
.
*/
-public final class AC implements Externalizable
+public class AC implements Externalizable
{
private final ArrayListthis
so it is possible to chain calls.
+ */
+ public final CC alignX(AlignX align) {
+ return alignX(align == null ? null : align.toString().toLowerCase());
+ }
+
/** The grow priority compared to other components in the same cell.
*
* For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
@@ -501,6 +513,19 @@ public final CC alignY(String align)
return this;
}
+ /**
+ * Strongly typed API for most common usages
+ *
+ * @see #alignY(String)
+ *
+ * @param align
+ * @return this
so it is possible to chain calls.
+ */
+ public final CC alignY(AlignY align)
+ {
+ return alignY(align == null ? null : align.toString().toLowerCase());
+ }
+
/** The grow priority compared to other components in the same cell.
*
* For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
diff --git a/core/src/main/java/net/miginfocom/layout/HideMode.java b/core/src/main/java/net/miginfocom/layout/HideMode.java
new file mode 100644
index 0000000..481d9a3
--- /dev/null
+++ b/core/src/main/java/net/miginfocom/layout/HideMode.java
@@ -0,0 +1,30 @@
+package net.miginfocom.layout;
+
+/**
+ * NORMAL: Bounds will be calculated as if the component was visible.
+ * SIZE_0_RETAIN_GAPS: If hidden the size will be 0, 0 but the gaps remain.
+ * SIZE_0_GAPS_0: If hidden the size will be 0, 0 and gaps set to zero.
+ * DISREGARD: If hidden the component will be disregarded completely and not take up a cell in the grid..
+ */
+public enum HideMode {
+ NORMAL(0), SIZE_0_RETAIN_GAPS(1), SIZE_0_GAPS_0(2), DISREGARD(3);
+
+ private final int code;
+
+ private HideMode(int code) {
+ this.code = code;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ static public HideMode of(int code) {
+ for (HideMode hideMode : values()) {
+ if (hideMode.code == code) {
+ return hideMode;
+ }
+ }
+ throw new IllegalArgumentException("Code does not exist " + code);
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/java/net/miginfocom/layout/LC.java b/core/src/main/java/net/miginfocom/layout/LC.java
index 2c5c24f..6375180 100755
--- a/core/src/main/java/net/miginfocom/layout/LC.java
+++ b/core/src/main/java/net/miginfocom/layout/LC.java
@@ -37,7 +37,7 @@
/** Contains the constraints for an instance of the {@link LC} layout manager.
*/
-public final class LC implements Externalizable
+public class LC implements Externalizable
{
// See the corresponding set/get method for documentation of the property!
@@ -259,7 +259,7 @@ public final int getHideMode()
* 0 == Normal. Bounds will be calculated as if the component was visible.
* 1 == If hidden the size will be 0, 0 but the gaps remain.
* 2 == If hidden the size will be 0, 0 and gaps set to zero.
- * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
+ * 3 == If hidden the component will be disregarded completely and not take up a cell in the grid.
*/
public final void setHideMode(int mode)
{
@@ -269,6 +269,19 @@ public final void setHideMode(int mode)
this.hideMode = mode;
}
+ /**
+ * Strongly typed API for most common usages
+ *
+ * @see #setHideMode(int)
+ *
+ * @param mode
+ * @return this
so it is possible to chain calls.
+ */
+ public final LC hideMode(HideMode mode) {
+ setHideMode(mode.getCode());
+ return this;
+ }
+
/** The insets for the layed out panel. The insets will be an empty space around the components in the panel. null
values
* means that the default panel insets for the platform is used. See {@link PlatformDefaults#setDialogInsets(net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue, net.miginfocom.layout.UnitValue)}.
* @return The insets. Of length 4 (top, left, bottom, right) or null
. The elements (1 to 4) may be null
. The array is a copy and can be used freely.
@@ -821,6 +834,18 @@ public final LC alignX(String align)
return this;
}
+ /**
+ * Strongly typed API for most common usages
+ *
+ * @see #alignX(String)
+ *
+ * @param align
+ * @return this
so it is possible to chain calls.
+ */
+ public final LC alignX(AlignX align) {
+ return alignX(align == null ? null : align.toString().toLowerCase());
+ }
+
/** Same functionality as setAlignY(ConstraintParser.parseUnitValueOrAlign(align, false))
only this method returns this
for chaining multiple calls.
*
* For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
@@ -834,6 +859,19 @@ public final LC alignY(String align)
return this;
}
+ /**
+ * Strongly typed API for most common usages
+ *
+ * @see #alignY(String)
+ *
+ * @param align
+ * @return this
so it is possible to chain calls.
+ */
+ public final LC alignY(AlignY align)
+ {
+ return alignY(align == null ? null : align.toString().toLowerCase());
+ }
+
/** Sets both the alignX and alignY as the same time.
*
* For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.