nextapp.echo
Class Grid

java.lang.Object
  extended by nextapp.echo.Grid
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Component, ComponentPeer
Direct Known Subclasses:
DynaGrid

public class Grid
extends java.lang.Object
implements Component, java.beans.PropertyChangeListener, ComponentPeer

A component used to lay out child components in a grid. Re-implemented for reduction of heap usage with flyweight pattern.


Nested Class Summary
static class Grid.Cell
          A container component representing a single cell of a grid.
static class Grid.ExternalState
           
 class Grid.GridCellOverlapException
          An exception that is thrown when grid cells overlap (due to their column/row spans).
 
Field Summary
static java.lang.String BORDER_COLOR_CHANGED_PROPERTY
           
static java.lang.String BORDER_SIZE_CHANGED_PROPERTY
           
static java.lang.String CELL_LAYOUT_ORIENTATION_CHANGED_PROPERTY
           
static int CELL_LAYOUT_ORIENTATION_HORIZONTAL
          A constant value for the CellLayoutOrientation property.
static int CELL_LAYOUT_ORIENTATION_VERTICAL
          A constant value for the CellLayoutOrientation property.
static java.lang.String CELL_MARGIN_CHANGED_PROPERTY
           
static java.lang.String COLUMN_DELETED_PROPERTY
           
static java.lang.String COLUMN_INSERTED_PROPERTY
           
static java.lang.String COLUMN_WIDTH_CHANGED_PROPERTY
           
static java.lang.String COLUMNS_CHANGED_PROPERTY
           
static java.lang.String HEIGHT_CHANGED_PROPERTY
           
static java.lang.String HEIGHT_UNITS_CHANGED_PROPERTY
           
static int PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
          A constant value for the WidthUnits and HeightUnits properties.
static int PERCENT_UNITS
          A constant value for the WidthUnits and HeightUnits properties.
static int PIXEL_UNITS
          A constant value for the WidthUnits and HeightUnits properties.
static java.lang.String ROW_DELETED_PROPERTY
           
static java.lang.String ROW_HEIGHT_CHANGED_PROPERTY
           
static java.lang.String ROW_INSERTED_PROPERTY
           
static java.lang.String ROWS_CHANGED_PROPERTY
           
static java.lang.String STYLE_BORDER_COLOR
          A style constant for the Border Color property.
static java.lang.String STYLE_BORDER_SIZE
          A style constant for the Border Size property.
static java.lang.String STYLE_CELL_MARGIN
          A style constant for the Cell Margin property.
static java.lang.String STYLE_COLUMN_WIDTHS
          A style constant for the setting column widths.
static java.lang.String STYLE_HEIGHT
          A style constant for the Height property.
static java.lang.String STYLE_HEIGHT_UNITS
          A style constant for the Height Units property.
static java.lang.String STYLE_ROW_HEIGHTS
          A style constant for the setting row heights.
static java.lang.String STYLE_WIDTH
          A style constant for the Width property.
static java.lang.String STYLE_WIDTH_UNITS
          A style constant for the Width Units property.
static int UNKNOWN_SIZE
          Deprecated. Use EchoConstants.UNDEFINED_SIZE.
static java.lang.String WIDTH_CHANGED_PROPERTY
           
static java.lang.String WIDTH_UNITS_CHANGED_PROPERTY
           
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echoservlet.ComponentPeer
IGNORE_PROPERTY_CHANGE
 
Constructor Summary
Grid()
          Creates a new Grid.
 
