com.vaadin.client.widget.escalator
Interface ColumnConfiguration


public interface ColumnConfiguration

A representation of the columns in an instance of Escalator.

Since:
7.4
Author:
Vaadin Ltd
See Also:
Escalator#getColumnConfiguration()

Method Summary
 int getColumnCount()
          Returns the number of columns in the escalator.
 double getColumnWidth(int index)
          Returns the user-defined width of a column.
 double getColumnWidthActual(int index)
          Returns the actual width of a column.
 int getFrozenColumnCount()
          Get the number of leftmost columns that are not affected by horizontal scrolling.
 void insertColumns(int index, int numberOfColumns)
          Adds columns at a certain index.
 void refreshColumns(int index, int numberOfColumns)
          Refreshes a range of rows in the current row containers in each Escalator section.
 void removeColumns(int index, int numberOfColumns)
          Removes columns at certain indices.
 void setColumnWidth(int index, double px)
          Sets (or unsets) an explicit width for a column.
 void setColumnWidths(java.util.Map<java.lang.Integer,java.lang.Double> indexWidthMap)
          Sets widths for a set of columns.
 void setFrozenColumnCount(int count)
          Sets the number of leftmost columns that are not affected by horizontal scrolling.
 

Method Detail

removeColumns

void removeColumns(int index,
                   int numberOfColumns)
                   throws java.lang.IndexOutOfBoundsException,
                          java.lang.IllegalArgumentException
Removes columns at certain indices.

If any of the removed columns were frozen, the number of frozen columns will be reduced by the number of the removed columns that were frozen.

Note: This method simply removes the given columns, and does not do much of anything else. Especially if you have column spans, you probably need to run refreshColumns(int, int) or RowContainer.refreshRows(int, int)

Parameters:
index - the index of the first column to be removed
numberOfColumns - the number of rows to remove, starting from index
Throws:
java.lang.IndexOutOfBoundsException - if the entire range of removed columns is not currently present in the escalator
java.lang.IllegalArgumentException - if numberOfColumns is less than 1.

insertColumns

void insertColumns(int index,
                   int numberOfColumns)
                   throws java.lang.IndexOutOfBoundsException,
                          java.lang.IllegalArgumentException
Adds columns at a certain index.

The new columns will be inserted between the column at the index, and the column before (an index of 0 means that the columns are inserted at the beginning). Therefore, the columns at the index and afterwards will be moved to the right.

The contents of the inserted columns will be queried from the respective cell renderers in the header, body and footer.

If there are frozen columns and the first added column is to the left of the last frozen column, the number of frozen columns will be increased by the number of inserted columns.

Note: Only the contents of the inserted columns will be rendered. If inserting new columns affects the contents of existing columns (e.g. you have column spans), RowContainer.refreshRows(int, int) or refreshColumns(int, int) needs to be called as appropriate.

Parameters:
index - the index of the column before which new columns are inserted, or getColumnCount() to add new columns at the end
numberOfColumns - the number of columns to insert after the index
Throws:
java.lang.IndexOutOfBoundsException - if index is not an integer in the range [0..getColumnCount()]
java.lang.IllegalArgumentException - if numberOfColumns is less than 1.

getColumnCount

int getColumnCount()
Returns the number of columns in the escalator.

Returns:
the number of columns in the escalator

setFrozenColumnCount

void setFrozenColumnCount(int count)
                          throws java.lang.IllegalArgumentException
Sets the number of leftmost columns that are not affected by horizontal scrolling.

Parameters:
count - the number of columns to freeze
Throws:
java.lang.IllegalArgumentException - if the column count is < 0 or > the number of columns

getFrozenColumnCount

int getFrozenColumnCount()
Get the number of leftmost columns that are not affected by horizontal scrolling.

Returns:
the number of frozen columns

setColumnWidth

void setColumnWidth(int index,
                    double px)
                    throws java.lang.IllegalArgumentException
Sets (or unsets) an explicit width for a column.

Parameters:
index - the index of the column for which to set a width
px - the number of pixels the indicated column should be, or a negative number to let the escalator decide
Throws:
java.lang.IllegalArgumentException - if index is not a valid column index

getColumnWidth

double getColumnWidth(int index)
                      throws java.lang.IllegalArgumentException
Returns the user-defined width of a column.

Parameters:
index - the index of the column for which to retrieve the width
Returns:
the column's width in pixels, or a negative number if the width is implicitly decided by the escalator
Throws:
java.lang.IllegalArgumentException - if index is not a valid column index

setColumnWidths

void setColumnWidths(java.util.Map<java.lang.Integer,java.lang.Double> indexWidthMap)
                     throws java.lang.IllegalArgumentException
Sets widths for a set of columns.

Parameters:
indexWidthMap - a map from column index to its respective width to be set. If the given width for a column index is negative, the column is resized-to-fit.
Throws:
java.lang.IllegalArgumentException - if indexWidthMap is null
java.lang.IllegalArgumentException - if any column index in indexWidthMap is invalid
java.lang.NullPointerException - If any value in the map is null

getColumnWidthActual

double getColumnWidthActual(int index)
                            throws java.lang.IllegalArgumentException
Returns the actual width of a column.

Parameters:
index - the index of the column for which to retrieve the width
Returns:
the column's actual width in pixels
Throws:
java.lang.IllegalArgumentException - if index is not a valid column index

refreshColumns

void refreshColumns(int index,
                    int numberOfColumns)
                    throws java.lang.IndexOutOfBoundsException,
                           java.lang.IllegalArgumentException
Refreshes a range of rows in the current row containers in each Escalator section.

The data for the refreshed columns is queried from the current cell renderer.

Parameters:
index - the index of the first row that will be updated
numberOfRows - the number of rows to update, starting from the index
Throws:
java.lang.IndexOutOfBoundsException - if any integer number in the range [index..(index+numberOfColumns)] is not an existing column index.
java.lang.IllegalArgumentException - if numberOfColumns is less than 1.
See Also:
RowContainer.setEscalatorUpdater(EscalatorUpdater), Escalator#getHeader(), Escalator#getBody(), Escalator#getFooter()


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.