Class MultiPagePane

    • Field Detail

      • m_NumDecimals

        protected int m_NumDecimals
        the number of decimals to display.
      • m_CellRenderingCustomizer

        protected CellRenderingCustomizer m_CellRenderingCustomizer
        the custom background color for negative values (null if none set).
    • Constructor Detail

      • MultiPagePane

        public MultiPagePane​(SpreadSheetViewerPanel owner)
        Initializes the tabbed pane.
        Parameters:
        owner - the owning viewer
    • Method Detail

      • setOwner

        public void setOwner​(SpreadSheetViewerPanel value)
        Sets the owning viewer.
        Parameters:
        value - the owner
      • getOwner

        public SpreadSheetViewerPanel getOwner()
        Returns the owning viewer.
        Returns:
        the owner, null if none set
      • getPanelCount

        public int getPanelCount()
        Returns the number of panels in the tabbed pane.
        Returns:
        the number of panels
      • getAllPanels

        public SpreadSheetPanel[] getAllPanels()
        Returns all the image panels.
        Returns:
        the image panels
      • getPanelAt

        public SpreadSheetPanel getPanelAt​(int index)
        Returns the panel at the specified position.
        Parameters:
        index - the page index of the table
        Returns:
        the panel, null if not available or invalid index
      • getTableAt

        public SpreadSheetTable getTableAt​(int index)
        Returns the table at the specified position.
        Parameters:
        index - the page index of the table
        Returns:
        the table, null if not available or invalid index
      • getSheetAt

        public SpreadSheet getSheetAt​(int index)
        Returns the table at the specified position.
        Parameters:
        index - the page index of the table
        Returns:
        the table
      • setNumDecimalsAt

        public void setNumDecimalsAt​(int index,
                                     int numDec)
        Sets the number of decimals to use.
        Parameters:
        index - the page index
        numDec - the number of decimals to use
      • getNumDecimalsAt

        public int getNumDecimalsAt​(int index)
        returns the number of decimals in use.
        Parameters:
        index - the page index
        Returns:
        the number of decimals in use
      • setNumDecimals

        public void setNumDecimals​(int numDec)
        Sets the number of decimals to use for all tables.
        Parameters:
        numDec - the number of decimals to use
      • getNumDecimals

        public int getNumDecimals()
        Returns the currently set number of decimals.
        Returns:
        the number of decimals to use
      • setCellRenderingCustomizerAt

        public void setCellRenderingCustomizerAt​(int index,
                                                 CellRenderingCustomizer cust)
        Sets the cell rendering customizer at the index.
        Parameters:
        index - the page index
        cust - the customizer
      • getCellRenderingCustomizerAt

        public CellRenderingCustomizer getCellRenderingCustomizerAt​(int index)
        Returns the cell rendering customizer at the index.
        Parameters:
        index - the page index
        Returns:
        the customizer
      • setCellRenderingCustomizer

        public void setCellRenderingCustomizer​(CellRenderingCustomizer cust)
        Sets the cell rendering customizer to use.
        Parameters:
        cust - the customizer
      • getCellRenderingCustomizer

        public CellRenderingCustomizer getCellRenderingCustomizer()
        Returns the current cell rendering customizer.
        Returns:
        the customizer
      • setOptimalColumnWidth

        public void setOptimalColumnWidth()
        Sets the optimal column widths for all pages.
      • setOptimalColumnWidthAt

        public void setOptimalColumnWidthAt​(int index)
        Sets the optimal column widths for the specified pane.
        Parameters:
        index - the page index
      • setColumnWidths

        public void setColumnWidths​(int width)
        Sets the column widths for all pages.
      • setColumnWidthsAt

        public void setColumnWidthsAt​(int index,
                                      int width)
        Sets the column width for the specified pane.
        Parameters:
        index - the page index
        width - the width to use
      • setShowFormulasAt

        public void setShowFormulasAt​(int index,
                                      boolean value)
        Sets whether to show the formulas.
        Parameters:
        index - the page index
        value - whether to show the formulas
      • getShowFormulas

        public boolean getShowFormulas​(int index)
        Returns whether to show the formulas.
        Parameters:
        index - the page index
        Returns:
        whether to show the formulas
      • setShowFormulas

        public void setShowFormulas​(boolean value)
        Sets whether to show the formulas.
        Parameters:
        value - whether to show the formulas
      • setShowCellTypesAt

        public void setShowCellTypesAt​(int index,
                                       boolean value)
        Sets whether to show the cell types rather than values.
        Parameters:
        index - the page index
        value - whether to show the cell types
      • getShowCellTypes

        public boolean getShowCellTypes​(int index)
        Returns whether to show the cell types.
        Parameters:
        index - the page index
        Returns:
        whether to show the cell types
      • setShowCellTypes

        public void setShowCellTypes​(boolean value)
        Sets whether to show the cell types.
        Parameters:
        value - whether to show the cell types
      • setReadOnlyAt

        public void setReadOnlyAt​(int index,
                                  boolean value)
        Sets the readonly state.
        Parameters:
        index - the page index
        value - whether to show the formulas
      • getReadOnlyAt

        public boolean getReadOnlyAt​(int index)
        Returns whether to show the formulas.
        Parameters:
        index - the page index
        Returns:
        whether to show the formulas
      • setReadOnly

        public void setReadOnly​(boolean value)
        Sets the readonly state of all tabs.
        Overrides:
        setReadOnly in class MultiPagePane
        Parameters:
        value - true if readonly
      • setModifiedAt

        public void setModifiedAt​(int index,
                                  boolean value)
        Sets the modified state.
        Parameters:
        index - the page index
        value - true if modified
      • isModifiedAt

        public boolean isModifiedAt​(int index)
        Returns the modified state.
        Parameters:
        index - the page index
        Returns:
        true if modified
      • setModified

        public void setModified​(boolean value)
        Sets the modified state of all tab.
        Parameters:
        value - true if modified
      • checkForModified

        protected boolean checkForModified()
        Returns whether we can proceed with the operation or not, depending on whether the user saved the sheet or discarded the changes.
        Returns:
        true if safe to proceed
      • checkForModified

        protected boolean checkForModified​(SpreadSheetPanel panel)
        Returns whether we can proceed with the operation or not, depending on whether the user saved the sheet or discarded the changes.
        Returns:
        true if safe to proceed
      • getCurrentPanel

        public SpreadSheetPanel getCurrentPanel()
        Returns the currently selected panel.
        Returns:
        the current panel, null if not available
      • getCurrentTable

        public SpreadSheetTable getCurrentTable()
        Returns the currently selected table.
        Returns:
        the table, null if none available
      • getCurrentSheet

        public SpreadSheet getCurrentSheet()
        Returns the currently selected sheet.
        Returns:
        the sheet, null if none available
      • addPage

        public SpreadSheetPanel addPage​(File file,
                                        SpreadSheet sheet)
        Adds the sheet.
        Parameters:
        file - the file this sheet is from
        sheet - the sheet to add
        Returns:
        the created panel
      • addPage

        public SpreadSheetPanel addPage​(String title,
                                        SpreadSheet sheet)
        Adds the sheet.
        Parameters:
        title - the title for the tab
        sheet - the sheet to add
        Returns:
        the created panel
      • createPageTitle

        public String createPageTitle​(File file,
                                      SpreadSheet sheet)
        Creates a page title.
        Parameters:
        file - the file name to use
        sheet - the sheet loaded from the file
        Returns:
        the generated title
      • getPageTitles

        public List<String> getPageTitles()
        Returns all the page titles.
        Returns:
        the titles
      • newTitle

        public String newTitle()
        Returns a new title (does not reserve it).
      • pageSelected

        protected void pageSelected​(ChangeEvent e)
        Gets called when a page gets selected.
        Parameters:
        e - the event that triggered the action
      • removePageAt

        public MultiPagePane.PageContainer removePageAt​(int index)
        Removes the page at index. After the component associated with index is removed, its visibility is reset to true to ensure it will be visible if added to other containers.
        Overrides:
        removePageAt in class MultiPagePane
        Parameters:
        index - the index of the page to be removed
        Returns:
        the removed container
      • updateCurrentPage

        public void updateCurrentPage()
        Updates the title of the currently selected page, taking the modified state into account.
      • updatePage

        public void updatePage​(int index)
        Updates the page title at the specified index, taking the modified state into account.
        Parameters:
        index - the index of the tab