GWT Tk 0.2.3

asquare.gwt.tk.client.ui
Class ExposedCellPanel

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.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.google.gwt.user.client.ui.CellPanel
                      extended by asquare.gwt.tk.client.ui.ExposedCellPanel
All Implemented Interfaces:
EventListener, HasAlignment, HasHorizontalAlignment, HasVerticalAlignment, HasWidgets
Direct Known Subclasses:
ColumnPanel, RowPanel

public abstract class ExposedCellPanel
extends CellPanel
implements HasAlignment

A table-based panel which exposes the TD element and supports:


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
HasHorizontalAlignment.HorizontalAlignmentConstant
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
HasVerticalAlignment.VerticalAlignmentConstant
 
Field Summary
 
Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT
 
Fields inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP
 
Method Summary
 void add(Widget w)
          Creates a new cell and appends to it the specified widget.
 void addCell()
          Adds a new cell to the panel.
 void addCellStyleName(int cellIndex, String styleName)
          Adds a style name to the class attribute of the cell specified by the cellIndex.
 void addCellStyleName(String styleName)
          Adds a style name to the last cell.
 void addWidget(Widget w, boolean newCell)
          Adds a widget to the panel, optionally creating a new cell.
 void addWidgetTo(Widget w, int cellIndex)
          Adds a widget to the specified cell.
 void clear()
          Removes all cells and child widgets from the panel.
 void clearCell(int cellIndex)
          Removes all widgets and child elements from the cell
 int getCellCount()
          Gets the number of cells in this panel.
abstract  Element getCellElement(int cellIndex)
          Gets the table td element corresponding to the specified cell.
 int getCellIndexOf(Widget w)
          Get the index of the cell which contains the specified widget.
 String getCellStyleName(int cellIndex)
          Gets the style name(s) for the cell specified by cellIndex.
 HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
          Gets the default horizontal alignment for newly created cells.
 HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
          Gets the default vertical alignment for newly created cells.
 Widget getWidgetAt(int cellIndex, int wIndex)
          Gets a at the specified index in the specified cell.
 int getWidgetCount()
          Gets the number of child widgets added to the panel
 void insert(Widget w, int cellIndex)
          Inserts a new cell at the specified index and appends the widget to the cell.
 void insertCell(int cellIndex)
          Creates a new cell and inserts it at the specified index.
protected abstract  void insertCellStructure(int cellIndex)
          A template method which creates a td and inserts it into the underlying table.
 void insertWidgetAt(Widget w, int cellIndex, int wIndex)
          Inserts a widget into a an existing cell.
 boolean remove(Widget w)
          Removes a widget from the panel.
 boolean remove(Widget w, boolean removeEmptyCell)
          Removes a widget from the panel, optionally removing the cell if it becomes empty.
 void removeCell(int cellIndex)
          Removes a cell from the panel, including any child widets.
protected abstract  void removeCellStructure(int cellIndex)
          A template method which removes a td from the underlying table.
 void removeCellStyleName(int cellIndex, String styleName)
          Adds a style name to the cell specified by .
 void removeCellStyleName(String styleName)
          Removes the specified style name from the last cell.
 void setCellHeight(int cellIndex, String height)
          Sets the height of the specified cell.
 void setCellHeight(String height)
          Sets the height of the last cell.
 void setCellHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant hAlign)
          Sets the horizontal alignment of the last cell.
 void setCellHorizontalAlignment(int cellIndex, HasHorizontalAlignment.HorizontalAlignmentConstant hAlign)
          Sets the horizontal alignment of the specified cell.
 void setCellStyleName(int cellIndex, String styleName)
          Sets the style name for the cell specified by cellIndex.
 void setCellStyleName(String styleName)
          Sets the style name for the last cell.
 void setCellVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant vAlign)
          Sets the vertical alignment of the last cell.
 void setCellVerticalAlignment(int cellIndex, HasVerticalAlignment.VerticalAlignmentConstant vAlign)
          Sets the vertical alignment of the specified cell.
 void setCellWidth(int cellIndex, String width)
          Sets the width of the specified cell.
 void setCellWidth(String width)
          Sets the width of the last cell.
 void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
          Sets the default horizontal alignment for newly created cells.
 void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
          Sets the default vertical alignment for newly created cells.
 
Methods inherited from class com.google.gwt.user.client.ui.CellPanel
getBody, getSpacing, getTable, setBorderWidth, setCellHeight, setCellHorizontalAlignment, setCellVerticalAlignment, setCellWidth, setSpacing
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, getChildren, insert, iterator
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, disown, onAttach, onDetach
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, onLoad, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCellCount

