GWTApplication.client
Class LabelListBox

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by GWTApplication.client.LabelListBox
All Implemented Interfaces:
com.google.gwt.user.client.EventListener

 class LabelListBox
extends com.google.gwt.user.client.ui.Composite

This is a composite widget which comprises of a list box and a label. It's a convenience class which binds together two types of widgets which are commonly used together. I have purposefully not reimplemented all of the methods associated with the sub widgets simply to make the task of coding the class simpler.

Version:
$Id: LabelListBox.java,v 1.4 2008/01/15 11:08:16 cb Exp $
Author:
Craige Bevil

Field Summary
static int HORIZONTAL_ALIGNMENT
          Whether the two widgets should be stacked horizontally
 com.google.gwt.user.client.ui.Label label
          This is the label which is associated with the list box.
 com.google.gwt.user.client.ui.ListBox listBox
          This is a list box which will contain all of the options which can may be selected by the user
static int VERTICAL_ALIGNMENT
          Whether the two widgets should be stacked vertically
 
Constructor Summary
LabelListBox(int Alignment)
          This is the constructor which will generate a panel which contains both the label and the list box
 
Method Summary
 java.lang.String getSelectedItemText()
          This will return the value of the item which has been selected in the list
 boolean setSelectedItem(java.lang.String ItemToSelect)
          This will be used to select the item which is specified in the list
 void setWidth(java.lang.String labelWidth, java.lang.String listBoxWidth)
          This method permits the caller to set the width of both the label and the list box at the same time.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, getWidget, initWidget, isAttached, onAttach, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERTICAL_ALIGNMENT

public static final int VERTICAL_ALIGNMENT
Whether the two widgets should be stacked vertically

See Also:
Constant Field Values

HORIZONTAL_ALIGNMENT

public static final int HORIZONTAL_ALIGNMENT
Whether the two widgets should be stacked horizontally

See Also:
Constant Field Values

listBox

public com.google.gwt.user.client.ui.ListBox listBox
This is a list box which will contain all of the options which can may be selected by the user


label

public com.google.gwt.user.client.ui.Label label
This is the label which is associated with the list box.

Constructor Detail

LabelListBox

LabelListBox(int Alignment)
This is the constructor which will generate a panel which contains both the label and the list box

Parameters:
Alignment - Whether the widgets should be arranged horizontally or vertically. Should be one of VERTICAL_ALIGNMENT or HORIZONTAL_ALIGNMENT.
Method Detail

getSelectedItemText

public java.lang.String getSelectedItemText()
This will return the value of the item which has been selected in the list

Returns:
The text of the item which has been selected in the list. If nothing has been selected by the user then it returns null

setSelectedItem

public boolean setSelectedItem(java.lang.String ItemToSelect)
This will be used to select the item which is specified in the list

Parameters:
ItemToSelect - This is the item in the list which is to be selected by default.
Returns:
boolean True if we managed to set the item in the list to the default value which was specified.

setWidth

public void setWidth(java.lang.String labelWidth,
                     java.lang.String listBoxWidth)
This method permits the caller to set the width of both the label and the list box at the same time. The units which must be passed to this method must be expressed in valid CSS units.

Parameters:
labelWidth - this is the length of the label which must be expressed in valid CSS units
listBoxWidth - this is the length of the list box which must be expressed in valid CSS units