Procedure

This scenario will test out the features and behavior of the GridLayout manager.

Setup

 

Create a new Visual Class extending JPanel and resize it to take up 3/4ths of the Canvas.  Set the layout of the JPanel to GridLayout

Basic Canvas Manipulation

Choose the JTable bean on the palette and drop it on the JPanel.
Verify that the table takes up all the space on the JPanel.

Drop a JLabel on the JPanel
Verify that the size of the components are split equally horizontally

Choose a JTree from the palette and hover over the components on the JPanel
Verify that a vertical black positioning bar is shown for all possible drop locations.

Drop the tree on the right of the JLabel.
Verify that the size of the components are split equally horizontally

Click and hold the JTree.  Move the cursor over the other components.
Verify that a vertical black positioning bar is shown for all possible drop locations.

Drop the tree between the table and the button.
Verify that the tree moves to the new location properly on the canvas, and the order of the add statements in the source and beans view are updated.

Click and drag and drop a bean in the Beans View to reorder the beans.
Verify that the order of the add statements are changed and the canvas is updated properly.

Change the order of the add statements in the source.
Verify that the component moves to the new location properly on the canvas, and the beans view are updated.

Property Sheet

Select the JPanel
Verify that the Layout property on the PS gives a value representing the GridLayout
Verify there's a + to expand the sub-properties of the Layout - columns, hgap, rows, vgap

Change the rows property to 2.
Verify that the layout changes to two rows, two columns, with all components sizes and placed properly.

Add two more components to the JPanel.
Verify that the layout changes to two rows, three columns, with all components sizes and placed properly.

Verify that changing the hgap and vgap properties update the source and the canvas correctly (establishes spacing between components).

Change the hgap and vgap properties in the source.
Verify the changes are reflected in the PS and on the canvas.

Set rows to 3 in the source.
Verify that the layout changes to three rows, two columns, with all components sizes and placed properly, and the PS updates.

Set the rows to 0 and columns to 3 in the source (needed because if rows is non-zero, columns is ignored).
Verify that the layout changes to two rows, three columns, with all components sizes and placed properly, and the PS updates.

Conversions to GridLayout

For each layout other than GridLayout


The algorithm for determining rows and columns is rows = round( squareroot( num components ) ), columns = ceiling( squareroot( num components ) )