public int getCellCount()
Gets the number of cells in this panel.


addCell

public void addCell()
Adds a new cell to the panel.


insertCell

public void insertCell(int cellIndex)
Creates a new cell and inserts it at the specified index. Existing cells with an index >= cellIndex will be shifted over by 1.

Parameters:
cellIndex - the index where the cell will be inserted
Throws:
IndexOutOfBoundsException - if cellIndex is less than 0 or greater than the number of cells

insertCellStructure

protected abstract void insertCellStructure(int cellIndex)
A template method which creates a td and inserts it into the underlying table. If a cell exists at cellIndex it will be shifted up by 1. Implementors may assume cellIndex is greater than 0 and less than or equal to the number of cells.

Parameters:
cellIndex - the index at which the td will be inserted.

removeCell

public void removeCell(int cellIndex)
Removes a cell from the panel, including any child widets.

Parameters:
cellIndex - the index of the cell
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

clearCell

public void clearCell(int cellIndex)
Removes all widgets and child elements from the cell

Parameters:
cellIndex - the index of the cell
Throws:
IndexOutOfBoundsException - if cellIndex does not specify a valid cell

removeCellStructure

protected abstract void removeCellStructure(int cellIndex)
A template method which removes a td from the underlying table. Cells with indexes greater than cellIndex will be shifted down by 1. Implementors may assume cellIndex is greater than 0 and less than the number of cells.

Parameters:
cellIndex - the index at which the td will be inserted.

clear

public void clear()
Removes all cells and child widgets from the panel.

Specified by:
clear in interface HasWidgets
Overrides:
clear in class Panel

getWidgetCount

public int getWidgetCount()
Gets the number of child widgets added to the panel

Returns:
the number of child widgets

getWidgetAt

public Widget getWidgetAt(int cellIndex,
                          int wIndex)
Gets a at the specified index in the specified cell. wIndex does not include non-widget child elements.

Parameters:
cellIndex - the index of the cell, starting with 0
wIndex - the index of the widget in the specified cell, starting at 0
Returns:
the widget
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
IndexOutOfBoundsException - if the widget specified by wIndex does not exist

getCellIndexOf

public int getCellIndexOf(Widget w)
Get the index of the cell which contains the specified widget.

Parameters:
w - a child widget
Returns:
the index or -1 if the widget is not a child of this panel

add

public void add(Widget w)
Creates a new cell and appends to it the specified widget.

Specified by:
add in interface HasWidgets
Overrides:
add in class Panel
Parameters:
w - a widget

addWidget

public void addWidget(Widget w,
                      boolean newCell)
Adds a widget to the panel, optionally creating a new cell.

Parameters:
w - a widget
newCell - true to create a new cell, false to append to the last cell
Throws:
IndexOutOfBoundsException - if newCell is false and no cells exist

addWidgetTo

public void addWidgetTo(Widget w,
                        int cellIndex)
Adds a widget to the specified cell. w will be appended after any other widgets in the cell.

Parameters:
w - a widget
cellIndex - the index of the cell
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

insert

public void insert(Widget w,
                   int cellIndex)
Inserts a new cell at the specified index and appends the widget to the cell.

Parameters:
w - a widget
cellIndex - the index of the cell
Throws:
IndexOutOfBoundsException - if cellIndex is less than 0 or greater than the number of cells

insertWidgetAt

public void insertWidgetAt(Widget w,
                           int cellIndex,
                           int wIndex)
Inserts a widget into a an existing cell. Any widgets with indexes greater than or equal to wIndex will be shifted over.

Parameters:
w - a widget
cellIndex - the index of the cell
wIndex - the index of the widget before which w will be inserted
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
IndexOutOfBoundsException - if wIndex is less than 0 or greater than the number of widgets in the specified cell

remove

public boolean remove(Widget w)
Removes a widget from the panel. Automatically removes the cell if it becomes empty.

Specified by:
remove in interface HasWidgets
Overrides:
remove in class ComplexPanel
Parameters:
w - a child widget
Returns:
false if w is not a child of this panel

remove

public boolean remove(Widget w,
                      boolean removeEmptyCell)
Removes a widget from the panel, optionally removing the cell if it becomes empty.

Parameters:
w - a child widget
removeEmptyCell - true to remove the cell if it becomes empty
Returns:
false if w is not a child of this panel

getCellElement

public abstract Element getCellElement(int cellIndex)
Gets the table td element corresponding to the specified cell.

Parameters:
cellIndex - the index of the cell
Returns:
the td element of the specified cell
Throws:
IndexOutOfBoundsException - if cellIndex does not specify an existing cell

