Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2011-2018 PrimeFaces Extensions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.extensions.component.sheet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.application.FacesMessage;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.FacesEvent;
import org.apache.commons.lang3.StringUtils;
import org.primefaces.component.api.Widget;
import org.primefaces.context.RequestContext;
import org.primefaces.extensions.event.SheetEvent;
import org.primefaces.extensions.model.sheet.SheetRowColIndex;
import org.primefaces.extensions.model.sheet.SheetUpdate;
import org.primefaces.extensions.util.JavascriptVarBuilder;
import org.primefaces.model.BeanPropertyComparator;
import org.primefaces.model.SortOrder;
import org.primefaces.util.ComponentUtils;
import org.primefaces.util.Constants;
/**
* Spreadsheet component wrappering the Handsontable jQuery UI component.
*
* @author Mark Lassiter / Melloware
* @since 6.2
*/
@ResourceDependencies({@ResourceDependency(library = "primefaces", name = "components.css"),
@ResourceDependency(library = "primefaces", name = "jquery/jquery.js"),
@ResourceDependency(library = "primefaces", name = "core.js"),
@ResourceDependency(library = "primefaces", name = "components.js"),
@ResourceDependency(library = "primefaces-extensions", target = "head", name = "sheet/sheet.css"),
@ResourceDependency(library = "primefaces-extensions", name = "sheet/sheet.js")})
public class Sheet extends UIInput implements ClientBehaviorHolder, EditableValueHolder, Widget {
public static final String EVENT_CELL_SELECT = "cellSelect";
public static final String EVENT_CHANGE = "change";
public static final String EVENT_SORT = "sort";
public static final String EVENT_FILTER = "filter";
public static final String EVENT_COLUMN_SELECT = "columnSelect";
public static final String EVENT_ROW_SELECT = "rowSelect";
public static final String COMPONENT_TYPE = "org.primefaces.extensions.component.Sheet";
public static final String COMPONENT_FAMILY = "org.primefaces.extensions.component";
private static final String DEFAULT_RENDERER = "org.primefaces.extensions.component.SheetRenderer";
private static final Collection EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(EVENT_CHANGE,
EVENT_CELL_SELECT, EVENT_SORT, EVENT_FILTER, EVENT_COLUMN_SELECT, EVENT_ROW_SELECT));
/**
* Properties that are tracked by state saving.
*/
enum PropertyKeys {
/**
* The local value of this {@link UIComponent}.
*/
value,
/**
* List to keep the filtered and sorted data.
*/
filteredValue,
/**
* Flag indicating whether or not this component is valid.
*/
valid,
/**
* The request scope attribute under which the data object for the current row will be exposed when iterating.
*/
var,
/**
* The IL8N Locale. Default is en-US.
*/
locale,
/**
* The selected row
*/
selectedRow,
/**
* The last selected row
*/
selectedLastRow,
/**
* The selected column
*/
selectedColumn,
/**
* The last selected column
*/
selectedLastColumn,
/**
* flag indication whether or not to show column headers
*/
showColumnHeaders,
/**
* flag indication whether or not to show row headers
*/
showRowHeaders,
/**
* The custom row header to be used in place of the standard numeric header value
*/
rowHeader,
/**
* Maximum number of rows.
*/
maxRows,
/**
* Minimum number of rows.
*/
minRows,
/**
* Maximum number of columns.
*/
maxCols,
/**
* Minimum number of columns.
*/
minCols,
/**
* Fixed rows when scrolling
*/
fixedRows,
/**
* You can fix the bottom rows of the table, by using the fixedRowsBottom config option. This way, when you're scrolling the table, the fixed rows will
* stay at the bottom edge of the table's container.
*/
fixedRowsBottom,
/**
* Fixed columns when scrolling
*/
fixedCols,
/**
* Allow rows to be manually resizable
*/
resizableRows,
/**
* Allow columns to be resizable
*/
resizableCols,
/**
* Allow rows to be manually moved
*/
movableRows,
/**
* Allow columns to be manually moved
*/
movableCols,
/**
* The width of the component in pixels
*/
width,
/**
* The height of the component in pixels
*/
height,
/**
* The global error message to be displayed when the sheet is in error
*/
errorMessage,
/**
* Style of the html container element
*/
style,
/**
* User style class for sheet
*/
styleClass,
/**
* The row key, used to unqiuely identify each row for update operations
*/
rowKey,
/**
* The current sortBy value expression
*/
sortBy,
/**
* The current direction of the sort
*/
sortOrder,
/**
* Defines where the null values are placed in ascending sort order. Default value is "1" meaning null values are placed at the end in ascending mode
* and at beginning in descending mode. Set to "-1" for the opposite behavior.
*/
nullSortOrder,
/**
* Case sensitivity for sorting, insensitive by default.
*/
caseSensitiveSort,
/**
* The original sortBy value expression saved off for reset
*/
origSortBy,
/**
* The original sort direction saved off for reset
*/
origSortOrder,
/**
* The Handsontable stretchH value
*/
stretchH,
/**
* The style class to apply to each row in the sheet (EL expression)
*/
rowStyleClass,
/**
* Flag indicating whether or not the sheet is read only
*/
readOnly,
/**
* The message displayed when no records are found
*/
emptyMessage,
/**
* Active Header style class
*/
activeHeaderStyleClass,
/**
* Commented cell style class
*/
commentedCellStyleClass,
/**
* Current column style class
*/
currentColStyleClass,
/**
* Current header style class
*/
currentHeaderStyleClass,
/**
* Current row style class
*/
currentRowStyleClass,
/**
* Invalid cell style class
*/
invalidCellStyleClass,
/**
* No Word Wrap style class
*/
noWordWrapStyleClass,
/**
* Placeholder style class
*/
placeholderCellStyleClass,
/**
* Read only style class
*/
readOnlyCellStyleClass,
/**
* Name of javascript function to extend the options of the underlying Handsontable plugin.
*/
extender
}
/**
* The list of UI Columns
*/
private List columns;
/**
* List of invalid updates
*/
private List invalidUpdates;
/**
* Map of submitted values by row index and column index
*/
private Map submittedValues = new HashMap<>();
/**
* Map of local values by row index and column index
*/
private Map localValues = new HashMap<>();
/**
* The selection data
*/
private String selection;
/**
* The id of the focused filter input if any
*/
private String focusId;
/**
* Transient list of sheet updates that can be accessed after a successful model update.
*/
private final List updates = new ArrayList<>();
/**
* Maps a visible, rendered column index to the actual column based on whether or not the column is rendered. Updated on encode, and used on decode. Saved
* in the component state.
*/
private Map columnMapping;
/**
* Map by row keys for values found in list
*/
private Map rowMap;
/**
* Map by row keys for row number
*/
private Map rowNumbers;
/**
* Default constructor
*/
public Sheet() {
setRendererType(DEFAULT_RENDERER);
}
@Override
public String getFamily() {
return COMPONENT_FAMILY;
}
/**
* {@inheritDoc}
*/
@Override
public Collection getEventNames() {
return EVENT_NAMES;
}
@Override
public String getDefaultEventName() {
return EVENT_CHANGE;
}
/**
* {@inheritDoc}
*/
@Override
public String resolveWidgetVar() {
return ComponentUtils.resolveWidgetVar(getFacesContext(), this);
}
/**
* {@inheritDoc}
*/
@Override
public void queueEvent(final FacesEvent event) {
final FacesContext fc = FacesContext.getCurrentInstance();
if (isSelfRequest(fc) && event instanceof AjaxBehaviorEvent) {
final AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;
final SheetEvent sheetEvent = new SheetEvent(this, behaviorEvent.getBehavior());
sheetEvent.setPhaseId(event.getPhaseId());
super.queueEvent(sheetEvent);
return;
}
super.queueEvent(event);
}
private boolean isSelfRequest(final FacesContext context) {
return this.getClientId(context).equals(context.getExternalContext().getRequestParameterMap()
.get(Constants.RequestParams.PARTIAL_SOURCE_PARAM));
}
public void setStyleClass(final String styleClass) {
getStateHelper().put(PropertyKeys.styleClass, styleClass);
}
public String getStyleClass() {
final Object result = getStateHelper().eval(PropertyKeys.styleClass, null);
if (result == null) {
return null;
}
return result.toString();
}
public void setStretchH(final String value) {
getStateHelper().put(PropertyKeys.stretchH, value);
}
public String getStretchH() {
final Object result = getStateHelper().eval(PropertyKeys.stretchH, null);
if (result == null) {
return null;
}
return result.toString();
}
public void setEmptyMessage(final String value) {
getStateHelper().put(PropertyKeys.emptyMessage, value);
}
public String getEmptyMessage() {
final Object result = getStateHelper().eval(PropertyKeys.emptyMessage, null);
if (result == null) {
return null;
}
return result.toString();
}
public void setShowColumnHeaders(final Boolean value) {
getStateHelper().put(PropertyKeys.showColumnHeaders, value);
}
public Boolean isShowColumnHeaders() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.showColumnHeaders, true).toString());
}
public void setShowRowHeaders(final Boolean value) {
getStateHelper().put(PropertyKeys.showRowHeaders, value);
}
public Boolean isShowRowHeaders() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.showRowHeaders, true).toString());
}
public void setResizableRows(final Boolean value) {
getStateHelper().put(PropertyKeys.resizableRows, value);
}
public Boolean isResizableRows() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.resizableRows, false).toString());
}
public void setResizableCols(final Boolean value) {
getStateHelper().put(PropertyKeys.resizableCols, value);
}
public Boolean isResizableCols() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.resizableCols, false).toString());
}
public void setMovableRows(final Boolean value) {
getStateHelper().put(PropertyKeys.movableRows, value);
}
public Boolean isMovableRows() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.movableRows, false).toString());
}
public void setMovableCols(final Boolean value) {
getStateHelper().put(PropertyKeys.movableCols, value);
}
public Boolean isMovableCols() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.movableCols, false).toString());
}
public void setRowStyleClass(final String styleClass) {
getStateHelper().put(PropertyKeys.rowStyleClass, styleClass);
}
public String getRowStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.rowStyleClass, null);
}
public String getActiveHeaderStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.activeHeaderStyleClass, null);
}
public void setReadOnly(final Boolean value) {
getStateHelper().put(PropertyKeys.readOnly, value);
}
public Boolean isReadOnly() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.readOnly, Boolean.FALSE).toString());
}
public void setActiveHeaderStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.activeHeaderStyleClass, _value);
}
public String getCommentedCellStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.commentedCellStyleClass, null);
}
public void setCommentedCellStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.commentedCellStyleClass, _value);
}
public String getCurrentColStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.currentColStyleClass, null);
}
public void setCurrentColStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.currentColStyleClass, _value);
}
public String getCurrentHeaderStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.currentHeaderStyleClass, null);
}
public void setCurrentHeaderStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.currentHeaderStyleClass, _value);
}
public String getCurrentRowStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.currentRowStyleClass, null);
}
public void setCurrentRowStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.currentRowStyleClass, _value);
}
public String getInvalidCellStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.invalidCellStyleClass, null);
}
public void setInvalidCellStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.invalidCellStyleClass, _value);
}
public String getNoWordWrapStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.noWordWrapStyleClass, null);
}
public void setNoWordWrapStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.noWordWrapStyleClass, _value);
}
public String getPlaceholderCellStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.placeholderCellStyleClass, null);
}
public void setPlaceholderCellStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.placeholderCellStyleClass, _value);
}
public String getReadOnlyCellStyleClass() {
return (String) getStateHelper().eval(PropertyKeys.placeholderCellStyleClass, null);
}
public void setReadOnlyCellStyleClass(final String _value) {
getStateHelper().put(PropertyKeys.readOnlyCellStyleClass, _value);
}
public String getExtender() {
return (String) getStateHelper().eval(PropertyKeys.extender, null);
}
public void setExtender(final String _extender) {
getStateHelper().put(PropertyKeys.extender, _extender);
}
public void setCaseSensitiveSort(final Boolean value) {
getStateHelper().put(PropertyKeys.caseSensitiveSort, value);
}
public Boolean isCaseSensitiveSort() {
return Boolean.valueOf(getStateHelper().eval(PropertyKeys.caseSensitiveSort, Boolean.FALSE).toString());
}
public Integer getNullSortOrder() {
return (Integer) getStateHelper().eval(PropertyKeys.nullSortOrder, Integer.valueOf(1));
}
public void setNullSortOrder(final Integer value) {
getStateHelper().put(PropertyKeys.nullSortOrder, value);
}
/**
* The list of child columns.
*
* @return
*/
public List getColumns() {
if (columns == null) {
columns = new ArrayList<>();
getColumns(this);
}
return columns;
}
/**
* Grabs the UIColumn children for the parent specified.
*
* @param parent
*/
private void getColumns(final UIComponent parent) {
for (final UIComponent child : parent.getChildren()) {
if (child instanceof SheetColumn) {
columns.add((SheetColumn) child);
}
}
}
/**
* Updates the list of child columns.
*
* @param columns
*/
public void setColumns(final List columns) {
this.columns = columns;
}
public void setMaxRows(final Integer value) {
getStateHelper().put(PropertyKeys.maxRows, value);
}
public Integer getMaxRows() {
final Object result = getStateHelper().eval(PropertyKeys.maxRows, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
public void setMinRows(final Integer value) {
getStateHelper().put(PropertyKeys.minRows, value);
}
public Integer getMinRows() {
return (Integer) getStateHelper().eval(PropertyKeys.minRows, Integer.valueOf(0));
}
public void setMaxCols(final Integer value) {
getStateHelper().put(PropertyKeys.maxCols, value);
}
public Integer getMaxCols() {
final Object result = getStateHelper().eval(PropertyKeys.maxCols, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
public void setMinCols(final Integer value) {
getStateHelper().put(PropertyKeys.minCols, value);
}
public Integer getMinCols() {
return (Integer) getStateHelper().eval(PropertyKeys.minCols, Integer.valueOf(0));
}
public void setFixedRows(final Integer value) {
getStateHelper().put(PropertyKeys.fixedRows, value);
}
public Integer getFixedRows() {
final Object result = getStateHelper().eval(PropertyKeys.fixedRows, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
public void setFixedRowsBottom(final Integer value) {
getStateHelper().put(PropertyKeys.fixedRowsBottom, value);
}
public Integer getFixedRowsBottom() {
final Object result = getStateHelper().eval(PropertyKeys.fixedRowsBottom, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
public void setFixedCols(final Integer value) {
getStateHelper().put(PropertyKeys.fixedCols, value);
}
public Integer getFixedCols() {
final Object result = getStateHelper().eval(PropertyKeys.fixedCols, null);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
public String getLocale() {
return (String) getStateHelper().eval(PropertyKeys.locale, "en-US");
}
public void setLocale(final String locale) {
getStateHelper().put(PropertyKeys.locale, locale);
}
/**
* The list of invalid updates
*
* @return List
*/
public List getInvalidUpdates() {
if (invalidUpdates == null) {
invalidUpdates = new ArrayList<>();
}
return invalidUpdates;
}
/**
* Resets the submitted values
*/
public void resetSubmitted() {
submittedValues.clear();
updates.clear();
}
/**
* Resets the sorting to the originally specified values (if any)
*/
public void resetSort() {
final ValueExpression origSortBy = (ValueExpression) getStateHelper().get(PropertyKeys.origSortBy);
// Set sort by even if null to restore to initial sort order.
setSortByValueExpression(origSortBy);
final String origSortOrder = (String) getStateHelper().get(PropertyKeys.origSortOrder);
if (origSortOrder != null) {
setSortOrder(origSortOrder);
}
}
/**
* Resets invalid updates
*/
public void resetInvalidUpdates() {
getInvalidUpdates().clear();
}
/**
* Resets all filters, sorting and submitted values.
*/
public void reset() {
resetSubmitted();
resetSort();
resetInvalidUpdates();
localValues.clear();
for (final SheetColumn c : getColumns()) {
c.setFilterValue(null);
}
}
/**
* Updates a submitted value.
*
* @param row
* @param col
* @param value
*/
public void setSubmittedValue(final FacesContext context, final String rowKey, final int col, final String value) {
submittedValues.put(new SheetRowColIndex(rowKey, col), value);
}
/**
* Retrieves the submitted value for the row and col.
*
* @param row
* @param col
* @return
*/
public String getSubmittedValue(final String rowKey, final int col) {
return submittedValues.get(new SheetRowColIndex(rowKey, col));
}
/**
* Updates a local value.
*
* @param rowKey
* @param col
* @param value
*/
public void setLocalValue(final String rowKey, final int col, final Object value) {
localValues.put(new SheetRowColIndex(rowKey, col), value);
}
/**
* Retrieves the submitted value for the rowKey and col.
*
* @param row
* @param col
* @return
*/
public Object getLocalValue(final String rowKey, final int col) {
return localValues.get(new SheetRowColIndex(rowKey, col));
}
/**
* Updates the row var for iterations over the list. The var value will be updated to the value for the specified rowKey.
*
* @param context the FacesContext against which to the row var is set. Passed for performance
* @param rowKey the rowKey string
*/
public void setRowVar(final FacesContext context, final String rowKey) {
if (context == null) {
return;
}
if (rowKey == null) {
context.getExternalContext().getRequestMap().remove(getVar());
}
else {
final Object value = getRowMap().get(rowKey);
context.getExternalContext().getRequestMap().put(getVar(), value);
}
}
protected Map getRowMap() {
if (rowMap == null || rowMap.isEmpty()) {
remapRows();
}
return rowMap;
}
/**
* Gets the object value of the row and col specified. If a local value exists, that is returned, otherwise the actual value is return.
*
* @param context
* @param rowKey
* @param col
* @return
*/
public Object getValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a local value, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (localValues.containsKey(index)) {
return localValues.get(index);
}
setRowVar(context, rowKey);
final SheetColumn column = getColumns().get(col);
return column.getValueExpression("value").getValue(context.getELContext());
}
/**
* Gets the render string for the value the given cell. Applys the available converters to convert the value.
*
* @param context
* @param rowKey
* @param col
* @return
*/
public String getRenderValueForCell(final FacesContext context, final String rowKey, final int col) {
// if we have a submitted value still, use it
// note: can't check for null, as null may be the submitted value
final SheetRowColIndex index = new SheetRowColIndex(rowKey, col);
if (submittedValues.containsKey(index)) {
return submittedValues.get(index);
}
final Object value = getValueForCell(context, rowKey, col);
if (value == null) {
return null;
}
final SheetColumn column = getColumns().get(col);
final Converter converter = ComponentUtils.getConverter(context, column);
if (converter == null) {
return value.toString();
}
else {
return converter.getAsString(context, this, value);
}
}
/**
* The currently selected column.
*
* @return
*/
public Integer getSelectedColumn() {
final Object result = getStateHelper().eval(PropertyKeys.selectedColumn);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
/**
* Updates the selected column.
*
* @param col
*/
public void setSelectedColumn(final Integer col) {
getStateHelper().put(PropertyKeys.selectedColumn, col);
}
/**
* The currently selected column.
*
* @return
*/
public Integer getSelectedLastColumn() {
final Object result = getStateHelper().eval(PropertyKeys.selectedLastColumn);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
/**
* Updates the selected column.
*
* @param col
*/
public void setSelectedLastColumn(final Integer col) {
getStateHelper().put(PropertyKeys.selectedLastColumn, col);
}
/**
* The currently selected row.
*
* @return
*/
public Integer getSelectedRow() {
final Object result = getStateHelper().eval(PropertyKeys.selectedRow);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
/**
* The currently selected row.
*
* @return
*/
public Integer getSelectedLastRow() {
final Object result = getStateHelper().eval(PropertyKeys.selectedLastRow);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
}
/**
* Updates the selected row.
*
* @param row
*/
public void setSelectedRow(final Integer row) {
getStateHelper().put(PropertyKeys.selectedRow, row);
}
/**
* Updates the selected row.
*
* @param row
*/
public void setSelectedLastRow(final Integer row) {
getStateHelper().put(PropertyKeys.selectedLastRow, row);
}
/**
* The width of the sheet in pixels
*
* @return
*/
public Integer getWidth() {
final Object result = getStateHelper().eval(PropertyKeys.width);
if (result == null) {
return null;
}
// this will handle any type so long as its convertable to integer
return Integer.valueOf(result.toString());
}
/**
* Updates the width
*
* @param row
*/
public void setWidth(final Integer value) {
getStateHelper().put(PropertyKeys.width, value);
}
/**
* The height of the sheet. Note this is applied to the inner div which is why it is recommend you use this property instead of a style class.
*
* @return
*/
public Integer getHeight() {
final Object result = getStateHelper().eval(PropertyKeys.height);
if (result == null) {
return null;
}
// this will handle any type so long as its convertable to integer
return Integer.valueOf(result.toString());
}
/**
* Updates the height
*
* @param row
*/
public void setHeight(final Integer value) {
getStateHelper().put(PropertyKeys.height, value);
}
/**
* Return the value of the Sheet. This value must be a java.util.List value at this time.
*/
@Override
public Object getValue() {
return getStateHelper().eval(PropertyKeys.value);
}
/**
* Holds the filtered and sorted List of values.
*
* @return a List of sorted and filtered values
*/
public java.util.List getFilteredValue() {
return (java.util.List) getStateHelper().eval(PropertyKeys.filteredValue, new ArrayList());
}
/**
* Sets the filtered list.
*
* @param _filteredValue the List to store
*/
public void setFilteredValue(final java.util.List _filteredValue) {
getStateHelper().put(PropertyKeys.filteredValue, _filteredValue);
}
/**
* Set the value of the Sheet. This value must be a java.util.List at this time.
*
* @param value the new value
*/
@Override
public void setValue(final Object value) {
getStateHelper().put(PropertyKeys.value, value);
}
/**
* Update the style value for the component
*
* @param value
*/
public void setStyle(final String value) {
getStateHelper().put(PropertyKeys.style, value);
}
/**
* The style value
*
* @return the style value
*/
public String getStyle() {
final Object result = getStateHelper().eval(PropertyKeys.style, null);
if (result == null) {
return null;
}
return result.toString();
}
/**
* Gets the rowHeader value expression defined
*
* @return a value expression for Row Header or null if the expression is not set
*/
protected ValueExpression getRowHeaderValueExpression() {
return getValueExpression(PropertyKeys.rowHeader.name());
}
/**
* Gets the row header text value as a string for use in javascript
*
* @param context
* @return
*/
protected String getRowHeaderValueAsString(final FacesContext context) {
final ValueExpression veRowHeader = getRowHeaderValueExpression();
final Object value = veRowHeader.getValue(context.getELContext());
if (value == null) {
return StringUtils.EMPTY;
}
else {
return value.toString();
}
}
/**
* The sorted list of values.
*
* @return
*/
public List