java.lang.Object
javax.faces.component.UIComponent
javax.faces.component.UIComponentBase
javax.faces.component.UIOutput
javax.faces.component.UIInput
org.primefaces.extensions.component.sheet.Sheet
All Implemented Interfaces:
EventListener, javax.faces.component.behavior.ClientBehaviorHolder, javax.faces.component.EditableValueHolder, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.component.ValueHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder, org.primefaces.component.api.Widget

public class Sheet extends javax.faces.component.UIInput
Spreadsheet component wrappering the Handsontable jQuery UI component.
Since:
6.2
Author:
Mark Lassiter / Melloware
  • Field Details Link icon

  • Constructor Details Link icon

    • Sheet Link icon

      public Sheet()
  • Method Details Link icon

    • getFamily Link icon

      public String getFamily()
    • getEventNames Link icon

      public Collection<String> getEventNames()
      Specified by:
      getEventNames in interface javax.faces.component.behavior.ClientBehaviorHolder
      Overrides:
      getEventNames in class javax.faces.component.UIComponentBase
    • getDefaultEventName Link icon

      public String getDefaultEventName()
      Specified by:
      getDefaultEventName in interface javax.faces.component.behavior.ClientBehaviorHolder
      Overrides:
      getDefaultEventName in class javax.faces.component.UIComponentBase
    • queueEvent Link icon

      public void queueEvent(javax.faces.event.FacesEvent event)
      Overrides:
      queueEvent in class javax.faces.component.UIComponentBase
    • getColumns Link icon

      public List<SheetColumn> getColumns()
      The list of child columns.
    • getRenderedColumns Link icon

      public List<SheetColumn> getRenderedColumns()
      The list of rendered child columns.
    • setColumns Link icon

      public void setColumns(List<SheetColumn> columns)
      Updates the list of child columns.
    • getInvalidUpdates Link icon

      public List<SheetInvalidUpdate> getInvalidUpdates()
      The list of invalid updates
    • resetSubmitted Link icon

      public void resetSubmitted()
      Resets the submitted values
    • resetSort Link icon

      public void resetSort()
      Resets the sorting to the originally specified values (if any)
    • resetInvalidUpdates Link icon

      public void resetInvalidUpdates()
      Resets invalid updates
    • reset Link icon

      public void reset()
      Resets all filters, sorting and submitted values.
    • setSubmittedValue Link icon

      public void setSubmittedValue(String rowKey, int col, String value)
      Updates a submitted value.
    • getSubmittedValue Link icon

      public String getSubmittedValue(String rowKey, int col)
      Retrieves the submitted value for the row and col.
    • setLocalValue Link icon

      public void setLocalValue(String rowKey, int col, Object value)
      Updates a local value.
    • getLocalValue Link icon

      public Object getLocalValue(String rowKey, int col)
      Retrieves the submitted value for the rowKey and col.
    • setRowVar Link icon

      public void setRowVar(javax.faces.context.FacesContext context, String rowKey)
      Updates the row var for iterations over the list. The var value will be updated to the value for the specified rowKey.
      Parameters:
      context - the FacesContext against which to the row var is set. Passed for performance
      rowKey - the rowKey string
    • getRowMap Link icon

      protected Map<String,Object> getRowMap()
    • getValueForCell Link icon

      public Object getValueForCell(javax.faces.context.FacesContext context, String rowKey, int col)
      Gets the object value of the row and col specified. If a local value exists, that is returned, otherwise the actual value is return.
    • getRenderValueForCell Link icon

      public String getRenderValueForCell(javax.faces.context.FacesContext context, String rowKey, int col)
      Gets the render string for the value the given cell. Applys the available converters to convert the value.
    • getRowHeaderValueAsString Link icon

      protected String getRowHeaderValueAsString(javax.faces.context.FacesContext context)
      Gets the row header text value as a string for use in javascript
    • getSortedValues Link icon

      public List<Object> getSortedValues()
      The sorted list of values.
    • getSortColRenderIndex Link icon

      public int getSortColRenderIndex()
      Gets the rendered col index of the column corresponding to the current sortBy. This is used to keep track of the current sort column in the page.
    • matchesFilter Link icon

      protected boolean matchesFilter()
      Evaluates the specified item value against the column filters and if they match, returns true, otherwise false. If no filterMatchMode is given on a column than the "contains" mode is used. Otherwise the following filterMatchMode values are possible: - startsWith: Checks if column value starts with the filter value. - endsWith: Checks if column value ends with the filter value. - contains: Checks if column value contains the filter value. - exact: Checks if string representations of column value and filter value are same.
    • sortAndFilter Link icon

      public List<Object> sortAndFilter()
      Sorts and filters the data
    • remapFilteredList Link icon

      protected void remapFilteredList(List filteredList)
      Remaps the row keys in a hash map.
    • remapRows Link icon

      protected void remapRows()
      Remaps the row keys in a hash map.
    • getRowKeyValue Link icon

      protected Object getRowKeyValue(javax.faces.context.FacesContext context)
      Gets the rowKey for the current row
      Parameters:
      context - the faces context
      Returns:
      a row key value or null if the expression is not set
    • getRowKeyValueAsString Link icon

      protected String getRowKeyValueAsString(Object key)
      Gets the row key value as a String suitable for use in javascript rendering.
    • getRowKeyValueAsString Link icon

      protected String getRowKeyValueAsString(javax.faces.context.FacesContext context)
      Gets the row key value as a string for the current row var.
    • convertSortOrder Link icon

      protected org.primefaces.model.SortOrder convertSortOrder()
      Convert to PF SortOrder enum since we are leveraging PF sorting code.
    • validate Link icon

      public void validate(javax.faces.context.FacesContext context)
      Converts each submitted value into a local value and stores it back in the hash. If all values convert without error, then the component is valid, and we can proceed to the processUpdates.
      Overrides:
      validate in class javax.faces.component.UIInput
    • updateModel Link icon

      public void updateModel(javax.faces.context.FacesContext context)
      Override to update model with local values. Note that this is where things can be fragile in that we can successfully update some values and fail on others. There is no clean way to roll back the updates, but we also need to fail processing. Consider keeping old values as we update (need for event anyhow) and if there is a failure attempt to roll back by updating successful model updates with the old value. This may not all be necessary.
      Overrides:
      updateModel in class javax.faces.component.UIInput
    • saveState Link icon

      public Object saveState(javax.faces.context.FacesContext context)
      Saves the state of the submitted and local values and the bad updates.
      Specified by:
      saveState in interface javax.faces.component.StateHolder
      Overrides:
      saveState in class javax.faces.component.UIInput
    • restoreState Link icon

      public void restoreState(javax.faces.context.FacesContext context, Object state)
      Restores the state for the submitted, local and bad values.
      Specified by:
      restoreState in interface javax.faces.component.StateHolder
      Overrides:
      restoreState in class javax.faces.component.UIInput
    • getSelection Link icon

      public String getSelection()
      The selection value.
      Returns:
      the selection
    • setSelection Link icon

      public void setSelection(String selection)
      Updates the selection value.
      Parameters:
      selection - the selection to set
    • getSubmittedValue Link icon

      public Object getSubmittedValue()
      Specified by:
      getSubmittedValue in interface javax.faces.component.EditableValueHolder
      Overrides:
      getSubmittedValue in class javax.faces.component.UIInput
    • setSubmittedValue Link icon

      public void setSubmittedValue(Object submittedValue)
      Specified by:
      setSubmittedValue in interface javax.faces.component.EditableValueHolder
      Overrides:
      setSubmittedValue in class javax.faces.component.UIInput
    • getUpdates Link icon

      public List<SheetUpdate> getUpdates()
      A list of updates from the last submission or ajax event.
      Returns:
      the editEvent
    • isHasStyledCells Link icon

      public boolean isHasStyledCells()
      Returns true if any of the columns contain conditional styling.
    • getMappedColumn Link icon

      public int getMappedColumn(int renderCol)
      Maps the rendered column index to the real column index.
      Parameters:
      renderCol - the rendered index
      Returns:
      the mapped index
    • getRenderIndexFromRealIdx Link icon

      public int getRenderIndexFromRealIdx(int realIdx)
      Provides the render column index based on the real index
    • updateColumnMappings Link icon

      public void updateColumnMappings()
      Updates the column mappings based on the rendered attribute
    • getRowCount Link icon

      public int getRowCount()
      The number of rows in the value list.
    • getFocusId Link icon

      public String getFocusId()
      The focusId value.
      Returns:
      the focusId
    • setFocusId Link icon

      public void setFocusId(String focusId)
      Updates the focusId value.
      Parameters:
      focusId - the focusId to set
    • commitUpdates Link icon

      public void commitUpdates()
      Invoke this method to commit the most recent set of ajax updates and restart the tracking of changes. Use this when you have processes the updates to the model and are confident that any changes made to this point can be cleared (likely because you have persisted those changes).
    • getInvalidDataValue Link icon

      public String getInvalidDataValue()
      Generates the bad data var value for this sheet.
    • renderRowUpdateScript Link icon

      public void renderRowUpdateScript(javax.faces.context.FacesContext context, Set<String> dirtyRows)
      Adds eval scripts to the ajax response to update the rows dirtied by the most recent successful update request.
      Parameters:
      context - the FacesContext
      dirtyRows - the set of dirty rows
    • renderBadUpdateScript Link icon

      public void renderBadUpdateScript()
      Adds eval scripts to update the bad data array in the sheet to render validation failures produced by the most recent ajax update attempt.
    • appendUpdateEvent Link icon

      public void appendUpdateEvent(Object rowKey, int colIndex, Object rowData, Object oldValue, Object newValue)
      Appends an update event
    • setStyleClass Link icon

      public void setStyleClass(String styleClass)
    • getStyleClass Link icon

      public String getStyleClass()
    • setStretchH Link icon

      public void setStretchH(String value)
    • getStretchH Link icon

      public String getStretchH()
    • setEmptyMessage Link icon

      public void setEmptyMessage(String value)
    • getEmptyMessage Link icon

      public String getEmptyMessage()
    • getSortBy Link icon

      public Object getSortBy()
      Please note: The return type needs to be Object. Otherwise, evaluating the sortBy attribute as a value expression forces it into a string, and strings are sorted differently than numbers.
      Returns:
      The ID of the column to sort by.
    • setSortBy Link icon

      public void setSortBy(Object sortBy)
    • setShowColumnHeaders Link icon

      public void setShowColumnHeaders(boolean value)
    • isShowColumnHeaders Link icon

      public boolean isShowColumnHeaders()
    • setShowRowHeaders Link icon

      public void setShowRowHeaders(boolean value)
    • isShowRowHeaders Link icon

      public boolean isShowRowHeaders()
    • setResizableRows Link icon

      public void setResizableRows(boolean value)
    • isResizableRows Link icon

      public boolean isResizableRows()
    • setResizableCols Link icon

      public void setResizableCols(boolean value)
    • isResizableCols Link icon

      public boolean isResizableCols()
    • setMovableRows Link icon

      public void setMovableRows(boolean value)
    • isMovableRows Link icon

      public boolean isMovableRows()
    • setMovableCols Link icon

      public void setMovableCols(boolean value)
    • isMovableCols Link icon

      public boolean isMovableCols()
    • setRowStyleClass Link icon

      public void setRowStyleClass(String styleClass)
    • getRowStyleClass Link icon

      public String getRowStyleClass()
    • getActiveHeaderStyleClass Link icon

      public String getActiveHeaderStyleClass()
    • setReadOnly Link icon

      public void setReadOnly(boolean value)
    • isReadOnly Link icon

      public boolean isReadOnly()
    • setActiveHeaderStyleClass Link icon

      public void setActiveHeaderStyleClass(String value)
    • getCommentedCellStyleClass Link icon

      public String getCommentedCellStyleClass()
    • setCommentedCellStyleClass Link icon

      public void setCommentedCellStyleClass(String value)
    • getCurrentColStyleClass Link icon

      public String getCurrentColStyleClass()
    • setCurrentColStyleClass Link icon

      public void setCurrentColStyleClass(String value)
    • getCurrentHeaderStyleClass Link icon

      public String getCurrentHeaderStyleClass()
    • setCurrentHeaderStyleClass Link icon

      public void setCurrentHeaderStyleClass(String value)
    • getCurrentRowStyleClass Link icon

      public String getCurrentRowStyleClass()
    • setCurrentRowStyleClass Link icon

      public void setCurrentRowStyleClass(String value)
    • getInvalidCellStyleClass Link icon

      public String getInvalidCellStyleClass()
    • setInvalidCellStyleClass Link icon

      public void setInvalidCellStyleClass(String value)
    • getNoWordWrapStyleClass Link icon

      public String getNoWordWrapStyleClass()
    • setNoWordWrapStyleClass Link icon

      public void setNoWordWrapStyleClass(String value)
    • getPlaceholderCellStyleClass Link icon

      public String getPlaceholderCellStyleClass()
    • setPlaceholderCellStyleClass Link icon

      public void setPlaceholderCellStyleClass(String value)
    • getReadOnlyCellStyleClass Link icon

      public String getReadOnlyCellStyleClass()
    • setReadOnlyCellStyleClass Link icon

      public void setReadOnlyCellStyleClass(String value)
    • setAllowTabOffSheet Link icon

      public void setAllowTabOffSheet(boolean value)
    • isAllowTabOffSheet Link icon

      public boolean isAllowTabOffSheet()
    • getTabindex Link icon

      public String getTabindex()
    • setTabindex Link icon

      public void setTabindex(String tabindex)
    • getExtender Link icon

      public String getExtender()
    • setExtender Link icon

      public void setExtender(String extender)
    • setCaseSensitiveSort Link icon

      public void setCaseSensitiveSort(boolean value)
    • isCaseSensitiveSort Link icon

      public boolean isCaseSensitiveSort()
    • getNullSortOrder Link icon

      public Integer getNullSortOrder()
    • setNullSortOrder Link icon

      public void setNullSortOrder(Integer value)
    • setMaxRows Link icon

      public void setMaxRows(Integer value)
    • getMaxRows Link icon

      public Integer getMaxRows()
    • setMinRows Link icon

      public void setMinRows(Integer value)
    • getMinRows Link icon

      public Integer getMinRows()
    • setMaxCols Link icon

      public void setMaxCols(Integer value)
    • getMaxCols Link icon

      public Integer getMaxCols()
    • setMinCols Link icon

      public void setMinCols(Integer value)
    • getMinCols Link icon

      public Integer getMinCols()
    • setFixedRows Link icon

      public void setFixedRows(Integer value)
    • getFixedRows Link icon

      public Integer getFixedRows()
    • setFixedRowsBottom Link icon

      public void setFixedRowsBottom(Integer value)
    • getFixedRowsBottom Link icon

      public Integer getFixedRowsBottom()
    • setFixedCols Link icon

      public void setFixedCols(Integer value)
    • getFixedCols Link icon

      public Integer getFixedCols()
    • getLocale Link icon

      public String getLocale()
    • setLocale Link icon

      public void setLocale(String locale)
    • setSelectionMode Link icon

      public void setSelectionMode(String value)
    • getSelectionMode Link icon

      public String getSelectionMode()
    • getSelectedColumn Link icon

      public Integer getSelectedColumn()
      The currently selected column.
      Returns:
    • setSelectedColumn Link icon

      public void setSelectedColumn(Integer col)
      Updates the selected column.
      Parameters:
      col -
    • getSelectedLastColumn Link icon

      public Integer getSelectedLastColumn()
      The currently selected column.
      Returns:
    • setSelectedLastColumn Link icon

      public void setSelectedLastColumn(Integer col)
      Updates the selected column.
      Parameters:
      col -
    • getSelectedRow Link icon

      public Integer getSelectedRow()
      The currently selected row.
      Returns:
    • getSelectedLastRow Link icon

      public Integer getSelectedLastRow()
      The currently selected row.
      Returns:
    • setSelectedRow Link icon

      public void setSelectedRow(Integer row)
      Updates the selected row.
      Parameters:
      row -
    • setSelectedLastRow Link icon

      public void setSelectedLastRow(Integer row)
      Updates the selected row.
      Parameters:
      row -
    • getWidth Link icon

      public Integer getWidth()
    • setWidth Link icon

      public void setWidth(Integer value)
    • getHeight Link icon

      public Integer getHeight()
      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.
      Returns:
    • setHeight Link icon

      public void setHeight(Integer value)
      Updates the height
      Parameters:
      value -
    • getValue Link icon

      public Object getValue()
      Return the value of the Sheet. This value must be a java.util.List value at this time.
      Specified by:
      getValue in interface javax.faces.component.ValueHolder
      Overrides:
      getValue in class javax.faces.component.UIInput
    • getFilteredValue Link icon

      public List getFilteredValue()
      Holds the filtered and sorted List of values.
      Returns:
      a List of sorted and filtered values
    • setFilteredValue Link icon

      public void setFilteredValue(List filteredValue)
      Sets the filtered list.
      Parameters:
      filteredValue - the List to store
    • setValue Link icon

      public void setValue(Object value)
      Set the value of the Sheet. This value must be a java.util.List at this time.
      Specified by:
      setValue in interface javax.faces.component.ValueHolder
      Overrides:
      setValue in class javax.faces.component.UIInput
      Parameters:
      value - the new value
    • setStyle Link icon

      public void setStyle(String value)
      Update the style value for the component
      Parameters:
      value -
    • getStyle Link icon

      public String getStyle()
      The style value
      Returns:
      the style value
    • getRowHeaderValueExpression Link icon

      protected javax.el.ValueExpression getRowHeaderValueExpression()
      Gets the rowHeader value expression defined
      Returns:
      a value expression for Row Header or null if the expression is not set
    • getVar Link icon

      public String getVar()
      Return the request-scope attribute under which the data object for the current row will be exposed when iterating. This property is not enabled for value binding expressions.
    • setVar Link icon

      public void setVar(String var)
      Set the request-scope attribute under which the data object for the current row wil be exposed when iterating.
      Parameters:
      var - The new request-scope attribute name
    • saveSortByColumn Link icon

      public void saveSortByColumn(String columnId)
      Saves the column by which the sheet is currently sorted (when the user clicks on a column).
      Parameters:
      columnId - ID of the column by which the sheet is currently sorted.
    • getSortOrder Link icon

      public String getSortOrder()
      The sort direction
      Returns:
    • setSortOrder Link icon

      public void setSortOrder(String sortOrder)
      Update the sort direction
      Parameters:
      sortOrder -
    • getErrorMessage Link icon

      public String getErrorMessage()
      The error message to display when the sheet is in error.
      Returns:
    • setErrorMessage Link icon

      public void setErrorMessage(String value)
      Updates the errorMessage value.
      Parameters:
      value -