Class UILayoutManager
public abstract class UILayoutManager implements
IUILayoutManager
{
// Methods
public void addLayoutComponent(IUIContainer cont,
IUIComponent comp, Object constraints);
public Dimension adjustLayoutSize(IUIContainer parent,
Dimension oldParentSize, IUIComponent comp,
Dimension oldSize, Dimension newSize);
public boolean continueInvalidate(IUIContainer cont, IUIComponent
comp);
public IUIComponent getComponent(IUIContainer cont, int index);
public IUIComponent getComponent(IUIContainer cont,
Object constraints);
public int getComponentIndex(IUIContainer cont,
IUIComponent comp);
public int getHgap();
public Dimension getMinimumSize(IUIContainer parent);
public Dimension getPreferredSize(IUIContainer parent);
public Dimension getPreferredSize(IUIContainer parent,
Dimension size);
public int getVgap();
public boolean isHeightRelative();
public boolean isOverlapping();
public boolean isWidthRelative();
public void layout(IUIContainer parent, Rectangle bounds);
public IUIComponent navigate(IUIContainer cont,
IUIComponent comp, int dir, boolean keyable);
public void paintContainer(IUIContainer parent, FxGraphics g);
public void removeLayoutComponent(IUIContainer cont, IUIComponent
comp);
public void setHgap(int g);
public void setVgap(int g);
}
This class implements an abstract layout manager with default keyboard handling. UILayoutManager implements the IUILayoutManager interface.
The following diagram shows the classes that extend UILayoutManager.
UILayoutManager
|
+--UIBarLayout
|
+--UIBorderLayout
|
+--UIFixedFlowLayout
|
+--UIFlowLayout
|
+--UIGridLayout
|
+--UIRowLayout
|
+--UISplitLayout
|
+--UITabLayout
|
+--UITabListLayout
|
+--UIThreePanelLayout
|
+--UITreeLayout
|
+--UIVerticalFlowLayout
public void addLayoutComponent(IUIContainer cont, IUIComponent comp, Object
constraints);
Adds the specified component to the container, according to the specified constraints.
Return Value:
No return value.
Remarks:
This method implements addLayoutComponent in the IUILayoutManager interface, and by default, does nothing. UISplitLayout and UIBorderLayout override this method.
See Also: getComponent, removeLayoutComponent
public Dimension adjustLayoutSize(IUIContainer parent,
Dimension oldParentSize, IUIComponent comp, Dimension oldSize,
Dimension newSize);
Called to adjust the layout size of the specified component in the specified container.
Return Value:
Returns a Dimension object containing the new preferred size of the container.
Parameter | Description |
parent
| The container of the component.
|
oldParentSize
| The previous layout size of the container.
|
comp
| The component being sized.
|
oldSize
| The previous layout size of the component.
|
newSize
| The new layout size of the component.
|
Remarks:
This method implements adjustLayoutSize in the IUILayoutManager interface.
public boolean continueInvalidate(IUIContainer cont, IUIComponent comp);
Currently not implemented.
public IUIComponent getComponent(IUIContainer cont, int index);
Retrieves the component at the specified index.
Return Value:
Returns the specified component, if found; otherwise, returns null.
Parameter | Description |
cont
| The container of the component.
|
index
| The zero-based index of the component to retrieve.
|
Remarks:
This method implements getComponent in the IUILayoutManager interface.
public IUIComponent getComponent(IUIContainer cont, Object constraints);
Retrieves a component from the container, according to the specified constraints.
Return Value:
Returns null, indicating the specified component was not retrieved.
Parameter | Description |
cont
| The container of the component.
|
constraints
| Identifies the component to be retrieved. For more information about layout constraints, see UISplitLayout.getComponent.
|
Remarks:
This method implements getComponent in the IUILayoutManager interface, and by default, simply returns null. UISplitLayout overrides this method.
See Also: addLayoutComponent, removeLayoutComponent
public int getComponentIndex(IUIContainer cont, IUIComponent comp);
Retrieves the layout index of the specified component from the specified container.
Return Value:
Returns the layout index of the component; returns -1 if the component is not in the container.
Parameter | Description |
cont
| The container of the component.
|
comp
| The component whose layout index is being requested.
|
public int getHgap();
Retrieves the horizontal spacing, in pixels, between components when laid out by the layout manager.
Return Value:
Returns the horizontal gap between components.
See Also: setHgap
public Dimension getMinimumSize(IUIContainer parent);
Determines the minimum dimensions (in pixels) needed to lay out the child components in the specified container.
Return Value:
Returns a Dimension object containing the minimum layout size.
Parameter | Description |
parent
| The container of the components.
|
Remarks:
This method implements getMinimumSize in the IUILayoutManager interface, and by default, returns a height and width of 0.
See Also: getPreferredSize
public Dimension getPreferredSize(IUIContainer parent);
Determines the preferred dimensions (in pixels) for laying out the child components in the specified container.
Return Value:
Returns a Dimension object containing the preferred layout size.
Parameter | Description |
parent
| The container of the components.
|
Remarks:
This method implements getPreferredSize in the IUILayoutManager interface, and by default, returns a height and width of 0.
See Also: getMinimumSize
public Dimension getPreferredSize(IUIContainer parent, Dimension size);
Determines the preferred dimensions (in pixels) for laying out the child components in the specified container, given the specified size.
Return Value:
Returns a Dimension object containing the preferred layout size.
Parameter | Description |
parent
| The container of the components.
|
size
| The size of the container
|
Remarks:
This method implements getPreferredSize in the IUILayoutManager interface, and by default, returns a height and width of 0 pixels.
See Also: getMinimumSize
public int getVgap();
Retrieves the vertical spacing, in pixels, between components when laid out by the layout manager.
Return Value:
Returns the vertical gap between components.
See Also: setVgap
public boolean isHeightRelative();
Determines if this layout manager uses the height of the container to lay out its children.
Return Value:
Returns true if this layout manager uses the container's height to lay out the children; otherwise, returns false. (The default is true.) Returning false also means that the container's layout method doesn't need to be called on a horizontal resizing.
See Also: isWidthRelative
public boolean isOverlapping();
Determines if this layout manager lays out its children so they overlap either completely or partially.
Return Value:
Returns true if the children overlap; otherwise, returns false. (The default is true.) Returning false also means that only the sibling floater window, if one exists, needs to be clipped by the manager.
public boolean isWidthRelative();
Determines if this layout manager uses the width of the container to lay out its children.
Return Value:
Returns true if this layout manager uses the container's width to lay out the children; otherwise, returns false. (The default is true.) Returning false also means that the container's layout method doesn't need to be called on a vertical resizing.
See Also: isHeightRelative
public void layout(IUIContainer parent, Rectangle bounds);
Lays out the components in the specified container.
Return Value:
No return value.
Parameter | Description |
parent
| The container being laid out.
|
bounds
| The bounding rectangle in which to lay out the components.
|
Remarks:
This method implements layout in the IUILayoutManager interface, and by default, does nothing.
public IUIComponent navigate(IUIContainer cont, IUIComponent comp, int dir,
boolean keyable);
Navigates from the specified component to another component in the specified direction.
Return Value:
Returns the component navigated to (if a component in the specified direction exists); otherwise, returns null.
Parameter | Description |
cont
| The container where the navigation is occurring.
|
comp
| The component to navigate from.
|
dir
| The navigation direction. Specify one of the NAVDIR values defined in the IUIAccessible interface.
|
keyable
| If true, only components that are able to receive keyboard input can be navigated to; otherwise, all components can be navigated to.
|
Remarks:
This method implements navigate in the IUILayoutManager interface, and handles keyboard navigation in the container. When a component in the container has focus and a key is pressed, navigate is called to move focus to another item in the container. The following table shows the keys that have corresponding IUIAccessible directions.
Exceptions:
IllegalArgumentException
if an undefined navigation direction was specified.
public void paintContainer(IUIContainer parent, FxGraphics g);
Draws the container.
Return Value:
No return value.
Parameter | Description |
parent
| The container.
|
g
| The graphics context of the container.
|
Remarks:
This method implements paintContainer in the IUILayoutManager interface, and by default, does nothing. UITreeLayout overrides this method.
public void removeLayoutComponent(IUIContainer cont, IUIComponent comp);
Removes the specified component from the container.
Return Value:
No return value.
Parameter | Description |
cont
| The container of the component.
|
comp
| The component to be removed.
|
Remarks:
This method implements removeLayoutComponent in the IUILayoutManager interface, and by default, does nothing. UIBarLayout, UIBorderLayout, and UISplitLayout override this method.
See Also: addLayoutComponent, getComponent
public void setHgap(int g);
Sets the horizontal spacing between the components that are laid out by the layout manager.
Note Not all layout managers use both Hgap and Vgap settings. For example, in UITreeLayout, Hgap is ignored when components are laid out.
Return Value:
No return value.
Parameter | Description |
g
| The horizontal gap between components (in pixels).
|
See Also: getHgap
public void setVgap(int g);
Sets the horizontal spacing between the components that are laid out by the layout manager.
Note Not all layout managers use both Hgap and Vgap settings. For example, in UITreeLayout, Hgap is ignored when components are laid out.
Return Value:
No return value.
Parameter | Description |
g
| The vertical gap between components (in pixels).
|
See Also: getVgap