Method Summary
 void add(Component c)
          Component implementation *
 void add(Component c, int index)
          Throws an UnsupportedOperationException if component is not a cell.
 void add(Coordinate position, Grid.Cell cell)
          Adds a cell at a specific coordinate.
 Grid.Cell add(int column, int row, Component component)
          Creates a new Cell containing only the given component and adds it at the specified position.
 void add(int column, int row, Grid.Cell cell)
          Adds a cell at a specific coordinate.
 void addAncillaryService(Service service)
          ComponentPeer implementation
 void addHierarchyListener(HierarchyListener l)
          Adds a hierarchy listener to be notified when this component's state in the hierarchy changes.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a property change listener to this component.
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 void deleteColumn(int column)
          Remove a column from the grid.
 void deleteRow(int row)
          Remove a row from the grid.
 void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, char oldValue, char newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)
          Reports a bound property change.
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Reports a bound property change.
 Id generateId()
           
 Grid.Cell get(Coordinate position)
          Returns the Cell at the specified position
 Grid.Cell get(int column, int row)
          Returns the Cell at the specified position
 Color getBackground()
          Returns the background color of the component.
 Color getBorderColor()
          Returns the border color.
 int getBorderSize()
          Returns the border size.
 Color getCalculatedBackground()
          Returns the background color in which the component will be rendered.
 Font getCalculatedFont()
          Returns the font in which the component will be rendered.
 Color getCalculatedForeground()
          Returns the foreground color in which the component will be rendered.
 int getCellLayoutOrientation()
          Returns the cell layout orientation.
 int getCellMargin()
          Returns the cell margin.
 Coordinate getCellPosition(Grid.Cell cell)
          Returns the position of a specific cell in the grid.
 java.lang.String getClientId()
           Gets the reuseable Id, this is used to keep component peer id constant over show/hide cycles.
 int getColumns()
          Returns the programmatically-defined allowed number of columns.
 int getColumnWidth(int column)
          Returns the width of a grid column.
 Component getComponent()
          Returns the component that is handled by this peer.
 Component getComponent(int n)
          Gets the nth immediate child component.
 int getComponentCount()
          Returns the number of immediate child components.
 Component[] getComponents()
          Returns an array of all immediate child components.
 java.lang.String getCssClass()
           
 EchoInstance getEchoInstance()
          Returns the EchoInstance object to which this component belongs, or null if it is not bound to any instance.
 java.lang.String getFocusedElementId()
           
 Font getFont()
          Returns the font.
 Color getForeground()
          Returns the foreground of the component.
 int getHeight()
          Returns the overall height of the grid.
 int getHeightUnits()
          Returns the units (pixel or percent) in which column heights and overall grid height are measured.
 Id getId()
          Returns the Id by which this peer is identified on the client.
 java.lang.Object getIdentifier()
          Returns the identifier for this component.
 InstancePeer getInstancePeer()
          Returns the InstancePeer with which this peer is associated.
 EventListenerList getListenerList()
           
 java.util.Locale getLocale()
          Returns the locale of the component.
 Component getParent()
          Returns the parent component.
 ComponentPeer getParentComponentPeer()
          Returns the peer of the associated component's component.
 ComponentPeer getPeer(Component component)
          Returns the peer of the specified component.
 int getRowHeight(int row)
          Returns the height of a grid row.
 int getRows()
          Returns the programmatically-defined allowed number of rows.
 Dimension getSize()
          Returns the size of the grid.
 boolean getUseInternalBorders()
           
 int getWidth()
          Returns the overall width of the grid.
 int getWidthUnits()
          Returns the units (pixel or percent) in which column widths and overall grid width are measured.
 int indexOf(Component c)
          Returns the index of the specified component if it a child of this Component, or -1 if it is not.
 void init()
           
 void insertColumn(int column)
          Inserts a column into the grid.
 void insertRow(int row)
          Inserts a row into the grid.
 void invalidate()
           
 boolean isAncestorOf(Component c)
          Determines if this component is an ancestor of the specified component.
 boolean isEnabled()
          Returns true if the component is enabled.
 boolean isFocused()
          Returns true if the component is focused.
 boolean isInitialized()
           
 boolean isRecursivelyVisible()
           
 boolean isRegistered()
          Returns true if the component is registered to an application.
 boolean isSelectableForScriptRecorder()
           
 boolean isShowing()
          Returns true if the component is registered and all of its ancestors are visible.
 boolean isVisible()
          Returns the component's visibility state.
 java.util.Iterator iterator()
          Returns a sequential (column then row) iterator over all cells in the grid.
 void processHierarchyEvent(long changeFlags, Component changed, Component changedParent)
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void redraw()
          Requests that the component be redrawn on the client.
 void registerAncillaryServices()
           
 void registered()
          Called when the component is registered.
 void remove(Component component)
          Removes the specified Cell.
 Grid.Cell remove(Coordinate position)
          Removes and returns the cell at the specified position.
 void remove(int n)
          Removes the component at the given index.
 Grid.Cell remove(int column, int row)
          Removes and returns the cell at the specified position.
 void removeAll()
          Removes all child Components.
 void removeAncillaryService(Service service)
          Removes an ancillary service from this ComponentPeer.
 void removeHierarchyListener(HierarchyListener l)
          Removes a hierarchy listener from being notified when this component's state in the hierarchy changes.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a property change listener from this component.
 void render(RenderingContext rc, Element parent)
          A method that should be overridden for the ComponentPeer to produce HTML output.
 void setBackground(Color newValue)
          Sets the background color of the component.
 void setBorderColor(Color newValue)
          Sets the border color of the grid.
 void setBorderSize(int newValue)
          Sets the size of the grid's border.
 void setCellLayoutOrientation(int newValue)
          Sets the cell layout orientation.
 void setCellMargin(int newValue)
          Sets the cell interior margin.
 void setClientId(java.lang.String reusableId)
           Sets the reuseable Id, this is used to keep component peer id constant over show/hide cycles.
 void setColumns(int newValue)
          Sets the programmatically defined allowed number of columns.
 void setColumnWidth(int column, int newValue)
          Sets the width of a column of the grid.
 void setComponent(Component c)
           
 void setCssClass(java.lang.String cssClass)
           
 void setEnabled(boolean newValue)
          Sets whether the component is enabled.
 void setFocused(boolean newValue)
          Sets whether the component is focused.
 void setFont(Font font)
          Sets the font of the component.
 void setForeground(Color newValue)
          Sets the foreground color of the component.
 void setHeight(int newValue)
          Sets the overall height of the grid.
 void setHeightUnits(int newValue)
          Sets the units (pixel or percent) in which row heights and overall grid height are measured.
 void setId(Id generateId)
           
 void setIdentifier(java.lang.Object newValue)
          Sets the identifier for this component.
 void setInitialized(boolean initialized)
           
 void setInstancePeer(InstancePeer instancePeer)
           
 void setLocale(java.util.Locale newValue)
          Sets the locale of the component.
 void setParent(Component parent)
           
 void setRegistered(boolean b)
           
 void setRowHeight(int row, int newValue)
          Sets the height of a row of the grid.
 void setRows(int newValue)
          Sets the programmatically defined allowed number of rows.
 void setSelectableForScriptRecorder(boolean b)
           
 void setUseInternalBorders(boolean borderCollapse)
           
 void setVisible(boolean newValue)
          Sets the component visible or invisible.
 void setWidth(int newValue)
          Sets the overall width of the grid.
 void setWidthUnits(int newValue)
          Sets the units (pixel or percent) in which column widths and overall grid width are measured.
 void superAdd(Component c, int n)
           
 void superApplyStyle(Style style)
           
 void superRemove(Component c)
           
 void unregisterAncillaryServices()
           
 void unregistered()
          Called when the component is unregistered.
 void update()
          Forces the component to be re-rendered immediately.
 void validate()
          Overrides Component.validate(), to ensure that no cells of the grid overlap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CELL_LAYOUT_ORIENTATION_HORIZONTAL

