Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UIVerticalFlowLayout

public class UIVerticalFlowLayout extends UILayoutManager
{
  // Fields
  public static final int FILL;
  public static final int MULTICOLUMN;

  // Constructors
  public UIVerticalFlowLayout();
  public UIVerticalFlowLayout(int style);
  public UIVerticalFlowLayout(int style, int gap);

  // Methods
  public Dimension adjustLayoutSize(IUIContainer parent,
        Dimension oldParentSize, IUIComponent comp,
        Dimension oldSize, Dimension newSize);
  public Dimension getMinimumSize(IUIContainer parent);
  public Dimension getMinimumSize(IUIContainer parent,
        Dimension bounds);
  public Dimension getPreferredSize(IUIContainer parent);
  public Dimension getPreferredSize(IUIContainer parent,
        Dimension bounds);
  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 setStyle(int style);
}

This class implements a vertical flow layout manager. UIList uses UIVerticalFlowLayout as its default layout manager. UIVerticalFlowLayout enables components in the list to be laid in one vertical column (the default layout) or in multiple columns (if the MULTICOLUMN layout style is set). UIVerticalFlowLayout also defines the FILL style, which extends the width of each component's selectable area to the width of the component's column. This means the component can be selected, even when the horizontal area outside of its immediate label is clicked.

UILayoutManager
  |
  +--UIVerticalFlowLayout

Constructors

UIVerticalFlowLayout

public UIVerticalFlowLayout();

Creates a vertical flow layout manager.

Remarks:

By default, components will be laid out in one vertical column. If the layout manager's style is set to MULTICOLUMN, a horizontal gap of 15 pixels will be added between columns.

UIVerticalFlowLayout

public UIVerticalFlowLayout(int style);

Creates a vertical flow layout manager with the specified style.

ParameterDescription
style The style of the layout manager. You can pass any bitwise combination of MULTICOLUMN and FILL, or pass 0 for the default style, which is single column with no fill.

Remarks:

Components will be laid out and accessed according to the specified style. If the style is MULTICOLUMN, a horizontal gap of 15 pixels is added between columns.

Exceptions:

IllegalArgumentException if an undefined style was specified.

UIVerticalFlowLayout

public UIVerticalFlowLayout(int style, int gap);

Creates a vertical flow layout manager with the specified style and horizontal gap.

ParameterDescription
style The style of the layout manager. You can pass any bitwise combination of MULTICOLUMN and FILL, or pass 0 for the default style, which is single column with no fill.
gap The horizontal spacing (in pixels) between columns, if the style is MULTICOLUMN.

Remarks:

Components will be laid out and accessed according to the specified style.

Exceptions:

IllegalArgumentException if an undefined style was specified.

Methods

adjustLayoutSize

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.

ParameterDescription
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.

getMinimumSize

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.

ParameterDescription
parent The container of the components.

Remarks:

The width of the returned Dimension object is the largest of the minimum widths of the components, plus the horizontal gaps between each column (if the layout style is MULTICOLUMN). The Dimension object's height is based on the sum of the minimum heights of the components that make up a column.

Overrides:

getMinimumSize(IUIContainer) in UILayoutManager.

See Also: getPreferredSize

getMinimumSize

public Dimension getMinimumSize(IUIContainer parent, Dimension bounds);

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.

ParameterDescription
parent The container of the components.
bounds A Dimension object used to force the minimum size of a component or container.

Remarks:

The width of the returned Dimension object is the largest of the minimum widths of the components, plus the horizontal gaps between each column (if the layout style is MULTICOLUMN). The Dimension object's height is based on the sum of the minimum heights of the components that comprise a column. Components do not always return the correct minimum size when their parent or containers have been resized (in particular, edit controls that handle word wrapping). The Dimension passed forces the layout manager to adjust appropriately in these cases.

See Also: getPreferredSize

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.

ParameterDescription
parent The container of the components.

Remarks:

The width of the returned Dimension object is the largest of the preferred widths of the components, plus the horizontal gaps between each column (if the layout style is MULTICOLUMN). The Dimension object's height is based on the sum of the preferred heights of the components that make up a column.

Overrides:

getPreferredSize(IUIContainer) in UILayoutManager.

See Also: getMinimumSize

getPreferredSize

public Dimension getPreferredSize(IUIContainer parent, Dimension bounds);

Determines the preferred dimensions (in pixels) for laying out the components in the specified container, using a specified Dimension to force the sizing of components in special cases.

Return Value:

Returns a Dimension object containing the preferred layout size.

ParameterDescription
parent The container of the components.
bounds A Dimension object used to force the preferred size of a component or container.

Remarks:

Components do not always return the correct preferred size when their parent or containers have been resized (in particular, edit controls that handle word wrapping). The Dimension passed forces the layout manager to adjust appropriately in these cases.

Overrides:

getPreferredSize(IUIContainer,Dimension) in UILayoutManager.

See Also: getMinimumSize, com.ms.ui.IUIComponent.getPreferredSize

isHeightRelative

public boolean isHeightRelative();

Determines if this layout manager uses the height of the container to lay out its children; false otherwise.

Return Value:

Returns true if in multicolumn, false otherwise. Returning false also means that the container's layout method doesn't need to be called on a horizontal re-sizing.

Overrides:

isHeightRelative() in UILayoutManager.

See Also: isWidthRelative

isOverlapping

public boolean isOverlapping();

This method simply returns false by default indicating that the UIVerticalFlow component lays out its children such that they never overlap.

Return Value:

Returns false.

Overrides:

isOverlapping() in UILayoutManager.

isWidthRelative

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; false otherwise. (The default is true.) Returning false also means that the container's layout method doesn't need to be called on a vertical resizing

Overrides:

isWidthRelative() in UILayoutManager.

See Also: isHeightRelative

layout

public void layout(IUIContainer parent, Rectangle bounds);

Lays out the components in the specified container.

Return Value:

No return value.

ParameterDescription
parent The container being laid out.
bounds The bounding rectangle in which to lay out the components.

Remarks:

Depending on the layout manager's style, the components are laid out in either one vertical column or in multiple columns, based on their preferred widths and heights. If the style is MULTICOLUMN, the horizontal gap (defined when the layout manager was created) is used for spacing between each column.

If the FILL style is set, layout extends the width of each component's selectable area to the width of the component's column.

Overrides:

layout(IUIContainer,Rectangle) in UILayoutManager.

navigate

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.

ParameterDescription
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 handles keyboard navigation in the container. For example, when an item in a UIList object has focus and a key is pressed, navigate is called to move focus to another item in the list. The following table shows the keys that have corresponding IUIAccessible directions.

Key IUIAccessible direction
UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW NAVDIR_UP, NAVDIR_DOWN, NAVDIR_LEFT, and NAVDIR_RIGHT, respectively
HOME and END NAVDIR_FIRST and NAVDIR_LAST, respectively

Overrides:

navigate(IUIContainer,IUIComponent,int,boolean) in UILayoutManager.

setStyle

public void setStyle(int style);

Sets the style of the layout manager.

Return Value:

No return value.

ParameterDescription
style The style of the layout manager. You can pass any bitwise combination of MULTICOLUMN and FILL, or pass 0 for the default style, which is single column with no fill.

Exceptions:

IllegalArgumentException if an undefined style was specified.

Fields

FILL
Extends the width of each component's selectable area to the width of the component's column.
MULTICOLUMN
Specifies that components will be laid out in multiple columns, as needed. The horizontal gap (defined when the layout manager was created) is used for spacing between columns.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.