org.gwtiger.client.widget
Class HoverGridWidget

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.HTMLTable
                  extended by com.google.gwt.user.client.ui.FlexTable
                      extended by org.gwtiger.client.widget.HoverGridWidget
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesTableEvents

public class HoverGridWidget
extends com.google.gwt.user.client.ui.FlexTable

This class provides a grid widget where data is displayed and the entire row is highlighted when the mouse hovers overs a row.

This also stores the ID of each row and returns that ID when the row is selected

Author:
Aditya Kapur

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.FlexTable
com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.HTMLTable
com.google.gwt.user.client.ui.HTMLTable.CellFormatter, com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter, com.google.gwt.user.client.ui.HTMLTable.RowFormatter
 
Field Summary
static java.lang.String STYLE_HEADER
           
static java.lang.String STYLE_ROW_EVEN
           
static java.lang.String STYLE_ROW_HOVER
           
static java.lang.String STYLE_ROW_ODD
           
static java.lang.String STYLE_TABLE
           
 
Constructor Summary
HoverGridWidget()
          Constructor
 
Method Summary
 void addHeader(int column, java.lang.String headerText)
           
 void clearGrid()
          Clears the grid
 java.lang.String getHoverStyleName()
           
 java.lang.String getId(int row)
          Return the ID associacted with the given row
 void hasHeader(boolean header)
           
 void onBrowserEvent(com.google.gwt.user.client.Event event)
           
 void setHoverStyleName(java.lang.String style)
          Sets the object's style name, removing all other styles.
 void setId(int row, java.lang.String id)
          Use this method to set ID for a row
 
Methods inherited from class com.google.gwt.user.client.ui.FlexTable
addCell, getCellCount, getFlexCellFormatter, getRowCount, insertCell, insertRow, removeCell, removeCells, removeRow
 
Methods inherited from class com.google.gwt.user.client.ui.HTMLTable
addTableListener, clear, clearCell, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getHTML, getRowFormatter, getText, getWidget, isCellPresent, iterator, remove, removeTableListener, setBorderWidth, setCellPadding, setCellSpacing, setHTML, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STYLE_TABLE

public static final java.lang.String STYLE_TABLE
See Also:
Constant Field Values

STYLE_HEADER

public static final java.lang.String STYLE_HEADER
See Also:
Constant Field Values

STYLE_ROW_ODD

public static final java.lang.String STYLE_ROW_ODD
See Also:
Constant Field Values

STYLE_ROW_EVEN

public static final java.lang.String STYLE_ROW_EVEN
See Also:
Constant Field Values

STYLE_ROW_HOVER

public static final java.lang.String STYLE_ROW_HOVER
See Also:
Constant Field Values
Constructor Detail

HoverGridWidget

public HoverGridWidget()
Constructor

Method Detail

addHeader

public void addHeader(int column,
                      java.lang.String headerText)

clearGrid

public void clearGrid()
Clears the grid


hasHeader

public void hasHeader(boolean header)

getId

public java.lang.String getId(int row)
Return the ID associacted with the given row

Parameters:
row - The row for which the ID is requested
Returns:
ID the ID for the given row

setId

public void setId(int row,
                  java.lang.String id)
Use this method to set ID for a row

Parameters:
row - the row number for which the ID is being set
id - unique ID for the row.

setHoverStyleName

public void setHoverStyleName(java.lang.String style)
Sets the object's style name, removing all other styles. The style name is the name referred to in CSS style rules (in HTML, this is referred to as the element's "class"). By convention, style rules are of the form [project]-[widget] (e.g. the Button widget's style name is .gwt-Button). For example, if a widget's style name is myProject-MyWidget, then the style rule that applies to it will be .myProject-MyWidget. Note the "dot" prefix -- this is necessary because calling this method sets the underlying element's className property.

Parameters:
style - the style name to be added

getHoverStyleName

public java.lang.String getHoverStyleName()

onBrowserEvent

public void onBrowserEvent(com.google.gwt.user.client.Event event)
Specified by:
onBrowserEvent in interface com.google.gwt.user.client.EventListener
Overrides:
onBrowserEvent in class com.google.gwt.user.client.ui.HTMLTable