Packages
 In this topic

*Methods

 

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

 


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

Methods

addLayoutComponent

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.

ParameterDescription
cont The container of the component.
comp The component to be added.
constraints Identifies where the component will be added. For more information about layout constraints, see UISplitLayout.addLayoutComponent or UIBorderLayout.addLayoutComponent.

Remarks:

This method implements addLayoutComponent in the IUILayoutManager interface, and by default, does nothing. UISplitLayout and UIBorderLayout override this method.

See Also: getComponent, removeLayoutComponent

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.

Remarks:

This method implements adjustLayoutSize in the IUILayoutManager interface.

continueInvalidate

public boolean continueInvalidate(IUIContainer cont, IUIComponent comp);

Currently not implemented.

getComponent

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.

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

getComponent

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.

ParameterDescription
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

getComponentIndex

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.

ParameterDescription
cont The container of the component.
comp The component whose layout index is being requested.

getHgap

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

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:

This method implements getMinimumSize in the IUILayoutManager interface, and by default, returns a height and width of 0.

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:

This method implements getPreferredSize in the IUILayoutManager interface, and by default, returns a height and width of 0.

See Also: getMinimumSize

getPreferredSize

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.

ParameterDescription
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

getVgap

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

isHeightRelative

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

isOverlapping

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.

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; 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

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:

This method implements layout in the IUILayoutManager interface, and by default, does nothing.

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

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.

Exceptions:

IllegalArgumentException if an undefined navigation direction was specified.

paintContainer

public void paintContainer(IUIContainer parent, FxGraphics g);

Draws the container.

Return Value:

No return value.

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

removeLayoutComponent

public void removeLayoutComponent(IUIContainer cont, IUIComponent comp);

Removes the specified component from the container.

Return Value:

No return value.

ParameterDescription
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

setHgap

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.

ParameterDescription
g The horizontal gap between components (in pixels).

See Also: getHgap

setVgap

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.

ParameterDescription
g The vertical gap between components (in pixels).

See Also: getVgap

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