public static final int CELL_LAYOUT_ORIENTATION_HORIZONTAL
A constant value for the CellLayoutOrientation property. Specifies that cells should be layed out horizontally until all columns are used and then vertically.

See Also:
Constant Field Values

CELL_LAYOUT_ORIENTATION_VERTICAL

public static final int CELL_LAYOUT_ORIENTATION_VERTICAL
A constant value for the CellLayoutOrientation property. Specifies that cells should be layed out vertically until all rows are used and then horizontally.

See Also:
Constant Field Values

PIXEL_UNITS

public static final int PIXEL_UNITS
A constant value for the WidthUnits and HeightUnits properties. This value specifies that pixel-based units are used in defining the individual column or row sizes and the overall width and height of the grid.

See Also:
Constant Field Values

PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS

public static final int PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
A constant value for the WidthUnits and HeightUnits properties. This value specifies that percent-based units are used in defining the individual column or row sizes, but pixel based units are used in defining the overall width or height of the grid.

See Also:
Constant Field Values

PERCENT_UNITS

public static final int PERCENT_UNITS
A constant value for the WidthUnits and HeightUnits properties. This value specifies that percent-based are used in defining both the individual column or row sizes and the overall width or height of the grid.

See Also:
Constant Field Values

STYLE_BORDER_COLOR

public static final java.lang.String STYLE_BORDER_COLOR
A style constant for the Border Color property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_BORDER_SIZE

public static final java.lang.String STYLE_BORDER_SIZE
A style constant for the Border Size property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_CELL_MARGIN

public static final java.lang.String STYLE_CELL_MARGIN
A style constant for the Cell Margin property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_COLUMN_WIDTHS

public static final java.lang.String STYLE_COLUMN_WIDTHS
A style constant for the setting column widths. Values of this key must be an array of integer primitives.

See Also:
Constant Field Values

STYLE_HEIGHT

public static final java.lang.String STYLE_HEIGHT
A style constant for the Height property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_HEIGHT_UNITS

public static final java.lang.String STYLE_HEIGHT_UNITS
A style constant for the Height Units property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_ROW_HEIGHTS

public static final java.lang.String STYLE_ROW_HEIGHTS
A style constant for the setting row heights. Values of this key must be an array of integer primitives.

See Also:
Constant Field Values

STYLE_WIDTH

public static final java.lang.String STYLE_WIDTH
A style constant for the Width property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_WIDTH_UNITS

public static final java.lang.String STYLE_WIDTH_UNITS
A style constant for the Width Units property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

UNKNOWN_SIZE

