- All Implemented Interfaces:
LayoutManager
,LayoutManager2
,Externalizable
,Serializable
Read the documentation that came with this layout manager for information on usage.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContainerWrapper
private ArrayList
<LayoutCallback> private final Map
<ComponentWrapper, CC> private Object
Hold the serializable text representation of the constraints.private AC
private Timer
private boolean
private Grid
private int
private Dimension
private int
private Dimension
private long
private boolean
private Object
Hold the serializable text representation of the constraints.private LC
private Object
Hold the serializable text representation of the constraints.private AC
The component to string constraints mappings. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no constraints.Constructor.Constructor.Constructor.Constructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayoutCallback
(LayoutCallback callback) Adds the callback function that will be called at different stages of the layout cycle.void
addLayoutComponent
(Component comp, Object constraints) void
addLayoutComponent
(String s, Component comp) private void
adjustWindowSize
(ContainerWrapper parent) Checks the parent window/popup if its size is within parameters as set by the LC.private void
checkCache
(Container parent) Check if something has changed and if so recreate it to the cached objects.private ContainerWrapper
checkParent
(Container parent) private void
cleanConstraintMaps
(Container parent) Checks so all components in ccMap actually exist in the parent's collection.private int
constrain
(ContainerWrapper parent, int winSize, int prefSize, BoundSize constrain) static <E> E
Returns the column layout constraints either as aString
orAC
.Returns the component constraints as a String representation.Returns a shallow copy of the constraints map.private boolean
getDebug()
Returns the current debugging state.private int
Returns the debug millis.float
getLayoutAlignmentX
(Container parent) float
getLayoutAlignmentY
(Container parent) Returns layout constraints either as aString
orLC
depending what was sent in to the constructor or set withsetLayoutConstraints(Object)
.private Container
getPackable
(Component comp) Returns a high level window or popup to pack, if any.Returns the row layout constraints either as aString
orAC
.private Dimension
getSizeImpl
(Container parent, int sizeType) void
invalidateLayout
(Container target) boolean
Returns if this layout manager is currently managing this component.void
layoutContainer
(Container parent) maximumLayoutSize
(Container parent) minimumLayoutSize
(Container parent) preferredLayoutSize
(Container parent) void
private Object
void
removeLayoutCallback
(LayoutCallback callback) Removes the callback if it exists.void
private void
resetLastInvalidOnParent
(Container parent) void
setColumnConstraints
(Object constr) Sets the column layout constraints for the layout manager instance as a String.void
setComponentConstraints
(Component comp, Object constr) Sets the component constraint for the component that already must be handled by this layout manager.private void
setComponentConstraintsImpl
(Component comp, Object constr, boolean noCheck) Sets the component constraint for the component that already must be handled by this layout manager.void
setConstraintMap
(Map<Component, Object> map) Sets the constraints map.private void
setDebug
(ComponentWrapper parentW, boolean b) Sets the debugging state for this layout manager instance.void
setLayoutConstraints
(Object constr) Sets the layout constraints for the layout manager instance as a String.void
setRowConstraints
(Object constr) Sets the row layout constraints for the layout manager instance as a String.void
-
Field Details
-
scrConstrMap
The component to string constraints mappings. -
layoutConstraints
Hold the serializable text representation of the constraints. -
colConstraints
Hold the serializable text representation of the constraints. -
rowConstraints
Hold the serializable text representation of the constraints. -
cacheParentW
-
ccMap
-
debugTimer
-
lc
-
colSpecs
-
rowSpecs
-
grid
-
lastModCount
private transient int lastModCount -
lastHash
private transient int lastHash -
lastInvalidSize
-
lastWasInvalid
private transient boolean lastWasInvalid -
lastParentSize
-
callbackList
-
dirty
private transient boolean dirty -
lastSize
private long lastSize
-
-
Constructor Details
-
MigLayout
public MigLayout()Constructor with no constraints. -
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as "".colConstraints
- The constraints for the columns in the grid.null
will be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as "".colConstraints
- The constraints for the columns in the grid.null
will be treated as "".rowConstraints
- The constraints for the rows in the grid.null
will be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as an empty constraint.
-
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as an empty constraint.colConstraints
- The constraints for the columns in the grid.null
will be treated as an empty constraint.
-
MigLayout
Constructor.- Parameters:
layoutConstraints
- The constraints that concern the whole layout.null
will be treated as an empty constraint.colConstraints
- The constraints for the columns in the grid.null
will be treated as an empty constraint.rowConstraints
- The constraints for the rows in the grid.null
will be treated as an empty constraint.
-
-
Method Details
-
getLayoutConstraints
Returns layout constraints either as aString
orLC
depending what was sent in to the constructor or set withsetLayoutConstraints(Object)
.- Returns:
- The layout constraints either as a
String
orLC
depending what was sent in to the constructor or set withsetLayoutConstraints(Object)
. Nevernull
.
-
setLayoutConstraints
Sets the layout constraints for the layout manager instance as a String.See the class JavaDocs for information on how this string is formatted.
- Parameters:
constr
- The layout constraints as a String orLC
representation.null
is converted to""
for storage.- Throws:
RuntimeException
- if the constraint was not valid.
-
getColumnConstraints
Returns the column layout constraints either as aString
orAC
.- Returns:
- The column constraints either as a
String
orAC
depending what was sent in to the constructor or set withsetColumnConstraints(Object)
. Nevernull
.
-
setColumnConstraints
Sets the column layout constraints for the layout manager instance as a String.See the class JavaDocs for information on how this string is formatted.
- Parameters:
constr
- The column layout constraints as a String orAC
representation.null
is converted to""
for storage.- Throws:
RuntimeException
- if the constraint was not valid.
-
getRowConstraints
Returns the row layout constraints either as aString
orAC
.- Returns:
- The row constraints either as a
String
orAC
depending what was sent in to the constructor or set withsetRowConstraints(Object)
. Nevernull
.
-
setRowConstraints
Sets the row layout constraints for the layout manager instance as a String.See the class JavaDocs for information on how this string is formatted.
- Parameters:
constr
- The row layout constraints as a String orAC
representation.null
is converted to""
for storage.- Throws:
RuntimeException
- if the constraint was not valid.
-
getConstraintMap
Returns a shallow copy of the constraints map.- Returns:
- A shallow copy of the constraints map. Never
null
.
-
setConstraintMap
Sets the constraints map.- Parameters:
map
- The map. Will be copied.
-
getComponentConstraints
Returns the component constraints as a String representation. This string is the exact string as set withsetComponentConstraints(java.awt.Component, Object)
or set when adding the component to the parent component.See the class JavaDocs for information on how this string is formatted.
- Parameters:
comp
- The component to return the constraints for.- Returns:
- The component constraints as a String representation or
null
if the component is not registered with this layout manager. The returned values is either a String or aCC
depending on what constraint was sent in when the component was added. May benull
.
-
setComponentConstraints
Sets the component constraint for the component that already must be handled by this layout manager.See the class JavaDocs for information on how this string is formatted.
- Parameters:
comp
- The component to set the constraints for.constr
- The component constraints as a String orCC
.null
is ok.- Throws:
RuntimeException
- if the constraint was not valid.IllegalArgumentException
- If the component is not handling the component.
-
setComponentConstraintsImpl
Sets the component constraint for the component that already must be handled by this layout manager.See the class JavaDocs for information on how this string is formatted.
- Parameters:
comp
- The component to set the constraints for.constr
- The component constraints as a String orCC
.null
is ok.noCheck
- Does not check if the component is handled if true- Throws:
RuntimeException
- if the constraint was not valid.IllegalArgumentException
- If the component is not handling the component.
-
isManagingComponent
Returns if this layout manager is currently managing this component.- Parameters:
c
- The component to check. Ifnull
thenfalse
will be returned.- Returns:
- If this layout manager is currently managing this component.
-
addLayoutCallback
Adds the callback function that will be called at different stages of the layout cycle.- Parameters:
callback
- The callback. Notnull
.
-
removeLayoutCallback
Removes the callback if it exists.- Parameters:
callback
- The callback. May benull
.
-
setDebug
Sets the debugging state for this layout manager instance. If debug is turned on a timer will repaint the last laid out parent with debug information on top.Red fill and dashed red outline is used to indicate occupied cells in the grid. Blue dashed outline indicate component bounds set.
Note that debug can also be set on the layout constraints. There it will be persisted. The value set here will not. See the class JavaDocs for information.
- Parameters:
parentW
- The parent to set debug for.b
-true
means debug is turned on.
-
getDebug
private boolean getDebug()Returns the current debugging state.- Returns:
- The current debugging state.
-
getDebugMillis
private int getDebugMillis()Returns the debug millis. Combines the value fromLC.getDebugMillis()
andLayoutUtil.getGlobalDebugMillis()
- Returns:
- The combined value.
-
checkCache
Check if something has changed and if so recreate it to the cached objects.- Parameters:
parent
- The parent that is the target for this layout manager.
-
cleanConstraintMaps
Checks so all components in ccMap actually exist in the parent's collection. Removes any references that don't.- Parameters:
parent
- The parent to compare ccMap against. Never null.
-
resetLastInvalidOnParent
- Since:
- 3.7.3
-
checkParent
-
layoutContainer
- Specified by:
layoutContainer
in interfaceLayoutManager
-
adjustWindowSize
Checks the parent window/popup if its size is within parameters as set by the LC.- Parameters:
parent
- The parent who's window to possibly adjust the size for.
-
getPackable
Returns a high level window or popup to pack, if any.- Returns:
- May be null.
-
findType
-
constrain
-
minimumLayoutSize
- Specified by:
minimumLayoutSize
in interfaceLayoutManager
-
preferredLayoutSize
- Specified by:
preferredLayoutSize
in interfaceLayoutManager
-
maximumLayoutSize
- Specified by:
maximumLayoutSize
in interfaceLayoutManager2
-
getSizeImpl
-
getLayoutAlignmentX
- Specified by:
getLayoutAlignmentX
in interfaceLayoutManager2
-
getLayoutAlignmentY
- Specified by:
getLayoutAlignmentY
in interfaceLayoutManager2
-
addLayoutComponent
- Specified by:
addLayoutComponent
in interfaceLayoutManager
-
addLayoutComponent
- Specified by:
addLayoutComponent
in interfaceLayoutManager2
-
removeLayoutComponent
- Specified by:
removeLayoutComponent
in interfaceLayoutManager
-
invalidateLayout
- Specified by:
invalidateLayout
in interfaceLayoutManager2
-
readResolve
- Throws:
ObjectStreamException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-