-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package net.miginfocom.layout; | ||
|
||
public enum AlignX { | ||
LEADING, LEFT, CENTER, RIGHT, TRAILING; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package net.miginfocom.layout; | ||
|
||
public enum AlignY { | ||
TOP, CENTER, BOTTOM, BASELINE; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
|
||
/** A simple value holder for one component's constraint. | ||
*/ | ||
public final class CC implements Externalizable | ||
public class CC implements Externalizable | ||
{ | ||
private static final BoundSize DEF_GAP = BoundSize.NULL_SIZE; // Only used to denote default wrap/newline gap. | ||
|
||
|
@@ -229,6 +229,18 @@ public final CC alignX(String align) | |
return this; | ||
} | ||
|
||
/** | ||
* Strongly typed API for most common usages | ||
* | ||
* @see #alignX(String) | ||
* | ||
* @param align | ||
* @return <code>this</code> so it is possible to chain calls. | ||
*/ | ||
public final CC alignX(AlignX align) { | ||
return alignX(align == null ? null : align.toString().toLowerCase()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tbee
Author
Collaborator
|
||
} | ||
|
||
/** The grow priority compared to other components in the same cell. | ||
* <p> | ||
* 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 <code>this</code> 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. | ||
* <p> | ||
* For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.miginfocom.layout; | ||
|
||
/** | ||
* NORMAL: Bounds will be calculated as if the component was visible.<br> | ||
* SIZE_0_RETAIN_GAPS: If hidden the size will be 0, 0 but the gaps remain.<br> | ||
* SIZE_0_GAPS_0: If hidden the size will be 0, 0 and gaps set to zero.<br> | ||
* 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); | ||
} | ||
} |
Use
toLowerCase(Locale.ROOT)
to avoid surprising behaviour in tr_TR locale