Packages
 In this topic

*Methods

 

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

 


Interface IUIContainer

public interface IUIContainer extends IUIComponent
{
  // Methods
  public IUIComponent add(IUIComponent comp);
  public IUIComponent add(IUIComponent comp, int index);
  public IUIComponent add(IUIComponent comp, Object constraints);
  public IUIComponent add(IUIComponent comp, Object constraints,
        int index);
  public IUIComponent add(String name, IUIComponent comp);
  public void addContainerListener(IUIContainerListener l);
  public void addFocusListener(IUIFocusListener l);
  public void addKeyListener(IUIKeyListener l);
  public void addMouseListener(IUIMouseListener l);
  public void addMouseMotionListener(IUIMouseMotionListener l);
  public void adjustLayoutSize(IUIComponent comp,
        Dimension oldSize, Dimension newSize);
  public boolean continueInvalidate(IUIComponent comp);
  public boolean ensureVisible(int index);
  public IUIComponent getChild(int index);
  public Rectangle getChildBounds(IUIComponent child);
  public Rectangle getChildBounds(int index);
  public int getChildCount();
  public int getChildIndex(IUIComponent comp);
  public Point getChildLocation(IUIComponent child);
  public Point getChildLocation(int index);
  public Dimension getChildSize(IUIComponent child);
  public Dimension getChildSize(int index);
  public Rectangle getClientRect();
  public IUIComponent getComponent(int index);
  public IUIComponent getComponent(IUIComponent comp);
  public int getComponentCount();
  public IUIComponent getComponentFromID(int id);
  public int getComponentIndex(IUIComponent comp);
  public IUIComponent[] getComponents();
  public int getEdge();
  public IUIComponent getFloater();
  public IUIComponent getFocusComponent();
  public IUIComponent getHeader();
  public Insets getInsets();
  public IUILayoutManager getLayout();
  public boolean isOverlapping();
  public boolean move(IUIComponent comp, IUIComponent before);
  public boolean move(int from, int to);
  public IUIComponent navigate(IUIComponent comp, int direction,
        boolean keyable);
  public void paintComponents(FxGraphics g);
  public IUIComponent passFocus(int dir);
  public void remove(int index);
  public void remove(IUIComponent comp);
  public void removeAll();
  public void removeAllChildren();
  public void removeContainerListener(IUIContainerListener l);
  public void removeFocusListener(IUIFocusListener l);
  public void removeKeyListener(IUIKeyListener l);
  public void removeMouseListener(IUIMouseListener l);
  public void removeMouseMotionListener(IUIMouseMotionListener l);
  public IUIComponent replace(IUIComponent comp, IUIComponent old);
  public IUIComponent replace(IUIComponent comp, int index);
  public IUIComponent replace(IUIComponent comp,
        Object constraints, IUIComponent old);
  public IUIComponent replace(IUIComponent comp,
        Object constraints, int index);
  public IUIComponent replace(IUIComponent comp,
        Object constraints);
  public void setChildBounds(IUIComponent child, int x, int y,
        int width, int height);
  public void setChildBounds(IUIComponent child, Rectangle rect);
  public void setChildBounds(int index, int x, int y, int width,
        int height);
  public void setChildBounds(int index, Rectangle rect);
  public void setChildLocation(IUIComponent child, int x, int y);
  public void setChildLocation(IUIComponent child, Point point);
  public void setChildLocation(int index, int x, int y);
  public void setChildLocation(int index, Point point);
  public void setChildSize(IUIComponent child, int width,
        int height);
  public void setChildSize(IUIComponent child, Dimension size);
  public void setChildSize(int index, int width, int height);
  public void setChildSize(int index, Dimension size);
  public void setComponent(int index, IUIComponent comp);
  public void setEdge(int edge);
  public void setHeader(IUIComponent header);
  public void setLayout(IUILayoutManager lm);
}

This interface defines methods associated with a container class. For example, IUIContainer specifies how to add, remove, and retrieve components from a container. UIContainer implements this interface.

Containers in AFC hold either a single header component or multiple child components with an optional header. Header components represent the container itself; for example, the text displayed on a button is used as its header component.

IUIContainer extends IUIComponent.

IUIComponent
  |
  +--IUIContainer

Methods

add

public IUIComponent add(IUIComponent comp);

