Procedure
This scenario
will test out the features and behavior of the null layout 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 null.
Basic
Canvas Manipulation
Choose a
JButton from the palette and drop it (without sizing) onto the JPanel.
Verify the JButton is its
default size, and that the setBounds call was added to the JButton
initialization.
Set the text of
the JButton to "A Button" from the Property Sheet (PS).
Verify that the size of
the JButton does not change.
Drag and drop
the JButton to the free form.
Drag and drop
the JButton back to the JPanel
Verify that the size of
the JButton has changed to comfortably display the text.
Verify that the JButton is
able to be moved graphically to any position on the JPanel (including
off the edges)
Verify that the JButton
can be resized by dragging the dots along the border (including off the
edges of the JPanel)
Choose a
JTextField from the palette and while the cursor is loaded with the
Bean, click and drag on the JPanel to size the bean.
Verify that the
dropped bean matches the size outlined when dropping.
Move the
JTextField so that it overlaps the JButton.
Verify that the
component added first is on top (the JButton)
Drop a few more
different Swing components on the JPanel.
Verify each is sized
to its proper default.
Use the Marquee
tool to select a region which covers several beans.
Move the
selected group graphically.
Verify each member
of the selected group is moved properly and in sync with the other
members.
Resize the
selected group graphically.
Verify the preview while
dragging reflects the final result.
Verify each member of the
group is resized properly and the same amount as the other members.
Alignment Manipulation
Click the
Alignment button on the toolbar.
Verify the Alignment
dialog is shown.

Select a Bean
on the JPanel, then hold down Ctrl and select several more.
Try each of the
alignment buttons (may have to undo previous changes to see new effects)
Verify the selected
components are moved and/or sized to match the last selected component
in the group.
Try the
distribute buttons (may have to undo previous changes to see new
effects).
Verify the selected
components are distributed within the parent. The order of distribution
is not last one selected. It is in original x or y order of the top
left corners of the selected components.
Verify that the Show
Distribute Box remains enabled when more than one item is selected,
even when the Alignment dialog is closed.

Use the Choose
Bean dialog to drop three String objects on the canvas.
Use the Marquee
selection tool to select the non-visual beans by drawing a box around
all three strings.
Use the
Alignment dialog buttons to arrange the non-visuals.
Verify
the
alignment tools work for non-visual beans on the canvas.
Alignment with a Dotted Grid
Delete
all the components from the JPanel and from the canvas that were
used from previous tests.
MB2 over the
JPanel to display the popup menu.
Verify the popup menu has a
Show
Grid menu
item.

Select Show Grid and
Verify
the dotted grid is displayed across the JPanel.
Select a JButton
from the palette and resize it as you drop it onto the
JPanel.
Set the text of
the JButton to something (e.g. "Okay").
Verify the upper left side
of the
JButton is located on one of the dots close to where you dropped it.
For example:

Select and drag
the JButton around on the JPanel.

Verify
the target feedback of the rectangle "snaps" to the
nearest upper left dot of the grid.
Release the
mouse and verify the
JButton does indeed move to the position on the grid where the target
feedback was shown.
Drop a few more
components (e.g. JSlider, JRadioButton, JLabel) onto
the grid... some just dropping them and resizing as you drop them. Then
move and resize them.
Verify the components drop,
move,
and resize to the nearest dot locations on the grid (i.e. the position
is always relative to the upper left position of the component).
MB2 over the
JPanel to display the popup menu again.
Verify the popup menu now
has a Hide
Grid menu
item.
Select Hide Grid and Verify
the dotted grid is not displayed across the
JPanel.
Property Sheet
Select the
JPanel
Verify that the Layout
property on the PS gives a value representing the null layout
Select a
component on the JPanel
Verify that changes to the
component's bounds, location and size properties reflect in changes to
the size/location on the canvas.
Verify that changing the
size property on the PS will remove the bounds setting in the source
and generate a location setting.
Verify that changing the
bounds property on the PS will remove the size and location setting.
Verify that changing the
location property on the PS will remove the bounds setting in the
source and generate a size setting.
Verify that setting the
bounds in the source with a java.awt.Rectangle parameter reflects
properly on the PS and on the canvas. [ jButton.setBounds( new
java.awt.Rectangle( 20, 20, 100, 50 ) ) ]
Verify that setting the
location in the source with a java.awt.Point parameter reflects
properly on the PS and on the canvas. [jButton.setLocation( new
java.awt.Point( 50, 50 ) ) ]
Verify that setting the
size in the source with a java.awt.Dimension parameter reflects
properly on the PS and on the canvas. [ jButton.setSize( new
java.awt.Dimension( 100, 50 ) ) ]
Conversions to null layout
For each layout
other than null
Note: changing
from CardLayout will have each component still taking up the entire
space of the JPanel. This is correct behavior.
SWT Null Layout
Repeat all of the above tests using SWT's null layout. (For help
adding support for SWT to your project, see here)
Use the
SWT equivalents for all the Swing/AWT classes referenced above.
Use org.eclipse.swt.graphics.Rectangle as the parameter for
setBounds, and use org.eclipse.swt.graphics.Point as the parameter for
setLocation and setSize.