Class UISplitLayout
public class UISplitLayout extends UILayoutManager
{
// Fields
public static final int HORIZONTAL;
// Constructors
public UISplitLayout();
public UISplitLayout(int flags);
public UISplitLayout(int flags, int pos);
// Methods
public void addLayoutComponent(IUIContainer parent,
IUIComponent comp, Object constraints);
public Dimension adjustLayoutSize(IUIContainer parent,
Dimension oldParentSize, IUIComponent comp,
Dimension oldSize, Dimension newSize);
public IUIComponent getComponent(IUIContainer parent,
Object constraints);
public Dimension getMinimumSize(IUIContainer target);
public int getPos();
public Dimension getPreferredSize(IUIContainer target);
public boolean isOverlapping();
public void layout(IUIContainer target, Rectangle bounds);
public IUIComponent navigate(IUIContainer cont,
IUIComponent comp, int dir, boolean keyable);
public void removeLayoutComponent(IUIContainer target,
IUIComponent comp);
public void setPos(int pos);
}
This class implements a layout manager for a split viewer control. UISplitViewer uses UISplitLayout for its default layout manager. UISplitLayout creates either a vertical split (the default) or a horizontal split, and manages the following layout components.
Component
|
Description
|
"nw"
|
The component in the top (north) pane if the split is horizontal, or the left (west) pane if the split is vertical.
|
"se"
|
The component in the bottom (south) pane if the split is horizontal, or the right (east) pane if the split is vertical.
|
Use "0" for a vertical split, HORIZONTAL for a horizontal split.
|
The component that divides the two panes.
|
UISplitLayout manages the split position for the split viewer control. A negative split position means the height or width of the "nw" component is a percentage of the split viewer's total height or width. A positive split position specifies the height or width as an absolute value, in pixels. You can initially set the split position in the constructor (the default value is -50), as shown in the following example.
// Specify a horizontal split and a split position of 150.
// This means the "nw" component will be 150 pixels in height.
// The remainder of the split viewer's content area will be
// filled with the splitter component and the "se" component.
UISplitLayout sl = new UISplitLayout(UISplitLayout.HORIZONTAL, 150);
UISplitLayout also defines the getPos and setPos methods to retrieve and set the split position. The split position cannot be less than -100.
UILayoutManager
|
+--UISplitLayout
public UISplitLayout();
Creates a split layout manager.
Remarks:
By default, the layout manager uses a vertical split and an initial split position of -50. For more information about split positions, see the UISplitLayout overview.
public UISplitLayout(int flags);
Creates a split layout manager with the specified style flags.
Parameter | Description |
flags
| The style of the layout manager. Possible values include HORIZONTAL for a horizontal split, or 0 for a vertical split.
|
Remarks:
By default, the initial split position is -50. For more information about split positions, see the UISplitLayout overview.
Exceptions:
IllegalArgumentException
if an undefined style was specified.
public UISplitLayout(int flags, int pos);
Creates a split layout manager with the specified style flags and split position.
Parameter | Description |
flags
| The style of the layout manager. Possible values include HORIZONTAL for a horizontal split, or 0 for a vertical split.
|
pos
| The initial split position. A negative split position means the height or width of the "nw" component is a percentage of the split viewer's total height or width. A positive split position specifies the height or width as an absolute value in pixels. For more information, see the UISplitLayout overview.
|
Exceptions:
IllegalArgumentException
if an undefined style was specified or the split position was less than -100.
public void addLayoutComponent(IUIContainer parent, IUIComponent comp,
Object constraints);
Adds the specified component to the container, according to the specified constraints.
Return Value:
No return value.
Parameter | Description |
parent
| The container of the component.
|
comp
| The component to be added.
|
constraints
| Identifies where the component will be added. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
This method is called by the container's add method. The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Location of the component
|
"nw"
|
0
|
The top (north) or left (west) pane of the container.
|
"se"
|
1
|
The bottom (south) or right (east) pane of the container.
|
"splitter"
|
2
|
Between the two panes.
|
Note The String values are not case-sensitive.
Overrides:
addLayoutComponent(IUIContainer,IUIComponent,Object) in UILayoutManager.
Exceptions:
IllegalArgumentException
if an undefined constraint was specified.
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.
|
Overrides:
adjustLayoutSize(IUIContainer,Dimension,IUIComponent,Dimension,Dimension) in UILayoutManager.
public IUIComponent getComponent(IUIContainer parent, Object constraints);
Retrieves a component from the container, according to the specified constraints.
Return Value:
Returns the specified component, if found; otherwise, returns null.
Parameter | Description |
parent
| The container of the component.
|
constraints
| Identifies the component to be retrieved. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"nw"
|
0
|
The component in the top (north) or left (west) pane.
|
"se"
|
1
|
The component in the bottom (south) or right (east) pane.
|
"splitter"
|
2
|
The component that divides the two panes.
|
Note The String values are not case-sensitive.
Overrides:
getComponent(IUIContainer,Object) in UILayoutManager.
Exceptions:
IllegalArgumentException
if an undefined constraint was specified.
See Also: addLayoutComponent, removeLayoutComponent
public Dimension getMinimumSize(IUIContainer target);
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 |
target
| The container of the components.
|
Remarks:
If the layout manager has a horizontal split, the height of the returned Dimension object is the sum of the minimum heights of the "nw", "se", and splitter components. The Dimension object's width is the largest of the minimum widths of each component.
Similarly, if the layout manager's split is vertical, the Dimension object's width is the sum of the minimum widths of the components. The height is the largest of the minimum heights of each component.
Overrides:
getMinimumSize(IUIContainer) in UILayoutManager.
See Also: getPreferredSize
public int getPos();
Retrieves the current split position.
Return Value:
Returns the split position used by the layout manager.
Remarks:
For more information about split positions, see the UISplitLayout overview.
See Also: setPos
public Dimension getPreferredSize(IUIContainer target);
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 |
target
| The container of the components.
|
Remarks:
If the layout manager has a horizontal split, the height of the returned Dimension object is the sum of the preferred heights of the "nw", "se", and splitter components. The Dimension object's width is the largest of the preferred widths of each component.
Similarly, if the layout manager's split is vertical, the Dimension object's width is the sum of the preferred widths of the components. The height is the largest of the preferred heights of each component.
Overrides:
getPreferredSize(IUIContainer) in UILayoutManager.
See Also: getMinimumSize
public boolean isOverlapping();
This method simply returns false, indicating that the UISplitLayout lays out its components such that they never overlap.
Return Value:
Returns false.
Overrides:
isOverlapping() in UILayoutManager.
public void layout(IUIContainer target, Rectangle bounds);
Lays out the components in the specified container.
Return Value:
No return value.
Parameter | Description |
target
| The container of the components being laid out.
|
bounds
| The bounding rectangle in which to lay out the components
|
Remarks:
If the layout manager has a horizontal split, the splitter component's width is the bounding rectangle width, and the height is 4 pixels. The location of the splitter component depends on the layout manager's current split position. The "nw" and "se" components lie above and below the splitter component, respectively.
Similarly, if the layout manager's split is vertical, the splitter component's height is the bounding rectangle height, and the width is 4 pixels. The "nw" and "se" components lie to the left and to the right, respectively, of the splitter component.
Overrides:
layout(IUIContainer,Rectangle) in UILayoutManager.
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 null, indicating no component can be navigated to.
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:
Typically, this method is used to handle keyboard navigation in the container. However, UISplitLayout does not provide this functionality.
Overrides:
navigate(IUIContainer,IUIComponent,int,boolean) in UILayoutManager.
public void removeLayoutComponent(IUIContainer target, IUIComponent comp);
Removes the specified component from the container.
Return Value:
No return value.
Parameter | Description |
target
| The container of the component.
|
comp
| The component to be removed.
|
Remarks:
This method is called by the container's remove method.
Overrides:
removeLayoutComponent(IUIContainer,IUIComponent) in UILayoutManager.
See Also: addLayoutComponent, getComponent
public void setPos(int pos);
Sets the current split position.
Return Value:
No return value.
Parameter | Description |
pos
| The split position to be used by the layout manager. For more information, see the UISplitLayout overview.
|
Exceptions:
IllegalArgumentException
if the split position was less than -100.
See Also: getPos
- HORIZONTAL
- A horizontal layout style. The split layout manager creates a horizontal split, where the container consists of top (north) and bottom (south) panes. The default style is a vertical split with left (west) and right (east) panes.