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
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.
Parameter | Description |
comp
| The component to be added.
|
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.
Parameter | Description |
comp
| The component to be added.
|
index
| The zero-based index at which to insert the component.
|
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.
Parameter | Description |
comp
| The component to be added.
|
constraints
| The layout constraints, which depend on the current layout manager.
|
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.
Parameter | Description |
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.
|
public IUIComponent add(String name, IUIComponent comp);
Note This method is replaced by add(IUIComponent comp, Object constraints).
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.
Parameter | Description |
l
| The container listener to be added.
|
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.
Parameter | Description |
l
| The focus listener to be added.
|
Overrides:
addFocusListener(IUIFocusListener) in IUIComponent.
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.
Parameter | Description |
l
| The key listener to be added.
|
Overrides:
addKeyListener(IUIKeyListener) in IUIComponent.
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.
Parameter | Description |
l
| The mouse listener to be added.
|
Overrides:
addMouseListener(IUIMouseListener) in IUIComponent.
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.
Parameter | Description |
l
| The mouse motion listener to be added.
|
Overrides:
addMouseMotionListener(IUIMouseMotionListener) in IUIComponent.
public void adjustLayoutSize(IUIComponent comp, Dimension oldSize,
Dimension newSize);
Adjusts the layout size of the specified component.
Return Value:
No return value.
Parameter | Description |
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.
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.
Parameter | Description |
comp
| The component being invalidated.
|
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.
Parameter | Description |
index
| The zero-based index of the child component to be made visible in the container.
|
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.
Parameter | Description |
index
| The zero-based index of the component to be retrieved.
|
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.
Parameter | Description |
child
| The component. Specify either the container's header component or any child component.
|
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.
Parameter | Description |
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.
|
public int getChildCount();
Retrieves the number of child components in the container, excluding the header component.
Return Value:
Returns the number of child components.
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.
Parameter | Description |
comp
| The component to retrieve the index for. This component must be a child component and not the header component.
|
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.
Parameter | Description |
child
| The component. Specify either the container's header component or any child component.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
child
| The component. Specify either the container's header component or any child component.
|
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).
Parameter | Description |
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.
|
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.
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
comp
| The component to find the ancestor for.
|
public int getComponentCount();
Retrieves the number of components in the container, including the header component.
Return Value:
Returns the total number of components.
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.
Parameter | Description |
id
| The id of the component to be retrieved.
|
See Also: setID
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.
Parameter | Description |
comp
| The component to retrieve the index for. This component can be the header component or any child component.
|
public IUIComponent[] getComponents();
Retrieves all components in the container.
Return Value:
Returns an array of the container's components.
public int getEdge();
Retrieves the style of the container's edge.
Return Value:
Returns an integer that specifies the current style settings.
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.
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.
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.
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.
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.
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.
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
public void paintComponents(FxGraphics g);
Draws all the components in the container.
Return Value:
No return value.
Parameter | Description |
g
| The graphics context.
|
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.
Parameter | Description |
dir
| The navigation direction. Specify one of the NAVDIR values defined in the IUIAccessible interface.
|
public void remove(int index);
Removes the component at the specified index from the container.
Return Value:
No return value.
Parameter | Description |
index
| The zero-based index of the component to be removed.
|
public void remove(IUIComponent comp);
Removes the specified component from the container.
Return Value:
No return value.
Parameter | Description |
comp
| The component to be removed.
|
public void removeAll();
Removes all components from the container, including the header component.
Return Value:
No return value.
public void removeAllChildren();
Removes all child components from the container. The header component is not removed.
Return Value:
No return value.
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.
Parameter | Description |
l
| The container listener to be removed.
|
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.
Parameter | Description |
l
| The focus listener to be removed.
|
Overrides:
removeFocusListener(IUIFocusListener) in IUIComponent.
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.
Parameter | Description |
l
| The key listener to be removed.
|
Overrides:
removeKeyListener(IUIKeyListener) in IUIComponent.
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.
Parameter | Description |
l
| The mouse listener to be removed.
|
Overrides:
removeMouseListener(IUIMouseListener) in IUIComponent.
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.
Parameter | Description |
l
| The mouse motion listener to be removed.
|
Overrides:
removeMouseMotionListener(IUIMouseMotionListener) in IUIComponent.
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.
Parameter | Description |
comp
| The component to be added.
|
old
| The component to be replaced.
|
See Also: add, remove
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.
Parameter | Description |
comp
| The component to be added.
|
index
| The index of the component to be replaced.
|
See Also: add, remove
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.
Parameter | Description |
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
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.
Parameter | Description |
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
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.
Parameter | Description |
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
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.
Parameter | Description |
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).
|
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.
Parameter | Description |
child
| The component. Specify either the container's header component or any child component.
|
rect
| The bounding rectangle for the component.
|
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.
Parameter | Description |
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).
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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).
|
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.
Parameter | Description |
child
| The component. Specify either the container's header component or any child component.
|
size
| The dimensions for the component (in pixels).
|
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.
Parameter | Description |
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).
|
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.
Parameter | Description |
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).
|
public void setComponent(int index, IUIComponent comp);
Adds the component to the container.
Return Value:
No return value.
Parameter | Description |
index
| The index in the container where the component will be inserted.
|
comp
| The component to be inserted.
|
public void setEdge(int edge);
Sets the style of the container's edge.
Return Value:
No return value.
Parameter | Description |
edge
| The style of the container's edge.
|
public void setHeader(IUIComponent header);
Sets the header component for the container.
Return Value:
No return value.
Parameter | Description |
header
| The component to be used as the container's header component.
|
public void setLayout(IUILayoutManager lm);
Sets the layout manager of the container.
Return Value:
No return value.
Parameter | Description |
lm
| The new layout manager to be used.
|