public static final int UNKNOWN_SIZE
Deprecated. Use EchoConstants.UNDEFINED_SIZE.
A constant used to specify an unknown grid cell width or height.

See Also:
Constant Field Values

BORDER_COLOR_CHANGED_PROPERTY

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

BORDER_SIZE_CHANGED_PROPERTY

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

CELL_MARGIN_CHANGED_PROPERTY

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

CELL_LAYOUT_ORIENTATION_CHANGED_PROPERTY

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

COLUMN_DELETED_PROPERTY

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

COLUMN_INSERTED_PROPERTY

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

COLUMN_WIDTH_CHANGED_PROPERTY

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

COLUMNS_CHANGED_PROPERTY

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

HEIGHT_CHANGED_PROPERTY

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

HEIGHT_UNITS_CHANGED_PROPERTY

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

ROW_DELETED_PROPERTY

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

ROW_HEIGHT_CHANGED_PROPERTY

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

ROW_INSERTED_PROPERTY

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

ROWS_CHANGED_PROPERTY

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

WIDTH_CHANGED_PROPERTY

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

WIDTH_UNITS_CHANGED_PROPERTY

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

Grid

public Grid()
Creates a new Grid.

Method Detail

add

public void add(Component c,
                int index)
Throws an UnsupportedOperationException if component is not a cell.

Specified by:
add in interface Component
Parameters:
c - The child component to add.
index - The index at which to add the child component, or -1 to add the component at the end.
See Also:
Component.add(Component, int)

add

public void add(Coordinate position,
                Grid.Cell cell)
Adds a cell at a specific coordinate.

Parameters:
position - The coordinate position of the cell.
cell - The cell to be added.

add

public void add(int column,
                int row,
                Grid.Cell cell)
Adds a cell at a specific coordinate.

Parameters:
column - The column at which to add the component.
row - The row at which to add the component.
cell - The cell to be added.

add

public Grid.Cell add(int column,
                     int row,
                     Component component)
Creates a new Cell containing only the given component and adds it at the specified position.

Parameters:
column - The column at which to add the component.
row - The row at which to add the component.
component - The component to be added.
Returns:
The Cell object that was added to the grid at the specified coordinate, containing the specified component. This value is useful if the application needs to set additional properties on the cell.

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(Style)

deleteColumn

public void deleteColumn(int column)
Remove a column from the grid.

Parameters:
column - The column to remove from the grid.

deleteRow

public void deleteRow(int row)
Remove a row from the grid.

Parameters:
row - The row to remove from the grid.

get

public Grid.Cell get(Coordinate position)
Returns the Cell at the specified position

Parameters:
position - The coordinate of the cell.
Returns:
The cell at the specified position. If no cell was found, null is returned.

get

public Grid.Cell get(int column,
                     int row)
Returns the Cell at the specified position

Parameters:
column - The column number of the cell to retrieve.
row - The row number of the cell to retrieve.
Returns:
The cell at the specified column and row position. If no cell was found, null is returned.

getBorderColor

public Color getBorderColor()
Returns the border color.

Returns:
The border color.

getBorderSize

public int getBorderSize()
Returns the border size.

Returns:
The border size in pixels.

getCellLayoutOrientation

public int getCellLayoutOrientation()
Returns the cell layout orientation. The cell layout orientation defines the path in which automatically positioned cells will be placed within the grid.

Returns:
The cell layout orientation, one of the following values:
  • CELL_LAYOUT_ORIENTATION_HORIZONTAL
  • CELL_LAYOUT_ORIENTATION_VERTICAL

getCellMargin

public int getCellMargin()
Returns the cell margin. The default cell margin is 3 pixels.

Returns:
The cell margin in pixels.

getCellPosition

public Coordinate getCellPosition(Grid.Cell cell)
Returns the position of a specific cell in the grid.

Parameters:
cell - The cell whose position is to be returned.
Returns:
The position of the cell.

getColumns

public int getColumns()
Returns the programmatically-defined allowed number of columns.

Returns:
The programmatically-defined allowed number of columns.

getColumnWidth

public int getColumnWidth(int column)
Returns the width of a grid column. If the width is not defined, EchoConstants.UNDEFINED_SIZE is returned. The units for this value may be pixels or percentiles, based on the value of the "WidthUnits" property.

Parameters:
column - The column index.
Returns:
The width of the grid column.

getHeight

public int getHeight()
Returns the overall height of the grid. This property is not relevant when row heights are being measured in pixels and all rows have a height value, or if the sum of all row heights (and margins) is greater than the height value.

Returns:
The height of the grid. If the height is not defined, EchoConstants.UNDEFINED_SIZE is returned.

getHeightUnits

