Class Spreadsheet.SelectionChangeEvent

    • Constructor Detail

      • SelectionChangeEvent

        public SelectionChangeEvent​(Component source,
                                    org.apache.poi.ss.util.CellReference selectedCellReference,
                                    List<org.apache.poi.ss.util.CellReference> individualSelectedCells,
                                    org.apache.poi.ss.util.CellRangeAddress selectedCellMergedRegion,
                                    List<org.apache.poi.ss.util.CellRangeAddress> cellRangeAddresses)
        Creates a new selection change event.
        Parameters:
        source - Source Spreadsheet
        selectedCellReference - see getSelectedCellReference()
        individualSelectedCells - see getIndividualSelectedCells()
        selectedCellMergedRegion - see getSelectedCellMergedRegion()
        cellRangeAddresses - see getCellRangeAddresses()
    • Method Detail

      • getSpreadsheet

        public Spreadsheet getSpreadsheet()
        Gets the Spreadsheet where this event happened.
        Returns:
        Source Spreadsheet
      • getSelectedCellReference

        public org.apache.poi.ss.util.CellReference getSelectedCellReference()
        Returns reference to the currently selected single cell OR in case of multiple selections the last cell clicked OR in case of area select the cell from which the area selection was started.
        Returns:
        CellReference to the single selected cell, or the last cell selected manually (e.g. with ctrl+mouseclick)
      • getIndividualSelectedCells

        public List<org.apache.poi.ss.util.CellReference> getIndividualSelectedCells()
        Gets all the individually selected single cells in the current selection.
        Returns:
        All non-contiguously selected cells (e.g. with ctrl+mouseclick)
      • getSelectedCellMergedRegion

        public org.apache.poi.ss.util.CellRangeAddress getSelectedCellMergedRegion()
        Gets the merged region the single selected cell is a part of, if applicable.
        Returns:
        The CellRangeAddress described the merged region the single selected cell is part of, if any.
      • getCellRangeAddresses

        public List<org.apache.poi.ss.util.CellRangeAddress> getCellRangeAddresses()
        Gets all separately selected cell ranges.
        Returns:
        All separately selected cell ranges (e.g. with ctrl+shift+mouseclick)
      • getAllSelectedCells

        public Set<org.apache.poi.ss.util.CellReference> getAllSelectedCells()
        Gets a combination of all selected cells.
        Returns:
        A combination of all selected cells, regardless of selection mode. Doesn't contain duplicates.