Adds the specified component to the end of the container.

Return Value:

Returns the component that was added, if successful; otherwise, returns null.

ParameterDescription
comp The component to be added.

add

public IUIComponent add(IUIComponent comp, int index);

Adds the specified component to the container at the specified index.

Return Value:

Returns the component that was added, if successful; otherwise, returns null.

ParameterDescription
comp The component to be added.
index The zero-based index at which to insert the component.

add

public IUIComponent add(IUIComponent comp, Object constraints);

Adds the specified component to the container, according to the specified constraints.

Return Value:

Returns the component that was added, if successful; otherwise, returns null.

ParameterDescription
comp The component to be added.
constraints The layout constraints, which depend on the current layout manager.

add

public IUIComponent add(IUIComponent comp, Object constraints, int index);

Adds the specified component to the container, according to the specified constraints and index.

Return Value:

Returns the component that was added, if successful; otherwise, returns null.

ParameterDescription
comp The component to be added.
constraints The layout constraints, which depend on the current layout manager.
index The zero-based index at which to insert the component.

add

public IUIComponent add(String name, IUIComponent comp);

Note This method is replaced by add(IUIComponent comp, Object constraints).

addContainerListener

public void addContainerListener(IUIContainerListener l);

Adds the specified container listener. The listener receives all container events generated for the container.

Return Value:

No return value.

ParameterDescription
l The container listener to be added.

addFocusListener

public void addFocusListener(IUIFocusListener l);

Adds the specified focus listener. The listener receives all focus events generated for the container.

Return Value:

No return value.

ParameterDescription
l The focus listener to be added.

Overrides:

addFocusListener(IUIFocusListener) in IUIComponent.

addKeyListener

public void addKeyListener(IUIKeyListener l);

Adds the specified key listener. The listener receives all key events generated for the container.

Return Value:

No return value.

ParameterDescription
l The key listener to be added.

Overrides:

addKeyListener(IUIKeyListener) in IUIComponent.

addMouseListener

public void addMouseListener(IUIMouseListener l);

Adds the specified mouse listener. The listener receives all mouse events generated for the container.

Return Value:

No return value.

ParameterDescription
l The mouse listener to be added.

Overrides:

addMouseListener(IUIMouseListener) in IUIComponent.

addMouseMotionListener

public void addMouseMotionListener(IUIMouseMotionListener l);

Adds the specified mouse motion listener. The listener receives all mouse motion events generated for the container.

Return Value:

No return value.

ParameterDescription
l The mouse motion listener to be added.

Overrides:

addMouseMotionListener(IUIMouseMotionListener) in IUIComponent.

adjustLayoutSize

public void adjustLayoutSize(IUIComponent comp, Dimension oldSize,
        Dimension newSize);

Adjusts the layout size of the specified component.

Return Value:

No return value.

ParameterDescription
comp The component being sized.
oldSize The previous layout size of the component (in pixels).
newSize The new layout size of the component (in pixels).

Remarks:

This method is automatically invoked when the specified component's size has changed.

continueInvalidate

public boolean continueInvalidate(IUIComponent comp);

Determines whether the container should be invalidated when the specified child component is invalidated.

Return Value:

Returns true if the container should be invalidated; otherwise, returns false.

ParameterDescription
comp The component being invalidated.

ensureVisible

public boolean ensureVisible(int index);

Brings the component at the specified index into view.

Return Value:

Returns true if any window was moved or resized to make the specified component visible; otherwise, returns false.

ParameterDescription
index The zero-based index of the child component to be made visible in the container.

getChild

public IUIComponent getChild(int index);

Retrieves the child component at the specified index. This method cannot retrieve the header component.

Return Value:

Returns the specified component, if found; otherwise, returns null.

ParameterDescription
index The zero-based index of the component to be retrieved.

getChildBounds

public Rectangle getChildBounds(IUIComponent child);

Retrieves the bounding rectangle of the specified component.

Return Value:

Returns a Rectangle object identifying the component's bounding area, if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the container's header component or any child component.

getChildBounds

public Rectangle getChildBounds(int index);

Retrieves the bounding rectangle of the component at the specified index.

Return Value:

Returns a Rectangle object identifying the component's bounding area, if successful; otherwise, returns null.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.

getChildCount

public int getChildCount();