public int getHeightUnits()
Returns the units (pixel or percent) in which column heights and overall grid height are measured.

Returns:
The unit measurement, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
  • PERCENT_UNITS

getRowHeight

public int getRowHeight(int row)
Returns the height of a grid row. If the height is not defined, EchoConstants.UNDEFINED_SIZE is returned. The units for this value may be pixels or percentiles, based on the value of the "HeightUnits" property.

Parameters:
row - The row index.
Returns:
The height of the grid row.

getSize

public Dimension getSize()
Returns the size of the grid.

Returns:
The size of the grid in cells as a Dimension.

getRows

public int getRows()
Returns the programmatically-defined allowed number of rows.

Returns:
The programmatically-defined allowed number of rows.

getWidth

public int getWidth()
Returns the overall width of the grid. This property is not relevant when column widths are being measured in pixels and all columns have a width value, or if the sum of all columns widths (and margins) is greater than the width value.

Returns:
The width of the grid. If the width is not defined, EchoConstants.UNDEFINED_SIZE is returned.

getWidthUnits

public int getWidthUnits()
Returns the units (pixel or percent) in which column widths and overall grid width are measured.

Returns:
The unit measurement, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
  • PERCENT_UNITS

insertColumn

public void insertColumn(int column)
Inserts a column into the grid.

Parameters:
column - The index of the inserted column.

insertRow

public void insertRow(int row)
Inserts a row into the grid.

Parameters:
row - The index of the inserted row.

invalidate

public void invalidate()

iterator

public java.util.Iterator iterator()
Returns a sequential (column then row) iterator over all cells in the grid.

Returns:
An iterator over all cells in the grid.

remove

public void remove(Component component)
Removes the specified Cell.

Specified by:
remove in interface Component
Parameters:
component - The cell to be removed.
See Also:
Component.remove(nextapp.echo.Component)

remove

public Grid.Cell remove(Coordinate position)
Removes and returns the cell at the specified position.

Parameters:
position - The coordinate position of the cell to remove.
Returns:
The cell that was removed. If no cell was found at the specified coordinates, null is returned.

remove

public Grid.Cell remove(int column,
                        int row)
Removes and returns the cell at the specified position.

Parameters:
column - The column number of the cell to remove.
row - The row number of the cell to remove.
Returns:
The cell that was removed. If no cell was found at the specified coordinates, null is returned.

setBorderColor

public void setBorderColor(Color newValue)
Sets the border color of the grid.

Parameters:
newValue - The border color of the grid.

setBorderSize

public void setBorderSize(int newValue)
Sets the size of the grid's border.

Parameters:
newValue - The size of the grid's border, in pixels.

setCellLayoutOrientation

public void setCellLayoutOrientation(int newValue)
Sets the cell layout orientation. The cell layout orientation defines the path in which automatically positioned cells will be placed within the grid.

Parameters:
newValue - The new cell layout orientation, one of the following values:
  • CELL_LAYOUT_ORIENTATION_HORIZONTAL
  • CELL_LAYOUT_ORIENTATION_VERTICAL

setCellMargin

public void setCellMargin(int newValue)
Sets the cell interior margin. The default size is 3 pixels

Parameters:
newValue - The cell margin, in pixels.

setColumns

public void setColumns(int newValue)
Sets the programmatically defined allowed number of columns.

Parameters:
newValue - The allowed number of columns in the grid.

setColumnWidth

public void setColumnWidth(int column,
                           int newValue)
Sets the width of a column of the grid.

Parameters:
column - The column number.
newValue - The new width of the specified column.

setHeight

public void setHeight(int newValue)
Sets the overall height of the grid. Setting this property will have no effect in the event that all rows have a height value, or if the sum of all row heights (and margins) is greater than the height value.

Parameters:
newValue - The new height of the grid. To set the height to be undefined, use the EchoConstants.UNDEFINED_SIZE constant.

setHeightUnits

public void setHeightUnits(int newValue)
Sets the units (pixel or percent) in which row heights and overall grid height are measured.

Parameters:
newValue - The new unit measurement, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
  • PERCENT_UNITS

setRowHeight

public void setRowHeight(int row,
                         int newValue)
Sets the height of a row of the grid.

Parameters:
row - The row number.
newValue - The new height of the specified row.

setRows

public void setRows(int newValue)
Sets the programmatically defined allowed number of rows.

Parameters:
newValue - The allowed number of rows in the grid.

setWidth

public void setWidth(int newValue)
Sets the overall width of the grid. Setting this property will have no effect in the event that all columns have a width value, or if the sum of all columns widths (and margins) is greater than the width value.

Parameters:
newValue - The new width of the grid. To set the width to be undefined, use the EchoConstants.UNDEFINED_SIZE constant.

setWidthUnits

