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

  • Constructor Details

    • Sheet

      public Sheet()
  • Method Details

    • getFamily

      public String getFamily()
    • getEventNames

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

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

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

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

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

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

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

      public void resetSubmitted()
      Resets the submitted values
    • resetSort

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

      public void resetInvalidUpdates()
      Resets invalid updates
    • reset

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

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

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

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

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

      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

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

      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

      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

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

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

      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

      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

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

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

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

      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

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

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

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

      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

      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

      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

      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

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

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

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

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

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

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

      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

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

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

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

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

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

      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

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

      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

      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

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

      public void setStyleClass(String styleClass)
    • getStyleClass

      public String getStyleClass()
    • setStretchH

      public void setStretchH(String value)
    • getStretchH

      public String getStretchH()
    • setEmptyMessage

      public void setEmptyMessage(String value)
    • getEmptyMessage

      public String getEmptyMessage()
    • getSortBy

      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

      public void setSortBy(Object sortBy)
    • setShowColumnHeaders

      public void setShowColumnHeaders(boolean value)
    • isShowColumnHeaders

      public boolean isShowColumnHeaders()
    • setShowRowHeaders

      public void setShowRowHeaders(boolean value)
    • isShowRowHeaders

      public boolean isShowRowHeaders()
    • setResizableRows

      public void setResizableRows(boolean value)
    • isResizableRows

      public boolean isResizableRows()
    • setResizableCols

      public void setResizableCols(boolean value)
    • isResizableCols

      public boolean isResizableCols()
    • setMovableRows

      public void setMovableRows(boolean value)
    • isMovableRows

      public boolean isMovableRows()
    • setMovableCols

      public void setMovableCols(boolean value)
    • isMovableCols

      public boolean isMovableCols()
    • setRowStyleClass

      public void setRowStyleClass(String styleClass)
    • getRowStyleClass

      public String getRowStyleClass()
    • getActiveHeaderStyleClass

      public String getActiveHeaderStyleClass()
    • setReadOnly

      public void setReadOnly(boolean value)
    • isReadOnly

      public boolean isReadOnly()
    • setActiveHeaderStyleClass

      public void setActiveHeaderStyleClass(String value)
    • getCommentedCellStyleClass

      public String getCommentedCellStyleClass()
    • setCommentedCellStyleClass

      public void setCommentedCellStyleClass(String value)
    • getCurrentColStyleClass

      public String getCurrentColStyleClass()
    • setCurrentColStyleClass

      public void setCurrentColStyleClass(String value)
    • getCurrentHeaderStyleClass

      public String getCurrentHeaderStyleClass()
    • setCurrentHeaderStyleClass

      public void setCurrentHeaderStyleClass(String value)
    • getCurrentRowStyleClass

      public String getCurrentRowStyleClass()
    • setCurrentRowStyleClass

      public void setCurrentRowStyleClass(String value)
    • getInvalidCellStyleClass

      public String getInvalidCellStyleClass()
    • setInvalidCellStyleClass

      public void setInvalidCellStyleClass(String value)
    • getNoWordWrapStyleClass

      public String getNoWordWrapStyleClass()
    • setNoWordWrapStyleClass

      public void setNoWordWrapStyleClass(String value)
    • getPlaceholderCellStyleClass

      public String getPlaceholderCellStyleClass()
    • setPlaceholderCellStyleClass

      public void setPlaceholderCellStyleClass(String value)
    • getReadOnlyCellStyleClass

      public String getReadOnlyCellStyleClass()
    • setReadOnlyCellStyleClass

      public void setReadOnlyCellStyleClass(String value)
    • setAllowTabOffSheet

      public void setAllowTabOffSheet(boolean value)
    • isAllowTabOffSheet

      public boolean isAllowTabOffSheet()
    • getTabindex

      public String getTabindex()
    • setTabindex

      public void setTabindex(String tabindex)
    • getExtender

      public String getExtender()
    • setExtender

      public void setExtender(String extender)
    • setCaseSensitiveSort

      public void setCaseSensitiveSort(boolean value)
    • isCaseSensitiveSort

      public boolean isCaseSensitiveSort()
    • getNullSortOrder

      public Integer getNullSortOrder()
    • setNullSortOrder

      public void setNullSortOrder(Integer value)
    • setMaxRows

      public void setMaxRows(Integer value)
    • getMaxRows

      public Integer getMaxRows()
    • setMinRows

      public void setMinRows(Integer value)
    • getMinRows

      public Integer getMinRows()
    • setMaxCols

      public void setMaxCols(Integer value)
    • getMaxCols

      public Integer getMaxCols()
    • setMinCols

      public void setMinCols(Integer value)
    • getMinCols

      public Integer getMinCols()
    • setFixedRows

      public void setFixedRows(Integer value)
    • getFixedRows

      public Integer getFixedRows()
    • setFixedRowsBottom

      public void setFixedRowsBottom(Integer value)
    • getFixedRowsBottom

      public Integer getFixedRowsBottom()
    • setFixedCols

      public void setFixedCols(Integer value)
    • getFixedCols

      public Integer getFixedCols()
    • getLocale

      public String getLocale()
    • setLocale

      public void setLocale(String locale)
    • setSelectionMode

      public void setSelectionMode(String value)
    • getSelectionMode

      public String getSelectionMode()
    • getSelectedColumn

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

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

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

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

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

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

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

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

      public Integer getWidth()
    • setWidth

      public void setWidth(Integer value)
    • getHeight

      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

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

      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

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

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

      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

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

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

      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

      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

      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

      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

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

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

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

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