Container to UIContainer

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

Container extends Component: see that page for more information.

Purpose and Usage

AFC's UIContainer implements a stateless container. This is the base class for all AFC containers and allows you to create lightweight controls without having to manage an object's states. Most containers in AFC are not stateless, but UIContainer allows you to implement containers without states.

UIContainers are UIComponent objects that hold collections of other UIComponent objects, which means the advantages provided by UIComponent transfer to UIContainer. See the documentation for more information.

One advantage of UIContainers over AWT's Container class is that it allows many more options for transferring the keyboard focus within the components in the container. The function

navigate(getFocusComponent(), UIAccessible.NAVDIR_XXX, true)

(where NAVDIR_XXX is one of NAVDIR_DOWN, NAVDIR_UP, NAVDIR_PREV, NAVDIR_NEXT, NAVDIR_FIRST, NAVDIR_LAST, NAVDIR_LEFT, NAVDIR_RIGHT) allows you to navigate between components for keyboard focus transfer.

Containers also can be set with specific edge styles, which are IFxGraphicsConstants. Those styles are:

IFxGraphicsConstants.BDR_RAISED
IFxGraphicsConstants.BDR_SUNKEN
IFxGraphicsConstants.BDR_OUTER
IFxGraphicsConstants.BDR_INNER
IFxGraphicsConstants.BDR_RAISEDOUTER
IFxGraphicsConstants.BDR_RAISEDINNER
IFxGraphicsConstants.BDR_SUNKENOUTER
IFxGraphicsConstants.BDR_SUNKENINNER
IFxGraphicsConstants.BDR_FLAT
IFxGraphicsConstants.EDGE_RAISED
IFxGraphicsConstants.EDGE_SUNKEN
IFxGraphicsConstants.EDGE_ETCHED
IFxGraphicsConstants.EDGE_BUMP
0
(No edge style)

 

Porting

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

 

AWT Code AFC Code Comments
Container() UIContainer() or
UIContainer(int)
The int in the second kind of AFC constructor specifies the style of the container's edge, which is an IFXGraphicsConstant. See the documentation for more details.
addImpl(Component, Object, int) add(Component, Object, int)  
countComponents() getComponentCount() Deprecated method in AWT 1.1
getComponentAt(int, int) getComponent(int, int)  
getComponentAt(point) getComponent(point)  
insets() getInsets() Deprecated method in AWT 1.1
locate(int, int) getComponent(int, int) Deprecated method in AWT 1.1
minimumSize() getMinimumSize() Deprecated method in AWT 1.1
preferredSize() getPreferredSize() Deprecated method in AWT 1.1
printComponents(Graphics) printAll(Graphics)  

 

Unsupported Methods

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

 

AWT Code/Suggested AFC Code Comments
paramString()

getName()

You can use this or another get method to get the information you need.
getAlignmentX()
getAlignmentY()
list(PrintStream, int)
list(PrintWriter, int)
processContainerEvent(ContainerEvent)
processEvent(AWTEvent)
validateTree()

(no suggestions)