public void setWidthUnits(int newValue)
Sets the units (pixel or percent) in which column widths and overall grid width are measured.

Parameters:
newValue - The new unit measurement, one of the following values:
  • PIXEL_UNITS (the default)
  • PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS
  • PERCENT_UNITS

validate

public void validate()
Overrides Component.validate(), to ensure that no cells of the grid overlap. If any cells overlap, a GridCellOverlapException is thrown.

Specified by:
validate in interface Component

getUseInternalBorders

public boolean getUseInternalBorders()

setUseInternalBorders

public void setUseInternalBorders(boolean borderCollapse)

add

public void add(Component c)
Component implementation *

Specified by:
add in interface Component
Parameters:
c - The child component to add.

superAdd

public void superAdd(Component c,
                     int n)

addHierarchyListener

public void addHierarchyListener(HierarchyListener l)
Description copied from interface: Component
Adds a hierarchy listener to be notified when this component's state in the hierarchy changes.

Specified by:
addHierarchyListener in interface Component
Parameters:
l - The HierarchyListener to add.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Component
Adds a property change listener to this component.

Specified by:
addPropertyChangeListener in interface Component
Parameters:
l - The listener to add.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               boolean oldValue,
                               boolean newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               char oldValue,
                               char newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               double oldValue,
                               double newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               float oldValue,
                               float newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               int oldValue,
                               int newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               long oldValue,
                               long newValue)
Description copied from interface: Component
Reports a bound property change.

Specified by:
firePropertyChange in interface Component
Parameters:
propertyName - The name of the changed property.
oldValue - The previous value of the property.
newValue - The present value of the property.

getClientId

public java.lang.String getClientId()
Description copied from interface: Component

Gets the reuseable Id, this is used to keep component peer id constant over show/hide cycles.

Specified by:
getClientId in interface Component

getComponent

public Component getComponent(int n)
Description copied from interface: Component
Gets the nth immediate child component.

Specified by:
getComponent in interface Component
Parameters:
n - The index of the component to retrieve.
Returns:
The component at index n.

getComponentCount

public int getComponentCount()
Description copied from interface: Component
Returns the number of immediate child components.

Specified by:
getComponentCount in interface Component
Returns:
The number of immediate child components.

getComponents

public Component[] getComponents()
Description copied from interface: Component
Returns an array of all immediate child components.

Specified by:
getComponents in interface Component
Returns:
An array of all immediate child components.

getEchoInstance

public EchoInstance getEchoInstance()
Description copied from interface: Component
Returns the EchoInstance object to which this component belongs, or null if it is not bound to any instance.

Specified by:
getEchoInstance in interface Component
Returns:
The EchoInstance object to which this component belongs.

getFont

public Font getFont()
Description copied from interface: Component
Returns the font.

Specified by:
getFont in interface Component
Returns:
The font of the component.

getIdentifier

public java.lang.Object getIdentifier()
Description copied from interface: Component
Returns the identifier for this component. Every component may have an identifier. Identifiers are provided as a convenience to the application developer, and are not used internally in any manner.

Specified by:
getIdentifier in interface Component
Returns:
The identifier for this component.

getListenerList

public EventListenerList getListenerList()
Specified by:
getListenerList in interface Component

getLocale

public java.util.Locale getLocale()
Description copied from interface: Component
Returns the locale of the component. If the component does not have a locale, its ancestors will be queried for a locale. If no ancestors have locales set, the application instance's locale will be returned. If the component is not registered, the active application instance's will be returned.

Specified by:
getLocale in interface Component
Returns:
The locale for this component.

getParent

public Component getParent()
Description copied from interface: Component
Returns the parent component.

Specified by:
getParent in interface Component
Returns:
The parent component.

indexOf

public int indexOf(Component c)
Description copied from interface: Component
Returns the index of the specified component if it a child of this Component, or -1 if it is not.

Specified by:
indexOf in interface Component
Parameters:
c - The component to determine the index of.
Returns:
The index of the specified component.

init

public void init()
Specified by:
init in interface Component

isAncestorOf

public boolean isAncestorOf(Component c)
Description copied from interface: Component
Determines if this component is an ancestor of the specified component.

Specified by:
isAncestorOf in interface Component
Parameters:
c - The component to test for ancestry.
Returns:
true If this component is an ancestor of the specified component.

isEnabled

public boolean isEnabled()
Description copied from interface: Component
Returns true if the component is enabled.

Specified by:
isEnabled in interface Component
Returns:
True if the component is enabled.

isFocused

public boolean isFocused()
Description copied from interface: Component
Returns true if the component is focused.

Specified by:
isFocused in interface Component
Returns:
True if the component is focused.

isRecursivelyVisible