Retrieves the number of child components in the container, excluding the header component.

Return Value:

Returns the number of child components.

getChildIndex

public int getChildIndex(IUIComponent comp);

Retrieves the index of the specified child component.

Return Value:

Returns the zero-based index of the component (if the component belongs to the container); otherwise, returns null.

ParameterDescription
comp The component to retrieve the index for. This component must be a child component and not the header component.

getChildLocation

public Point getChildLocation(IUIComponent child);

Retrieves the location of the specified component.

Return Value:

Returns a Point object containing the upper-left corner of the component, if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the container's header component or any child component.

getChildLocation

public Point getChildLocation(int index);

Retrieves the location of the component at the specified index.

Return Value:

Returns a Point object containing the upper-left corner of the component, if successful; otherwise, returns null.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0 and the first child component begins at index 1; otherwise, the first child begins at index 0.

getChildSize

public Dimension getChildSize(IUIComponent child);

Retrieves the size of the specified component.

Return Value:

Returns a Dimension object containing the component's dimensions (in pixels), if successful; otherwise, returns null.

ParameterDescription
child The component. Specify either the container's header component or any child component.

getChildSize

public Dimension getChildSize(int index);

Retrieves the size of the component at the specified index.

Return Value:

Returns a Dimension object containing the component's dimensions (in pixels).

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.

getClientRect

public Rectangle getClientRect();

Retrieves the client rectangle of the container.

Return Value:

Returns the bounding rectangle of the container's client area, measured in terms of the container's coordinate space.

Remarks:

The client rectangle is the area that remains after the container's bounding rectangle is reduced by the size of its insets.

getComponent

public IUIComponent getComponent(int index);

Retrieves the component located at the specified index. The header component or any child component can be retrieved.

Return Value:

Returns the specified component, if found; otherwise, returns null.

ParameterDescription
index The zero-based index of the component to be retrieved. If the container has a header component, the header is at index 0 and the first child component begins at index 1; otherwise, the first child begins at index 0.

getComponent

public IUIComponent getComponent(IUIComponent comp);

Retrieves the component in the container that is the ancestor of the specified component. The header component or any child component can be retrieved.

Return Value:

Returns the container's immediate child or header component that is the ancestor of the specified component. If the specified component is itself an immediate child (or header) of the container, this component is returned. If the container is not an ancestor of the specified component, null is returned.

ParameterDescription
comp The component to find the ancestor for.

getComponentCount

public int getComponentCount();

Retrieves the number of components in the container, including the header component.

Return Value:

Returns the total number of components.

getComponentFromID

public IUIComponent getComponentFromID(int id);

Retrieves the component with the specified identifier.

Return Value:

Returns null, indicating no component was found with the specified identifier.

ParameterDescription
id The id of the component to be retrieved.

See Also: setID

getComponentIndex

public int getComponentIndex(IUIComponent comp);

Retrieves the index of the specified component.

Return Value:

Returns the zero-based index of the component (if the component belongs to the container); otherwise, returns null.

ParameterDescription
comp The component to retrieve the index for. This component can be the header component or any child component.

getComponents

public IUIComponent[] getComponents();

Retrieves all components in the container.

Return Value:

Returns an array of the container's components.

getEdge

public int getEdge();

Retrieves the style of the container's edge.

Return Value:

Returns an integer that specifies the current style settings.

getFloater

public IUIComponent getFloater();

Retrieves the floating component in this container, if one exists.

Return Value:

Returns the current floating component, or null if there is no component.

Remarks:

The floating component is the component which is superceding the standard z-order of the container's children by being first in the z-order. This is most commonly used when a component is being dragged, like a column header or a scroll thumb.

getFocusComponent

public IUIComponent getFocusComponent();

Retrieves the component of the container that currently has input focus.

Return Value:

Returns the component that either has focus itself or is the ancestor of the component that has focus. If no descendant of the container currently has focus, null is returned.

Remarks:

The returned component is either a direct child of the container or the header component. For example, suppose the container has a child component that is itself a container, and a component within this child container has focus. As a result,getFocusComponent returns the child container.

getHeader

public IUIComponent getHeader();

Retrieves the container's header component.

Return Value:

Returns the current header component (if the container has a header); otherwise, returns null.

getInsets

public Insets getInsets();

