org.jboss.errai.widgets.client
Class WSGrid

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 org.jboss.errai.widgets.client.WSGrid
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.RequiresResize

public class WSGrid
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.user.client.ui.RequiresResize

A Grid/Table implementation for working with structured data.


Nested Class Summary
static class WSGrid.GridType
           
 class WSGrid.WSAbstractGrid
          This is the actual grid implementation.
 class WSGrid.WSCell
           
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
WSGrid()
           
WSGrid(boolean scrollable, boolean editable)
           
WSGrid(FocusManager fm)
           
 
Method Summary
 void addAfterCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
           
 void addCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
          Registers a ChangeHandler with the grid.
 void blurAll()
          Blur all currently selected columns.
 void clear()
           
static void disableTextSelection(com.google.gwt.dom.client.Element elem, boolean disable)
           
 WSGrid.WSCell getCell(int row, int col)
          Returns an instance of the WSCell based on the row and col specified.
 int getCols()
          Return the total number of columns in the grid.
 boolean getColumnSortOrder(int col)
          Returns the sort order of the specified column.
 int getRowCount()
           
 Stack<WSGrid.WSCell> getSelectionList()
           
 WSGrid.WSCell getSortedColumnHeader()
          If there is a sorted column, this will return an instance of the header cell for that sorted column.
 Map<Integer,Boolean> getSortedColumns()
           
 int getTitlebarOffsetHeight()
          Returns the offsite high of the title row
static String getUserAgent()
           
 void growWidth(int amount)
          Increase or decrease the width by a relative amount.
static boolean isEmpty(String input)
           
static boolean isNumeric(String input)
           
 boolean isRowSelectionOnly()
           
 void mergeSelected()
           
protected  void onAttach()
           
 void onResize()
           
 void removeAfterCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
           
 void removeCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
          Removes a ChangeHandler from the grid.
 void removeRow(int row)
           
 void setCell(int row, int column, String html)
           
 void setCell(int row, int column, WSCellFormatter formatter)
           
 void setColumnHeader(int row, int column, String html)
           
 void setColumnWidth(int column, int width)
          Sets a column width (in pixels).
 void setEditable(boolean editable)
           
 void setHeight(String height)
          Sets the height of the grid.
 void setPixelSize(int width, int height)
           
 void setPreciseHeight(int height)
          Sets the height of the grid in pixels
 void setPreciseWidth(int width)
          Sets the width of the grid in pixels.
 void setRowHeight(int row, int height)
           
 void setRowSelectionOnly(boolean rowSelectionOnly)
           
 void setScrollable(boolean scrollable)
           
 void setWidth(String width)
          Set thes the width of the grid.
 void sizeToParent()
           
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WSGrid

public WSGrid()

WSGrid

public WSGrid(FocusManager fm)

WSGrid

public WSGrid(boolean scrollable,
              boolean editable)
Method Detail

setScrollable

public void setScrollable(boolean scrollable)

setEditable

public void setEditable(boolean editable)

getRowCount

public int getRowCount()

removeRow

public void removeRow(int row)

setColumnHeader

public void setColumnHeader(int row,
                            int column,
                            String html)

setCell

public void setCell(int row,
                    int column,
                    String html)

setCell

public void setCell(int row,
                    int column,
                    WSCellFormatter formatter)

getCols

public int getCols()
Return the total number of columns in the grid.

Returns:
-

blurAll

public void blurAll()
Blur all currently selected columns.


setRowHeight

public void setRowHeight(int row,
                         int height)

setColumnWidth

public void setColumnWidth(int column,
                           int width)
Sets a column width (in pixels). Columns start from 0.

Parameters:
column - - the column
width - - the width in pixels

getCell

public WSGrid.WSCell getCell(int row,
                             int col)
Returns an instance of the WSCell based on the row and col specified.

Parameters:
row - - the row
col - - the column
Returns:
Instance of WSCell.

clear

public void clear()

getTitlebarOffsetHeight

public int getTitlebarOffsetHeight()
Returns the offsite high of the title row

Returns:
The offset height in pixels

setHeight

public void setHeight(String height)
Sets the height of the grid.

Overrides:
setHeight in class com.google.gwt.user.client.ui.UIObject
Parameters:
height - CSS height string.

setPreciseHeight

public void setPreciseHeight(int height)
Sets the height of the grid in pixels

Parameters:
height - The height in pixels

setWidth

public void setWidth(String width)
Set thes the width of the grid.

Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject
Parameters:
width - The CSS width string.

setPreciseWidth

public void setPreciseWidth(int width)
Sets the width of the grid in pixels.

Parameters:
width - The width in pixels.

setPixelSize

public void setPixelSize(int width,
                         int height)
Overrides:
setPixelSize in class com.google.gwt.user.client.ui.UIObject

sizeToParent

public void sizeToParent()

growWidth

public void growWidth(int amount)
Increase or decrease the width by a relative amount. A positive value will increase the size of the grid, while a negative value will shrink the size.

Parameters:
amount - Size in pixels.

getSortedColumns

public Map<Integer,Boolean> getSortedColumns()

getSortedColumnHeader

public WSGrid.WSCell getSortedColumnHeader()
If there is a sorted column, this will return an instance of the header cell for that sorted column.

Returns:
An instance of WSCell.

getColumnSortOrder

public boolean getColumnSortOrder(int col)
Returns the sort order of the specified column. The boolean value true if the order is ascending, false if it's decending or not sorted at all.

Parameters:
col - The column.
Returns:
true if ascending

addCellChangeHandler

public void addCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
Registers a ChangeHandler with the grid.

Parameters:
handler - -

addAfterCellChangeHandler

public void addAfterCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)

removeCellChangeHandler

public void removeCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)
Removes a ChangeHandler from the grid.

Parameters:
handler - -

removeAfterCellChangeHandler

public void removeAfterCellChangeHandler(com.google.gwt.event.dom.client.ChangeHandler handler)

mergeSelected

public void mergeSelected()

onAttach

protected void onAttach()
Overrides:
onAttach in class com.google.gwt.user.client.ui.Composite

onResize

public void onResize()
Specified by:
onResize in interface com.google.gwt.user.client.ui.RequiresResize

disableTextSelection

public static void disableTextSelection(com.google.gwt.dom.client.Element elem,
                                        boolean disable)

getSelectionList

public Stack<WSGrid.WSCell> getSelectionList()

isRowSelectionOnly

public boolean isRowSelectionOnly()

setRowSelectionOnly

public void setRowSelectionOnly(boolean rowSelectionOnly)

getUserAgent

public static String getUserAgent()

isNumeric

public static boolean isNumeric(String input)

isEmpty

public static boolean isEmpty(String input)


Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.