public boolean isRecursivelyVisible()
Specified by:
isRecursivelyVisible in interface Component

isRegistered

public boolean isRegistered()
Description copied from interface: Component
Returns true if the component is registered to an application.

Specified by:
isRegistered in interface Component
Returns:
True if the component is registered to an application.

isShowing

public boolean isShowing()
Description copied from interface: Component
Returns true if the component is registered and all of its ancestors are visible.

Specified by:
isShowing in interface Component
Returns:
True if the component is registered and all of its ancestors are visible.

isVisible

public boolean isVisible()
Description copied from interface: Component
Returns the component's visibility state.

Specified by:
isVisible in interface Component
Returns:
The component's visibility state.

processHierarchyEvent

public void processHierarchyEvent(long changeFlags,
                                  Component changed,
                                  Component changedParent)
Specified by:
processHierarchyEvent in interface Component

isInitialized

public boolean isInitialized()

setInitialized

public void setInitialized(boolean initialized)

removeHierarchyListener

public void removeHierarchyListener(HierarchyListener l)
Description copied from interface: Component
Removes a hierarchy listener from being notified when this component's state in the hierarchy changes.

Specified by:
removeHierarchyListener in interface Component
Parameters:
l - The HierarchyListener to remove.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Component
Removes a property change listener from this component.

Specified by:
removePropertyChangeListener in interface Component
Parameters:
l - The listener to be removed.

getBackground

public Color getBackground()
Description copied from interface: Component
Returns the background color of the component.

Specified by:
getBackground in interface Component
Returns:
The background color of the component.

getForeground

public Color getForeground()
Description copied from interface: Component
Returns the foreground of the component.

Specified by:
getForeground in interface Component
Returns:
The foreground of the component.

setBackground

public void setBackground(Color newValue)
Description copied from interface: Component
Sets the background color of the component.

Specified by:
setBackground in interface Component
Parameters:
newValue - The new background color of the component.

setForeground

public void setForeground(Color newValue)
Description copied from interface: Component
Sets the foreground color of the component.

Specified by:
setForeground in interface Component
Parameters:
newValue - The new foreground color of the component.

setClientId

public void setClientId(java.lang.String reusableId)
Description copied from interface: Component

Sets the reuseable Id, this is used to keep component peer id constant over show/hide cycles. Do not call from your application code !

Specified by:
setClientId in interface Component

setEnabled

public void setEnabled(boolean newValue)
Description copied from interface: Component
Sets whether the component is enabled.

Specified by:
setEnabled in interface Component
Parameters:
newValue - True if the component is enabled.

setFocused

public void setFocused(boolean newValue)
Description copied from interface: Component
Sets whether the component is focused.

Specified by:
setFocused in interface Component
Parameters:
newValue - True if the component is to be focused.

setFont

public void setFont(Font font)
Description copied from interface: Component
Sets the font of the component.

Specified by:
setFont in interface Component
Parameters:
font - The new font of the component.

setIdentifier

public void setIdentifier(java.lang.Object newValue)
Description copied from interface: Component
Sets the identifier for this component. Every component may have an identifier. Identifiers are provided as a convenience to the application developer, and are not used internally in any manner.

Specified by:
setIdentifier in interface Component
Parameters:
newValue - The new identifier for this component.

setLocale

public void setLocale(java.util.Locale newValue)
Description copied from interface: Component
Sets the locale of the component.

Specified by:
setLocale in interface Component
Parameters:
newValue - The new locale for the component.

setParent

public void setParent(Component parent)
Specified by:
setParent in interface Component

setRegistered

public void setRegistered(boolean b)
Specified by:
setRegistered in interface Component

setVisible

public void setVisible(boolean newValue)
Description copied from interface: Component
Sets the component visible or invisible.

Specified by:
setVisible in interface Component
Parameters:
newValue - The new visibility state of the component.

update

public void update()
Description copied from interface: Component
Forces the component to be re-rendered immediately. Fires a property change event indicating that any/all properties of the Component changed, forcing the container to re-render it.

Specified by:
update in interface Component

superApplyStyle

public void superApplyStyle(Style style)

superRemove

public void superRemove(Component c)

remove

public void remove(int n)
Description copied from interface: Component
Removes the component at the given index.

Specified by:
remove in interface Component
Parameters:
n - The index of the child component to remove.

removeAll

public void removeAll()
Description copied from interface: Component
Removes all child Components.

Specified by:
removeAll in interface Component

getInstancePeer

public InstancePeer getInstancePeer()
Description copied from interface: ComponentPeer
Returns the InstancePeer with which this peer is associated. If the peer is unregistered, null will be returned.

Specified by:
getInstancePeer in interface ComponentPeer
Returns:
The InstancePeer with which this peer is associated.

