com.vaadin.v7.client.widget.escalator.ColumnConfiguration Maven / Gradle / Ivy
Show all versions of vaadin-compatibility-client Show documentation
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* license.
*/
package com.vaadin.v7.client.widget.escalator;
import java.util.Map;
import com.vaadin.v7.client.widgets.Escalator;
/**
* A representation of the columns in an instance of {@link Escalator}.
*
* @since 7.4
* @author Vaadin Ltd
* @see Escalator#getColumnConfiguration()
*/
public interface ColumnConfiguration {
/**
* 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 {@link #refreshColumns(int, int)} or
* {@link RowContainer#refreshRows(int, int)}
*
* @param index
* the index of the first column to be removed
* @param numberOfColumns
* the number of rows to remove, starting from {@code index}
* @throws IndexOutOfBoundsException
* if the entire range of removed columns is not currently
* present in the escalator
* @throws IllegalArgumentException
* if numberOfColumns
is less than 1.
*/
public void removeColumns(int index, int numberOfColumns)
throws IndexOutOfBoundsException, 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),
* {@link RowContainer#refreshRows(int, int)} or
* {@link #refreshColumns(int, int)} needs to be called as appropriate.
*
* @param index
* the index of the column before which new columns are inserted,
* or {@link #getColumnCount()} to add new columns at the end
* @param numberOfColumns
* the number of columns to insert after the index
* @throws IndexOutOfBoundsException
* if index
is not an integer in the range
* [0..{@link #getColumnCount()}]
* @throws IllegalArgumentException
* if {@code numberOfColumns} is less than 1.
*/
public void insertColumns(int index, int numberOfColumns)
throws IndexOutOfBoundsException, IllegalArgumentException;
/**
* Returns the number of columns in the escalator.
*
* @return the number of columns in the escalator
*/
public int getColumnCount();
/**
* Sets the number of leftmost columns that are not affected by horizontal
* scrolling.
*
* @param count
* the number of columns to freeze
*
* @throws IllegalArgumentException
* if the column count is < 0 or > the number of columns
*
*/
public void setFrozenColumnCount(int count) throws IllegalArgumentException;
/**
* Get the number of leftmost columns that are not affected by horizontal
* scrolling.
*
* @return the number of frozen columns
*/
public int getFrozenColumnCount();
/**
* Sets (or unsets) an explicit width for a column.
*
* @param index
* the index of the column for which to set a width
* @param px
* the number of pixels the indicated column should be, or a
* negative number to let the escalator decide
* @throws IllegalArgumentException
* if index
is not a valid column index
*/
public void setColumnWidth(int index, double px)
throws IllegalArgumentException;
/**
* Returns the user-defined width of a column.
*
* @param index
* the index of the column for which to retrieve the width
* @return the column's width in pixels, or a negative number if the width
* is implicitly decided by the escalator
* @throws IllegalArgumentException
* if index
is not a valid column index
*/
public double getColumnWidth(int index) throws IllegalArgumentException;
/**
* Sets widths for a set of columns.
*
* @param 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 IllegalArgumentException
* if {@code indexWidthMap} is {@code null}
* @throws IllegalArgumentException
* if any column index in {@code indexWidthMap} is invalid
* @throws NullPointerException
* If any value in the map is null
*/
public void setColumnWidths(Map indexWidthMap)
throws IllegalArgumentException;
/**
* Returns the actual width of a column.
*
* @param index
* the index of the column for which to retrieve the width
* @return the column's actual width in pixels
* @throws IllegalArgumentException
* if index
is not a valid column index
*/
public double getColumnWidthActual(int index)
throws IllegalArgumentException;
/**
* Refreshes a range of columns in the current row containers in each
* Escalator section.
*
* The data for the refreshed columns is queried from the current cell
* renderer.
*
* @param index
* the index of the first columns that will be updated
* @param numberOfColumns
* the number of columns to update, starting from the index
* @throws IndexOutOfBoundsException
* if any integer number in the range
* [index..(index+numberOfColumns)]
is not an
* existing column index.
* @throws IllegalArgumentException
* if {@code numberOfColumns} is less than 1.
* @see RowContainer#setEscalatorUpdater(EscalatorUpdater)
* @see Escalator#getHeader()
* @see Escalator#getBody()
* @see Escalator#getFooter()
*/
public void refreshColumns(int index, int numberOfColumns)
throws IndexOutOfBoundsException, IllegalArgumentException;
}