Retrieves the container's insets (in pixels), which identify the nonclient area of the container.

Return Value:

Returns an Insets object containing the container's insets.

getLayout

public IUILayoutManager getLayout();

Retrieves the layout manager of the container.

Return Value:

Returns the current layout manager (if the container has a layout manager); otherwise, returns null.

isOverlapping

public boolean isOverlapping();

Determines if this layout manager lays out its children so that they overlap either completely or partially; false otherwise.

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.

move

public boolean move(IUIComponent comp, IUIComponent before);

Moves the component specified in comp in front of the component specified in before. t

Return Value:

Returns true if the component was moved successfully; otherwise, returns false.

ParameterDescription
comp The component to move.
before The component to move comp in front of. If null, comp is placed at the end of the container.

move

public boolean move(int from, int to);

Moves a component in the container, according to the specified indices.

Return Value:

Returns true if the component was moved successfully; otherwise, returns false.

ParameterDescription
from The zero-based index of the component to move.
to The zero-based index of the position to move the component before. If -1, the component is placed at the end of the container.

navigate

public IUIComponent navigate(IUIComponent comp, int direction,
        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
comp The component to navigate from.
direction 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.

paintComponents

public void paintComponents(FxGraphics g);

Draws all the components in the container.

Return Value:

No return value.

ParameterDescription
g The graphics context.

passFocus

public IUIComponent passFocus(int dir);

Retrieves the component that should receive input focus when navigating to the container in the specified direction.

Return Value:

Returns the component or the container itself, that should receive input focus.

ParameterDescription
dir The navigation direction. Specify one of the NAVDIR values defined in the IUIAccessible interface.

remove

public void remove(int index);

Removes the component at the specified index from the container.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component to be removed.

remove

public void remove(IUIComponent comp);

Removes the specified component from the container.

Return Value:

No return value.

ParameterDescription
comp The component to be removed.

removeAll

public void removeAll();

Removes all components from the container, including the header component.

Return Value:

No return value.

removeAllChildren

public void removeAllChildren();

Removes all child components from the container. The header component is not removed.

Return Value:

No return value.

removeContainerListener

public void removeContainerListener(IUIContainerListener l);

Removes the specified container listener. The listener no longer receives the container's container events.

Return Value:

No return value.

ParameterDescription
l The container listener to be removed.

removeFocusListener

public void removeFocusListener(IUIFocusListener l);

Removes the specified focus listener. The listener no longer receives the container's focus events.

Return Value:

No return value.

ParameterDescription
l The focus listener to be removed.

Overrides:

removeFocusListener(IUIFocusListener) in IUIComponent.

removeKeyListener

public void removeKeyListener(IUIKeyListener l);

Removes the specified key listener. The listener no longer receives the container's key events.

Return Value:

No return value.

ParameterDescription
l The key listener to be removed.

Overrides:

removeKeyListener(IUIKeyListener) in IUIComponent.

removeMouseListener

public void removeMouseListener(IUIMouseListener l);

Removes the specified mouse listener. The listener no longer receives the container's mouse events.

Return Value:

No return value.

ParameterDescription
l The mouse listener to be removed.

Overrides:

removeMouseListener(IUIMouseListener) in IUIComponent.

removeMouseMotionListener

public void removeMouseMotionListener(IUIMouseMotionListener l);

Removes the specified mouse motion listener. The listener no longer receives the container's mouse motion events.

Return Value:

No return value.

ParameterDescription
l The mouse motion listener to be removed.

Overrides:

removeMouseMotionListener(IUIMouseMotionListener) in IUIComponent.

replace

public IUIComponent replace(IUIComponent comp, IUIComponent old);

Adds the specified component to the container, replacing the specified component.

Return Value:

Returns the component that was added.

ParameterDescription
comp The component to be added.
old The component to be replaced.

See Also: add, remove

replace

public IUIComponent replace(IUIComponent comp, int index);

Adds the specified component to the container, replacing the specified component.

Return Value:

Returns the component that was added.

ParameterDescription
comp The component to be added.
index The index of the component to be replaced.

See Also: add, remove

replace

public IUIComponent replace(IUIComponent comp, Object constraints,
        IUIComponent old);

Adds the specified component to the container with the specified constraints, replacing the specified component.

Return Value:

Returns the component that was added.

ParameterDescription
comp The component to be added.
constraints The layout constraints, which depend on the current layout manager. For more information about layout constraints, see the layout manager's addLayoutComponent method.
old The component to be replaced.

See Also: add, remove

replace

public IUIComponent replace(IUIComponent comp, Object constraints,
        int index);

Adds the specified component to the container with the specified constraints, replacing the specified component.

Return Value:

Returns the component that was added.

ParameterDescription
comp The component to be added.
constraints The layout constraints, which depend on the current layout manager. For more information about layout constraints, see the layout manager's addLayoutComponent method.
index The index of the component to be replaced.

See Also: add, remove

replace

public IUIComponent replace(IUIComponent comp, Object constraints);

Adds the specified component to the container, replacing the component with the specified constraints.

Return Value:

Returns the component that was added.

ParameterDescription
comp The component to be added.
constraints The layout constraints of the component to be replaced (as well as the component to be added), which depend on the current layout manager. For more information about layout constraints, see the layout manager's addLayoutComponent method.

See Also: add, remove

setChildBounds

public void setChildBounds(IUIComponent child, int x, int y, int width, int
        height);

Sets the bounds of the specified component, according to the specified coordinates and dimensions.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.
width The width for the component (in pixels).
height The height for the component (in pixels).

setChildBounds

public void setChildBounds(IUIComponent child, Rectangle rect);

Sets the bounds of the specified component. The component's coordinates and dimensions are defined by the specified Rectangle object.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
rect The bounding rectangle for the component.

setChildBounds

public void setChildBounds(int index, int x, int y, int width, int height);

Sets the bounds of the component at the specified index, according to the specified coordinates and dimensions.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.
width The width for the component (in pixels).
height The height for the component (in pixels).

setChildBounds

public void setChildBounds(int index, Rectangle rect);

Sets the bounds of the component at the specified index. The component's coordinates and dimensions are defined by the specified Rectangle object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
rect The bounding rectangle for the component.

setChildLocation

public void setChildLocation(IUIComponent child, int x, int y);

Sets the location of the specified component, according to the specified coordinates.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.

setChildLocation

public void setChildLocation(IUIComponent child, Point point);

Sets the location of the specified component, according to the specified Point object.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
point The point that identifies the upper-left corner of the component.

setChildLocation

public void setChildLocation(int index, int x, int y);

Sets the location of the component at the specified index, according to the specified coordinates.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
x The x coordinate for the upper-left corner of the component.
y The y coordinate for the upper-left corner of the component.

setChildLocation

public void setChildLocation(int index, Point point);

Sets the location of the component at the specified index, according to the specified Point object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
point The point that identifies the upper-left corner of the component.

setChildSize

public void setChildSize(IUIComponent child, int width, int height);

Sets the size of the specified component, according to the specified dimensions.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
width The width for the component (in pixels).
height The height for the component (in pixels).

setChildSize

public void setChildSize(IUIComponent child, Dimension size);

Sets the size of the specified component, according to the specified Dimension object.

Return Value:

No return value.

ParameterDescription
child The component. Specify either the container's header component or any child component.
size The dimensions for the component (in pixels).

setChildSize

public void setChildSize(int index, int width, int height);

Sets the size of the component at the specified index, according to the specified dimensions.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
width The width for the component (in pixels).
height The height for the component (in pixels).

setChildSize

public void setChildSize(int index, Dimension size);

Sets the size of the component at the specified index, according to the specified Dimension object.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component. If the container has a header component, the header is at index 0, and the first child component begins at index 1; otherwise, the first child begins at index 0.
size The dimensions for the component (in pixels).

setComponent

public void setComponent(int index, IUIComponent comp);

Adds the component to the container.

Return Value:

No return value.

ParameterDescription
index The index in the container where the component will be inserted.
comp The component to be inserted.

setEdge

public void setEdge(int edge);

Sets the style of the container's edge.

Return Value:

No return value.

ParameterDescription
edge The style of the container's edge.

setHeader

public void setHeader(IUIComponent header);

Sets the header component for the container.

Return Value:

No return value.

ParameterDescription
header The component to be used as the container's header component.

setLayout

public void setLayout(IUILayoutManager lm);

Sets the layout manager of the container.

Return Value:

No return value.

ParameterDescription
lm The new layout manager to be used.

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