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

Class UITreeLayout

Constructors , Methods

public class UITreeLayout extends UILayoutManager
{
  // Constructors
  public UITreeLayout();
  public UITreeLayout(int indent);
  public UITreeLayout(int indent, int vgap);

  // Methods
  public Dimension minimumLayoutSize(Container target);
  public Dimension preferredLayoutSize(Container target);

  public void drawLine(Graphics g, int x1, int y1, int x2, int y2);
  public Component navigate(Container cont, Component comp, int dir, 
                            boolean keyable);

  public void layoutContainer(Container target);
  public void paintContainer(Container target, Graphics g1);

}

A class that implements a tree layout manager. UITreeLayout is used to lay out UITree nodes, and handles the drawing of the lines that connect a node to its children.

By default, UISystem defines UITreeLayout at the TREE_LAYOUT index.


Constructors


UITreeLayout

public UITreeLayout();

Creates a tree layout manager with an indent of 16 pixels and a vertical gap of 2 pixels.


UITreeLayout

public UITreeLayout(int indent);

Creates a tree layout manager with the specified indent and a vertical gap of 2 pixels.

ParameterDescription
indent The indent (in pixels) used for child components.


UITreeLayout

public UITreeLayout(int indent, int vgap);

Creates a new tree layout manager with the specified indent and vertical gap.

ParameterDescription
indent The indent (in pixels) used for child components.
vgap The vertical spacing between components.


Methods


drawLine

public void drawLine(Graphics g, int x1, int y1, int x2, int y2);

Draws a line from one point to another.

Return Value:

No return value.

ParameterDescription
g The graphics context.
x1 The x coordinate of the line's starting point.
y1 The y coordinate of the lines's starting point.
x2 The x coordinate of the line's ending point.
y2 The y coordinate of the line's ending point.

Remarks:

This method is called by paintContainer to draw the lines that connect a tree node to its children.


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:

Returns the component navigated to, or null if no component in the specified direction exists.

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

Remarks:

If an undefined direction is specified, an IllegalArgumentException is thrown.


paintContainer

public void paintContainer(Container target, Graphics g1);

Paints the container and its contents.

Return Value:

No return value.

ParameterDescription
target The container.
g1 The graphics context of the container.

Remarks:

This method calls drawLine to connect a tree node to its children, if the node is expanded.


preferredLayoutSize

public Dimension preferredLayoutSize(Container target);

Determines the preferred dimensions (in pixels) needed to lay 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.



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