Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class UISplitLayout

Constructors , Methods , Fields

public class UISplitLayout extends UILayoutManager
{
  // Fields
  public final static int HORIZONTAL;

  // Constructors
  public UISplitLayout();
  public UISplitLayout(int flags);
  public UISplitLayout(int flags, int pos);

  // Methods
  public Component getComponent(String name);
  public int getPos();
  public void setPos(int pos);

  public void addLayoutComponent(String name, Component comp);
  public void removeLayoutComponent(Component comp);

  public void layoutContainer(Container target);
  public Dimension minimumLayoutSize(Container target);
  public Dimension preferredLayoutSize(Container target);

  public Component navigate(Container cont, Component comp, 
                            int dir, boolean keyable);
}

A class that implements a split layout manager; used by UISplitViewer to manage a split viewer control. UISplitLayout defines the following three layout components.

Layout Name Description
NW Identifies the component in the North pane if the split is horizontal or the West pane if the split is vertical.
SE Identifies the component in the South pane if the split is horizontal or the East pane if the split is vertical.
Splitter The splitter component positioned between the NW and SE panes.

UISplitLayout manages the split position for the split viewer. 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 with 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. Note that the split position cannot be less than -100.


Constructors


UISplitLayout

public UISplitLayout();

Creates a split layout manager.

Remarks:

By default, the layout manager uses a vertical split with an initial split position of -50. For more information about split positions, see the UISplitLayout overview.


UISplitLayout

public UISplitLayout(int flags);

Creates a split layout manager with the specified layout flags.

ParameterDescription
flags The style flags for the layout. Specify HORIZONTAL for a horizontal split, or 0 for a vertical split.

Remarks:

By default, the initial split position is defined to be -50. If any undefined flags are specified, an IllegalArgumentException is thrown.

For more information about split positions, see the UISplitLayout overview.


UISplitLayout

public UISplitLayout(int flags, int pos);

Creates a split layout manager with the specified layout flags and split position.

ParameterDescription
flags Specify HORIZONTAL for a horizontal split, or 0 for a vertical split.
pos The initial split position. A negative value 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.

Remarks:

If any undefined flags are specified, or if the split position is less than -100, an IllegalArgumentException is thrown.


Methods


addLayoutComponent

public void addLayoutComponent(String name, Component comp);

Adds or replaces the specified layout component with the given component.

Return Value:

No return value.

ParameterDescription
name The layout name identifying the component to be added or replaced. Specify "NW" for the component in the North or West pane, "SE" for the component in the South or East pane, or "Splitter" for the splitter control between the panes.
comp The new component to use.

Remarks:

Note that the name parameter is not case-sensitive. If an undefined name is specified, an IllegalArgumentException is thrown.


getComponent

public Component getComponent(String name);

Retrieves the component that is identified by name.

Return Value:

Returns the specified component.

ParameterDescription
name The layout name identifying the component to be retrieved. Specify "NW" for the component in the North or West pane, "SE" for the component in the South or East pane, or "Splitter" for the splitter control between the panes.

Remarks:

Note that the name parameter is not case-sensitive. If an undefined name is specified, an IllegalArgumentException is thrown.


getPos

public int getPos();

Retrieves the current split position.

Return Value:

Returns the split position used by the split layout manager.

Remarks:

For more information about split positions, see the UISplitLayout overview.


layoutContainer

public void layoutContainer(Container target);

Lays out the components in the specified container.

Return Value:

No return value.

ParameterDescription
target The container of the components being laid out.


minimumLayoutSize

public Dimension minimumLayoutSize(Container target);

Determines the minimum dimensions (in pixels) needed to lay out the components in the specified container.

Return Value:

Returns a Dimension object containing the minimum size.

ParameterDescription
target The container of the components to be laid out.

Remarks:

The minimum layout size is determined from the minimum size of each component in the container.


navigate

public Component navigate(Container cont, Component comp, int dir, 
                          boolean keyable);

Navigates to another component from the specified component in the given direction.

Return Value:

Always returns null, indicating no component can be navigated to.

ParameterDescription
cont The container where the navigation is occurring.
comp The component to navigate from.
dir The direction to navigate.
keyable If true, non-keyable components will be ignored during the navigation; otherwise, all components can be navigated to.


preferredLayoutSize

public Dimension preferredLayoutSize(Container target);

Determines the preferred dimensions (in pixels) for laying out the components in the specified container.

Return Value:

Returns a Dimension object containing the preferred size.

ParameterDescription
target The container of the components to be laid out.

Remarks:

The preferred layout size is determined from the preferred size of each component in the container.


removeLayoutComponent

public void removeLayoutComponent(Component comp);

Removes the specified component.

Return Value:

No return value.

ParameterDescription
comp The component to be removed.


setPos

public void setPos(int pos);

Sets the current split position.

ParameterDescription
pos The new split position. For more information, see the UISplitLayout overview.

Remarks:

This method invalidates both layout panes. If the split position is less than -100, an IllegalArgumentException is thrown.


Fields

HORIZONTAL
Specifies that the split layout manager will create a horizontal split, where the container consists of North and South panes. The default style is a vertical split with West and East panes.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.