public abstract class

CellPanel

extends ComplexPanel
java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.Panel
         ↳ com.google.gwt.user.client.ui.ComplexPanel
           ↳ com.google.gwt.user.client.ui.CellPanel
Known Direct Subclasses

Class Overview

A panel whose child widgets are contained within the cells of a table. Each cell's size may be set independently. Each child widget can take up a subset of its cell and can be aligned within it.

Note: This class is not related to the Cell based data presentation widgets such as CellList and CellTable.

Use in UiBinder Templates

When working with CellPanel subclasses in UiBinder templates, wrap child widgets in <g:cell> elements. (Note the lower case "c", meant to signal that the cell is not a runtime object, and so cannot have a ui:field attribute.) Cell elements can have attributes setting their height, width and alignment.

<g:cell> attributes

horizontalAlignment
Interpreted as a static member of HasHorizontalAlignment.HorizontalAlignmentConstant and used as the align argument to setCellHorizontalAlignment(Element, HasHorizontalAlignment.HorizontalAlignmentConstant)
verticalAlignment
Interpreted as a static member of HasVerticalAlignment.VerticalAlignmentConstant and used as the align argument to setCellVerticalAlignment(Element, HasVerticalAlignment.VerticalAlignmentConstant)
width
Used as the width argument to setCellWidth(Widget, String)
height
Used as the height argument to setCellHeight(Widget, String)

For example:

 <g:HorizontalPanel>
   <g:cell width='5em' horizontalAlignment='ALIGN_RIGHT'>
     <g:Label ui:field='leftSide' />
   </g:cell>
   <g:cell width='15em' horizontalAlignment='ALIGN_LEFT'>
     <g:Label ui:field='rightSide' />
   </g:cell>
 </g:HorizontalPanel>
 

Summary

[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
CellPanel()
Public Methods
int getSpacing()
Gets the amount of spacing between this panel's cells.
void setBorderWidth(int width)
Sets the width of the border to be applied to all cells in this panel.
void setCellHeight(Widget w, String height)
Sets the height of the cell associated with the given widget, related to the panel as a whole.
void setCellHorizontalAlignment(Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment of the given widget within its cell.
void setCellVerticalAlignment(Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment of the given widget within its cell.
void setCellWidth(Widget w, String width)
Sets the width of the cell associated with the given widget, related to the panel as a whole.
void setSpacing(int spacing)
Sets the amount of spacing between this panel's cells.
Protected Methods
Element getBody()
Element getTable()
void setCellHorizontalAlignment(Element td, HasHorizontalAlignment.HorizontalAlignmentConstant align)
void setCellVerticalAlignment(Element td, HasVerticalAlignment.VerticalAlignmentConstant align)
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.ComplexPanel
From class com.google.gwt.user.client.ui.Panel
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.HasWidgets
From interface com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
From interface com.google.gwt.user.client.ui.IndexedPanel
From interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
From interface com.google.gwt.user.client.ui.IsWidget
From interface java.lang.Iterable

Public Constructors

public CellPanel ()

Public Methods

public int getSpacing ()

Gets the amount of spacing between this panel's cells.

Returns
  • the inter-cell spacing, in pixels

public void setBorderWidth (int width)

Sets the width of the border to be applied to all cells in this panel. This is particularly useful when debugging layouts, in that it allows you to see explicitly the cells that contain this panel's children.

Parameters
width the width of the panel's cell borders, in pixels

public void setCellHeight (Widget w, String height)

Sets the height of the cell associated with the given widget, related to the panel as a whole.

Parameters
w the widget whose cell height is to be set
height the cell's height, in CSS units

public void setCellHorizontalAlignment (Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)

Sets the horizontal alignment of the given widget within its cell.

Parameters
w the widget whose horizontal alignment is to be set
align the widget's horizontal alignment, as defined in HasHorizontalAlignment.

public void setCellVerticalAlignment (Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)

Sets the vertical alignment of the given widget within its cell.

Parameters
w the widget whose vertical alignment is to be set
align the widget's vertical alignment, as defined in HasVerticalAlignment.

public void setCellWidth (Widget w, String width)

Sets the width of the cell associated with the given widget, related to the panel as a whole.

Parameters
w the widget whose cell width is to be set
width the cell's width, in CSS units

public void setSpacing (int spacing)

Sets the amount of spacing between this panel's cells.

Parameters
spacing the inter-cell spacing, in pixels

Protected Methods

protected Element getBody ()

protected Element getTable ()

protected void setCellHorizontalAlignment (Element td, HasHorizontalAlignment.HorizontalAlignmentConstant align)

protected void setCellVerticalAlignment (Element td, HasVerticalAlignment.VerticalAlignmentConstant align)