LayoutManager to IUILayoutManager

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

 

Purpose and Usage

AFC's UILayoutManager works like AWT's LayoutManager, creating an abstract layout manager with default keyboard handling. It also allows you to work with multiple containers. With the interface IUILayoutManager, AFC provides several new and improved default layout managers, like UIBarLayout, UITabLayout, and UITreeLayout. (See the documentation for more details.)

If you wish to develop your own layout manager, the class UILayoutManager implements the interface IUILayoutManager, so you can derive from it for convenience. If you wish to use IUILayoutManager as your interface for your old class, however, you need to add the following methods to your extension of LayoutManager:

adjustLayoutSize(IUIContainer, Dimension, IUIComponent, Dimension, Dimension)

continueInvalidate(IUIContainer, IUIComponent)

getComponent(IUIContainer, int)

getComponent(IUIContainer, Object)

navigate(IUIContainer, IUIComponent, int, boolean)

paintContainer(IUIContainer, FxGraphics)

preferredLayoutSize(IUIContainer, Dimension)

 

Porting

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

 

AWT Code AFC Code Comments
addLayoutComponent(String, Component) addLayoutComponent(IUIContainer, IUIComponent, Object) A String needs to be associated with an object, and you need to pass a specific container.
removeLayoutComponent(Component) removeLayoutComponent(IUIContainer, IUIComponent) You need to pass a specific container.