WUI : API


org.westofj.wui
Class WContainer

java.lang.Object
  extended byorg.westofj.wui.Widget
      extended byorg.westofj.wui.WAbstractContainer
          extended byorg.westofj.wui.WContainer

public class WContainer
extends WAbstractContainer

A collection of widgets. Containers utilize WLayoutManagerinstances to define how they appear on the display.

Version:
$Revision: 1.7 $, $Date: 2004/03/14 21:27:46 $
Author:
bill

Constructor Summary
WContainer()
          Constructs a container with the default layout.
WContainer(WLayoutManager layoutManager)
          Constructs a container with the specified layout manager.
 
Method Summary
 void add(Widget widget)
          Add the specified widget to the container.
 void clear()
          Removes all widgets from the container.
 Widget get(int index)
          Returns the widget at the specified index within the container.
 Widget get(String name)
           
 WLayoutManager getLayoutManager()
          Returns the layout manager that renders the display.
 List getWidgets()
          Returns the widgets contained within the container as a list.
 void remove(Widget widget)
          Removes the specified widget from the container.
 void render(WRunner runner, WRenderContext context, PrintWriter out)
          Renders the widget to the display.
 void replace(Widget current, Widget next)
          Replaces the first occurrance of one widget with another.
 Widget set(int index, Widget widget)
          Sets the widget at the specified index.
 void setLayoutManager(WLayoutManager layoutManager)
          Sets the layout manager that renders the display.
 int size()
          Returns the number of widgets in the container.
 
Methods inherited from class org.westofj.wui.WAbstractContainer
getBackgroundColor, getBorder, getBorderColor, getBorderStyle, getBorderUnit, getColor, getFont, getHeight, getHeightUnit, getPadding, getPaddingUnit, getSpacing, getSpacingUnit, getWidth, getWidthUnit, setBackgroundColor, setBorder, setBorder, setBorder, setBorderColor, setBorderStyle, setBorderUnit, setColor, setFont, setHeight, setHeight, setHeightUnit, setPadding, setPadding, setPaddingUnit, setSpacing, setSpacingUnit, setWidth, setWidth, setWidthUnit
 
Methods inherited from class org.westofj.wui.Widget
addChangeListener, getRunner, handleNoParams, handleParams, hasChangeListeners, removeChangeListener, stateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WContainer

public WContainer()
Constructs a container with the default layout.


WContainer

public WContainer(WLayoutManager layoutManager)
Constructs a container with the specified layout manager.

Parameters:
layoutManager - the layout manager that will render the display.
Method Detail

add

public void add(Widget widget)
Add the specified widget to the container.

Parameters:
widget - the widget to add to the container.

clear

public void clear()
Removes all widgets from the container.


get

public Widget get(int index)
Returns the widget at the specified index within the container.

Parameters:
index - the index of the widget.
Returns:
Widget the widget at the specified index.

get

public Widget get(String name)

getLayoutManager

public final WLayoutManager getLayoutManager()
Returns the layout manager that renders the display.

Returns:
WLayoutManager the layout manager that renders the display.

getWidgets

public List getWidgets()
Returns the widgets contained within the container as a list.

Returns:
List the widgets contained within the container.

remove

public void remove(Widget widget)
Removes the specified widget from the container.

Parameters:
widget - the widget to remove from the container.

render

public void render(WRunner runner,
                   WRenderContext context,
                   PrintWriter out)
            throws WRenderException
Description copied from class: Widget
Renders the widget to the display.

Specified by:
render in class Widget
Parameters:
runner - the current runner context.
out - the output for the display.
Throws:
WRenderException

replace

public void replace(Widget current,
                    Widget next)
Replaces the first occurrance of one widget with another.

Parameters:
current - the widget to replace.
next - the new widget.

set

public Widget set(int index,
                  Widget widget)
Sets the widget at the specified index. Returns the current widget at that location.

Parameters:
index - the index of the widget.
widget - the widget to place into the container at the specified index.
Returns:
Widget the existing widget at the specified index.

setLayoutManager

public final void setLayoutManager(WLayoutManager layoutManager)
Sets the layout manager that renders the display.

Parameters:
layoutManager - the layout manager that renders the display.

size

public int size()
Returns the number of widgets in the container.

Returns:
int the number of widgets in the container.

Copyright (c) 2003 West of J - All rights reserved.