getCellStyleName

public String getCellStyleName(int cellIndex)
Gets the style name(s) for the cell specified by cellIndex.

Parameters:
cellIndex - the index of the cell
Returns:
the CSS class name(s) (space delimited)
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

addCellStyleName

public void addCellStyleName(String styleName)
Adds a style name to the last cell.

Parameters:
styleName - a CSS class name
Throws:
IllegalStateException - if no cells exist
IllegalArgumentException - if styleName is ""

addCellStyleName

public void addCellStyleName(int cellIndex,
                             String styleName)
Adds a style name to the class attribute of the cell specified by the cellIndex.

Parameters:
cellIndex - the index of a cell
styleName - a CSS class name
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
IllegalArgumentException - if styleName is ""

setCellStyleName

public void setCellStyleName(String styleName)
Sets the style name for the last cell. Other style names will be overwritten.

Parameters:
styleName - a CSS class name
Throws:
IllegalStateException - if no cells exist

setCellStyleName

public void setCellStyleName(int cellIndex,
                             String styleName)
Sets the style name for the cell specified by cellIndex. Other style names will be overwritten.

Parameters:
cellIndex - the index of the cell
styleName - a CSS class name
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

removeCellStyleName

public void removeCellStyleName(String styleName)
Removes the specified style name from the last cell. Does nothing if styleName is not present.

Parameters:
styleName - a CSS class name
Throws:
IllegalStateException - if no cells exist
IllegalArgumentException - if styleName is ""

removeCellStyleName

public void removeCellStyleName(int cellIndex,
                                String styleName)
Adds a style name to the cell specified by . Does nothing if styleName is not present.

Parameters:
cellIndex - the index of the cell
styleName - a CSS class name
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
IllegalArgumentException - if styleName is ""

setCellWidth

public void setCellWidth(String width)
Sets the width of the last cell.

Parameters:
width - a CSS measurement

setCellWidth

public void setCellWidth(int cellIndex,
                         String width)
Sets the width of the specified cell.

Parameters:
cellIndex - the index of a cell
width - a CSS measurement
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

setCellHeight

public void setCellHeight(String height)
Sets the height of the last cell.

Parameters:
height - a CSS measurement

setCellHeight

public void setCellHeight(int cellIndex,
                          String height)
Sets the height of the specified cell.

Parameters:
cellIndex - the index of a cell
height - a CSS measurement
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist

setCellHorizontalAlignment

public void setCellHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant hAlign)
Sets the horizontal alignment of the last cell.

Parameters:
hAlign - a constant representing left, center or right alignment
See Also:
HasAlignment

setCellHorizontalAlignment

public void setCellHorizontalAlignment(int cellIndex,
                                       HasHorizontalAlignment.HorizontalAlignmentConstant hAlign)
Sets the horizontal alignment of the specified cell.

Parameters:
cellIndex - the index of a cell
hAlign - a constant representing left, center or right alignment
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
See Also:
HasAlignment

setCellVerticalAlignment

public void setCellVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant vAlign)
Sets the vertical alignment of the last cell.

Parameters:
vAlign - a constant representing top, middle or bottom alignment
See Also:
HasAlignment

setCellVerticalAlignment

public void setCellVerticalAlignment(int cellIndex,
                                     HasVerticalAlignment.VerticalAlignmentConstant vAlign)
Sets the vertical alignment of the specified cell.

Parameters:
cellIndex - the index of a cell
vAlign - a constant representing top, middle or bottom alignment
Throws:
IndexOutOfBoundsException - if the cell specified by cellIndex does not exist
See Also:
HasAlignment

getHorizontalAlignment

public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Gets the default horizontal alignment for newly created cells.

Specified by:
getHorizontalAlignment in interface HasHorizontalAlignment
Returns:
an alignment constant or null
See Also:
HasAlignment

setHorizontalAlignment

public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the default horizontal alignment for newly created cells.

Specified by:
setHorizontalAlignment in interface HasHorizontalAlignment
Parameters:
align - an alignment constant or null
See Also:
HasAlignment

getVerticalAlignment

public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
Gets the default vertical alignment for newly created cells.

Specified by:
getVerticalAlignment in interface HasVerticalAlignment
Returns:
an alignment constant or null
See Also:
HasAlignment

setVerticalAlignment

public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the default vertical alignment for newly created cells.

Specified by:
setVerticalAlignment in interface HasVerticalAlignment
Parameters:
align - an alignment constant or null
See Also:
HasAlignment

GWT Tk 0.2.3

© 2007 Mat Gessel