GridBagLayout to UIGridBagLayout

To convert from AWT to AFC, instances of java.awt.GridBagLayout should be transformed into instances of com.ms.ui.UIGridBagLayout.

GridBagLayout implements LayoutManager2: be sure to see its changes.

Purpose and Usage

AFC provides UIGridBagLayout, a new version of AWT's GridBagLayout based on the improved UILayoutManager. One advantage is that you can add and remove layout components from multiple containers in one method.

 

Porting

This is the set of changes you need to make to port all GridBagLayout methods to UIGridBagLayout methods. Any method not listed here or below does not need to be changed.

 

AWT Code AFC Code
GridBagLayout() UIGridBagLayout()
invalidateLayout(Container) (Container).invalidateAll()

 

Unsupported Methods

Some methods in java.awt.GridBagLayout are not directly supported in com.ms.ui.UIGridBagLayout. Those methods and suggested changes are described here.

 

AWT Code/Suggested AFC Code Comments
addLayoutComponent(Component, Object)

addLayoutComponent(IUIContainer, IUIComponent, Object)

You need to specify a container for the component.
addLayoutComponent(String, Object)

addLayoutComponent(IUIContainer, IUIComponent, Object)

You need to specify a container for the component, and Strings need to be associated with objects.
maximumLayoutSize(Container)

preferredLayoutSize(IUIContainer)

 
removeLayoutComponent(Component)

(UIContainer).remove(UIComponent)

Use this method on the Container that has this LayoutManager.
getLayoutDimensions()
getLayoutOrigin()
getLayoutWeights()
GetMinSize(Container, GridBagLayoutInfo)
location(int, int)
AdjustForGravity(GridBagConstraints, Rectangle)
ArrangeGrid(Container)
columnWeights
columnWidths
comptable
defaultConstraints
layoutInfo
MAXGRIDSIZE
MINSIZE
PREFERREDSIZE
rowHeights
rowWeights
getLayoutAlignmentX(Container)
getLayoutAlignmentY(Container)

(no suggestions)