Class TLcdOverlayLayout
- All Implemented Interfaces:
LayoutManager
,LayoutManager2
Container
panel overlaying a map. For
JavaFX views, see TLcdOverlayPane
.
You can add components to 10 distinct locations, and specify what should happen if multiple components are added to the same location.
To arrange components, use one of the following methods:
- Call the
Container.add(Component, Object)
method. You can pass aTLcdOverlayLayout.Location
as constraints object. The defaultResolveClash
isTLcdOverlayLayout.ResolveClash.HORIZONTAL
. - Call one of the
putConstraint(java.awt.Component, com.luciad.gui.swing.TLcdOverlayLayout.Location, com.luciad.gui.swing.TLcdOverlayLayout.ResolveClash)
methods before adding the component to the container using anContainer#add
method without constraints parameter.
Note: The implementation depends on the preferredSize
of the Component
. When this is not set,
it will use a default Dimension equal to (50, 50). So it's important that
getPreferredSize
returns an appropriate value for any component you wish to add to a container with this
LayoutManager
.
- Since:
- 9.1
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
This enumeration identifies the different locations where components can be placed when added to the container.static enum
This enumeration can be used to indicate how the LayoutManager should handle multiple components added to the same location. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayoutComponent
(Component aComponent, Object aConstraints) void
addLayoutComponent
(String aName, Component aComponent) This implementation simply adds the component to theLocation.NORTH_EAST
.float
getLayoutAlignmentX
(Container aTarget) float
getLayoutAlignmentY
(Container aTarget) void
invalidateLayout
(Container aTarget) void
layoutContainer
(Container aParent) maximumLayoutSize
(Container aTarget) minimumLayoutSize
(Container aParent) preferredLayoutSize
(Container aParent) void
putConstraint
(Component aComponent, TLcdOverlayLayout.Location aLocation, TLcdOverlayLayout.ResolveClash aResolveClash) Specifies the location and clash resolution for the given object.void
putConstraint
(Component aComponent, TLcdOverlayLayout.Location aLocation, TLcdOverlayLayout.ResolveClash aResolveClash, int aXOffset, int aYOffset) Specifies the location, clash resolution, and padding offsets for the given object.void
removeLayoutComponent
(Component aComponent)
-
Constructor Details
-
TLcdOverlayLayout
public TLcdOverlayLayout()Default Constructor forTLcdOverlayLayout
.
-
-
Method Details
-
putConstraint
public void putConstraint(Component aComponent, TLcdOverlayLayout.Location aLocation, TLcdOverlayLayout.ResolveClash aResolveClash) Specifies the location and clash resolution for the given object. A standard horizontal and vertical offset will be used (10 px by default).If you call this method, do it before adding the object to the container, without specifying a constraint.
When resolving a clash at a specific location, the
ResolveClash
of the last component (according the container's child order) at theLocation
is used, .- Parameters:
aComponent
- The component to be constrained.aLocation
- The location of the component.aResolveClash
- TheResolveClash
constraint for the component.- See Also:
-
putConstraint
public void putConstraint(Component aComponent, TLcdOverlayLayout.Location aLocation, TLcdOverlayLayout.ResolveClash aResolveClash, int aXOffset, int aYOffset) Specifies the location, clash resolution, and padding offsets for the given object. The offset parameters specify the distance between a component and his neighbour or the edge of the container.If you call this method, do it before adding the object to the container, without specifying a constraint.
When resolving a clash at a specific location, the
ResolveClash
of the last component (according the container's child order) at theLocation
is used, .- Parameters:
aComponent
- The component to be constrained.aLocation
- The location of the component.aResolveClash
- TheResolveClash
constraint for the component.aXOffset
- The distance in pixels between the component and its left/right (depending on the Location) neighbour or the East/West edge of the container.aYOffset
- The distance in pixels between the component and its upper/lower (depending on the Location) neighbour or the North/South edge of the container.
-
addLayoutComponent
This implementation simply adds the component to theLocation.NORTH_EAST
. Use the methodContainer.add(java.awt.Component, Object)
in order to specify the location.- Specified by:
addLayoutComponent
in interfaceLayoutManager
- Throws:
UnsupportedOperationException
- always- See Also:
-
addLayoutComponent
This method will be called when you add a component to a container using the
Container.add(java.awt.Component, Object)
method. The constraints should be an instance of theTLcdOverlayLayout.Location
Enumeration. If the passed object is null,NORTH_EAST
will be set as the defaultLocation
. If the passed object is not an instance ofLocation
, anIllegalArgumentException
will be thrown. To set other constraints (ResolveClash
, offsets) use the methodsputConstraint(java.awt.Component, com.luciad.gui.swing.TLcdOverlayLayout.Location, com.luciad.gui.swing.TLcdOverlayLayout.ResolveClash)
orputConstraint(java.awt.Component, com.luciad.gui.swing.TLcdOverlayLayout.Location, com.luciad.gui.swing.TLcdOverlayLayout.ResolveClash, int, int)
.- Specified by:
addLayoutComponent
in interfaceLayoutManager2
- Parameters:
aComponent
- The component to be addedaConstraints
- An instance ofTLcdOverlayLayout.Location
that specifies the location of the component.
-
removeLayoutComponent
- Specified by:
removeLayoutComponent
in interfaceLayoutManager
-
maximumLayoutSize
- Specified by:
maximumLayoutSize
in interfaceLayoutManager2
-
getLayoutAlignmentX
- Specified by:
getLayoutAlignmentX
in interfaceLayoutManager2
-
getLayoutAlignmentY
- Specified by:
getLayoutAlignmentY
in interfaceLayoutManager2
-
invalidateLayout
- Specified by:
invalidateLayout
in interfaceLayoutManager2
-
preferredLayoutSize
- Specified by:
preferredLayoutSize
in interfaceLayoutManager
-
minimumLayoutSize
- Specified by:
minimumLayoutSize
in interfaceLayoutManager
-
layoutContainer
- Specified by:
layoutContainer
in interfaceLayoutManager
-