addAncillaryService

public void addAncillaryService(Service service)
ComponentPeer implementation

Specified by:
addAncillaryService in interface ComponentPeer
Parameters:
service - The ancillary service to be added.

generateId

public Id generateId()
Specified by:
generateId in interface ComponentPeer

getComponent

public Component getComponent()
Description copied from interface: ComponentPeer
Returns the component that is handled by this peer.

Specified by:
getComponent in interface ComponentPeer
Returns:
The component that is handled by this peer.

getFocusedElementId

public java.lang.String getFocusedElementId()
Specified by:
getFocusedElementId in interface ComponentPeer

getId

public Id getId()
Description copied from interface: ComponentPeer
Returns the Id by which this peer is identified on the client.

Specified by:
getId in interface ComponentPeer
Returns:
The Id by which this peer is identified on the client.

getPeer

public ComponentPeer getPeer(Component component)
Description copied from interface: ComponentPeer
Returns the peer of the specified component.

Specified by:
getPeer in interface ComponentPeer
Parameters:
component - The component whose peer is to be returned.
Returns:
The peer of the specified component.

redraw

public void redraw()
Description copied from interface: ComponentPeer
Requests that the component be redrawn on the client.

Specified by:
redraw in interface ComponentPeer

registerAncillaryServices

public void registerAncillaryServices()
Specified by:
registerAncillaryServices in interface ComponentPeer

removeAncillaryService

public void removeAncillaryService(Service service)
Description copied from interface: ComponentPeer
Removes an ancillary service from this ComponentPeer. Ancillary services will be registered for the life of the ComponentPeer and automatically removed when it is unregistered. An ancillary service should be used by ONLY one peer, as the peer will register and unregister it from the ServiceRegistry as required.

Specified by:
removeAncillaryService in interface ComponentPeer
Parameters:
service - The ancillary service to be removed.

setComponent

public void setComponent(Component c)
Specified by:
setComponent in interface ComponentPeer

setId

public void setId(Id generateId)
Specified by:
setId in interface ComponentPeer

setInstancePeer

public void setInstancePeer(InstancePeer instancePeer)
Specified by:
setInstancePeer in interface ComponentPeer

unregisterAncillaryServices

public void unregisterAncillaryServices()
Specified by:
unregisterAncillaryServices in interface ComponentPeer

getParentComponentPeer

public ComponentPeer getParentComponentPeer()
Description copied from interface: ComponentPeer
Returns the peer of the associated component's component.

Specified by:
getParentComponentPeer in interface ComponentPeer
Returns:
The peer of the associated component's component.

getCalculatedBackground

public Color getCalculatedBackground()
Description copied from interface: ComponentPeer
Returns the background color in which the component will be rendered. The color will be determined by examining the represented component and then its ancestors until a background color can be determined.

Specified by:
getCalculatedBackground in interface ComponentPeer
Returns:
The background color in which the component will be rendered.

getCalculatedFont

public Font getCalculatedFont()
Description copied from interface: ComponentPeer
Returns the font in which the component will be rendered. The font will be determined by examining the represented component and then its ancestors until a font can be determined.

Specified by:
getCalculatedFont in interface ComponentPeer
Returns:
The font in which the component will be rendered.

getCalculatedForeground

public Color getCalculatedForeground()
Description copied from interface: ComponentPeer
Returns the foreground color in which the component will be rendered. The color will be determined by examining the represented component and then its ancestors until a foreground color can be determined.

Specified by:
getCalculatedForeground in interface ComponentPeer
Returns:
The foreground color in which the component will be rendered.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

registered

public void registered()
Description copied from interface: ComponentPeer
Called when the component is registered. This method should be overridden if necessary.

Specified by:
registered in interface ComponentPeer

unregistered

public void unregistered()
Description copied from interface: ComponentPeer
Called when the component is unregistered. This method should be overridden if necessary.

Specified by:
unregistered in interface ComponentPeer

render

public void render(RenderingContext rc,
                   Element parent)
Description copied from interface: ComponentPeer
A method that should be overridden for the ComponentPeer to produce HTML output.

Specified by:
render in interface ComponentPeer
Parameters:
rc - A rendering context provided by the Connection.
parent - The element that will contain content rendered by this ComponentPeer.

isSelectableForScriptRecorder

public boolean isSelectableForScriptRecorder()
Specified by:
isSelectableForScriptRecorder in interface Component

setSelectableForScriptRecorder

public void setSelectableForScriptRecorder(boolean b)
Specified by:
setSelectableForScriptRecorder in interface Component

setCssClass

public void setCssClass(java.lang.String cssClass)

getCssClass

public java.lang.String getCssClass()