Class PIASpreadSheet

All Implemented Interfaces:
PAppComponent, PAppFieldComponent, PClientComponent, PComponent, PComponentAttribute, PFieldBean, PViewDataChangeListener, ActionListener, MouseListener, ImageObserver, MenuContainer, Serializable, Remote, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
PIASpecSpreadSheet, PNonCurrencyTable

Swing compatible, Portal aware spreadsheet display class.
One of the powerful features of this component is that even while using the default renderers, the developer can specify the way the data is displayed on screen by using the setIdxDisplayFieldFormat() method. This means less work/code for the developer since they don't have to implement their own renderers just to control the way the data is displayed. Note that this spreadsheet contains an internal TableModel so you should not have to explicitely set one. Besides, data will typically be filled in automatically from the database via a call to setModelHandle() See the PTableCellEditor class for the set of default editors.
Author:
Kapono Carter
See Also:
  • Field Details

  • Constructor Details

    • PIASpreadSheet

      public PIASpreadSheet()
      Creates a new Portal-aware spread sheet component. Selection of individual cells is allowed.
  • Method Details

    • addNotify

      public void addNotify()
      Overridden to add keyboard action listeners for the Enter invalid input: '&' Space keys.
      Overrides:
      addNotify in class JTable
      See Also:
    • unregister

      public void unregister() throws RemoteException
      Used to disassociate this component from its delegate (controller)
      Specified by:
      unregister in interface PClientComponent
      Throws:
      RemoteException
    • setModelHandle

      public void setModelHandle(PModelHandle data) throws RemoteException
      Establishes the PModelHandle for this component
      Specified by:
      setModelHandle in interface PComponent
      Parameters:
      data - The new PModelHandle from which information will be extracted.
      Throws:
      RemoteException
    • getModelHandle

      public PModelHandle getModelHandle() throws RemoteException
      Retrieves the PModelHandle for this component
      Specified by:
      getModelHandle in interface PComponent
      Returns:
      The PModelHandle associated with this component
      Throws:
      RemoteException
    • getModelHandleAt

      public PModelHandle getModelHandleAt(int row) throws RemoteException
      Retrieves the PModelHandle for a given row in this component
      Returns:
      The PModelHandle associated with a row for this component
      Throws:
      RemoteException
    • setUntypedData

      public void setUntypedData(boolean b)
      Use this API to inform the table that the PModelHandle data it will receive from BAS will contain UNTYPED data (hand-generated FLists). This method is only really important if you are taking advantage of the BAS displayFieldDescription/modelFieldDescription stuff.
      This method is necessary because when converting between FLists and PModelHandles, BAS will attempt to read Poid objects and refresh data if the FList contains such entities. However, if you have hand crafted FLists you typically don't want this to happen. You want the FList you created to be turned into a PModelHandle and that exact same FList returned when you ask for it. Call this method if that is the situation you find yourself in.
      Something to consider. If you are getting FLists back from and Portal search opcode and displaying them in a table, you probably don't need to call this API - you will probably already have real Portal storable classes.
      Parameters:
      b - If true, informs the table its data should be considered UNTYPED This is false by default
    • isUntypedData

      public boolean isUntypedData()
      Determines if this table supports typed or untyped data
      Returns:
      The state of this table's data
    • isLight

      public boolean isLight() throws RemoteException
      Determines if this is component defers PModelHandle knowledge to its parent container. If so, the parent container will pass the PModelHandle to this component on the server side (via the controller) saving a client/server roundtrip for data exchange. If you need to do specific processing of some kind when PModelHandle is called you'll need to subclass this component and override this method. Otherwise setModelHandle() will not be called.
      Specified by:
      isLight in interface PComponent
      Returns:
      false
      Throws:
      RemoteException
    • getControllerClassName

      public String getControllerClassName() throws RemoteException
      Retrieves the class name of this component's controller
      Specified by:
      getControllerClassName in interface PComponent
      Returns:
      The name of the controller for this component
      Throws:
      RemoteException
    • getTools

      public Vector getTools()
      Get a list of Actions supported by this component. When subclassed, the overriding class should call its super class version, then add its actions to the retuned list. This preserves actions supplied by base classes. The default, supplied here, include Help for this component.
      Specified by:
      getTools in interface PClientComponent
      Returns:
      a Vector containing Action objects
    • setResourceName

      public void setResourceName(String name)
      Set the base resource name used in resource lookup. Basically, the resource name will be this base, followed by a dot, flowwed by the local name (label).
      Specified by:
      setResourceName in interface PClientComponent
      Parameters:
      name - The new base resource name.
    • getResourceName

      public String getResourceName()
      Get the base resource name used in resource lookup.
      Specified by:
      getResourceName in interface PClientComponent
      Returns:
      The base resource name
      Throws:
      RemoteException
    • getRemoteComponent

      public Remote getRemoteComponent()
      Get a reference to the remote component for this object. The remote component is used when interfacing with this component's controller.
      Specified by:
      getRemoteComponent in interface PAppComponent
      Returns:
      a RemoteComponent
    • setModelFieldDescription

      public void setModelFieldDescription(String fieldDesc) throws RemoteException
      Set the description of the field in the data model that this component is interested in.
      Specified by:
      setModelFieldDescription in interface PFieldBean
      Parameters:
      fieldDesc - A String describing the field used by this component.
      Throws:
      RemoteException
    • getModelFieldDescription

      public String getModelFieldDescription() throws RemoteException
      Get the data field description used by the component
      Specified by:
      getModelFieldDescription in interface PFieldBean
      Returns:
      a string description of the field used by this component
      Throws:
      RemoteException
    • setDisplayFieldDescription

      public void setDisplayFieldDescription(String fieldDisp) throws RemoteException
      Set the description of the field(s) in the data model that this component will display.
      Specified by:
      setDisplayFieldDescription in interface PFieldBean
      Parameters:
      fieldDisp - a String that describes the field
      fieldDesc - A String describing the field displayed by this component.
      Throws:
      RemoteException
    • getDisplayFieldDescription

      public String getDisplayFieldDescription() throws RemoteException
      Get the data field description used by the component
      Specified by:
      getDisplayFieldDescription in interface PFieldBean
      Returns:
      a string description of the field used by this component
      Throws:
      RemoteException
    • setDisplayFieldFormat

      public void setDisplayFieldFormat(String fieldForm) throws RemoteException
      Sets the java.text.MessageFormat-type format used to display data in this component. This is typically (but not necessarily) directly tied to the DisplayFieldDescription. For example, the DisplayFieldDescriptio might be "FldNameinfo[any].FldFirstName, FldNameinfo[any].FldLastName" and the DisplayFieldFormat for that might be "{1}, {0}" to display the last name followed by a comma and then the first name.
      This method is superceded by setIdxDisplayFieldFormat() which allows format specifications on a per/column basis.
      Specified by:
      setDisplayFieldFormat in interface PAppFieldComponent
      Parameters:
      fieldForm - the format used when displaying the data
      Throws:
      RemoteException
    • getDisplayFieldFormat

      public String getDisplayFieldFormat() throws RemoteException
      Gets the display field format used by this component
      Specified by:
      getDisplayFieldFormat in interface PAppFieldComponent
      Returns:
      a String representation of the display field format
      Throws:
      RemoteException
    • setAssociatedClass

      public void setAssociatedClass(String name) throws RemoteException
      Description copied from interface: PFieldBean
      Sets the associated class, if any, for this field.
      Specified by:
      setAssociatedClass in interface PFieldBean
      Parameters:
      name - the class name
      Throws:
      RemoteException - thrown for errors
    • getAssociatedClass

      public String getAssociatedClass() throws RemoteException
      Description copied from interface: PFieldBean
      Gets the associated class, if any, for this field.
      Specified by:
      getAssociatedClass in interface PFieldBean
      Returns:
      The class name or null.
      Throws:
      RemoteException - thrown for errors
    • setField

      public void setField(Object field) throws RemoteException
      Description copied from interface: PFieldBean
      Sets the value of the field referred to in the modelFieldDescription.
      Specified by:
      setField in interface PFieldBean
      Parameters:
      field - the field's value
      Throws:
      RemoteException - thrown for errors
    • getField

      public Object getField() throws RemoteException
      Description copied from interface: PFieldBean
      Gets the value of the field referred to in the displayFieldDescription.
      Specified by:
      getField in interface PFieldBean
      Returns:
      the field's value
      Throws:
      RemoteException - thrown for errors
    • setHelpID

      public void setHelpID(String id)
      Set the help id for this component.
      Specified by:
      setHelpID in interface PAppFieldComponent
      Parameters:
      id - The new help id.
    • getHelpID

      public String getHelpID()
      Get the current help id for this component
      Specified by:
      getHelpID in interface PAppFieldComponent
      Returns:
      A String help id
    • resetToDefault

      public void resetToDefault()
      Resets the component value to the original value (that which was established by calling setDefault()). If no default value exists, the component data will be cleared.
      Specified by:
      resetToDefault in interface PComponentAttribute
    • clear

      public void clear()
      Removes all data from this table (and its model)
      Specified by:
      clear in interface PComponentAttribute
    • isRequired

      public boolean isRequired()
      Determines if this component is required in its current context. This is currently a visual indicator only - there is no policy to enforce that required fields get filled in.
      Specified by:
      isRequired in interface PComponentAttribute
      Returns:
      true if this field is required
    • setRequired

      public void setRequired(boolean b)
      Marks this component as required in its current context. This is currently a visual indicator only - there is no policy to enforce that required fields get filled in. At this time, the entire table is marked. Eventually cell marking will be allowed.
      Specified by:
      setRequired in interface PComponentAttribute
      Parameters:
      b - the required flag
    • setError

      public void setError(boolean b)
      At this time, the entire table is marked. Eventually cell marking will be allowed.
      Specified by:
      setError in interface PComponentAttribute
      Parameters:
      b - the new state of the Error attribute
    • isError

      public boolean isError()
      Used to determine if this component is currently in error state
      Specified by:
      isError in interface PComponentAttribute
      Returns:
      the error state of this component
    • setInputTracking

      public void setInputTracking(boolean b)
      If input tracking is turned on, any changes made by the user to the component will be tracked and the component will be marked "dirty". If the user modifies the data and returns it to its default/original state, the component will be marked "clean", or not "dirty".
      Specified by:
      setInputTracking in interface PComponentAttribute
      Parameters:
      b - the state of the inputTracking property
    • isInputTracking

      public boolean isInputTracking()
      Description copied from interface: PComponentAttribute
      Determines if input tracking is enabled.
      Specified by:
      isInputTracking in interface PComponentAttribute
      Returns:
      the state of the input tracking flag
    • setClean

      public void setClean()
      Used to reset the component to the 'clean' state. If the component was in dirty or error state, this method will remove those attributes. A required component will still be marked required after a call to this method.
      Specified by:
      setClean in interface PComponentAttribute
    • isDirty

      public boolean isDirty()
      Description copied from interface: PComponentAttribute
      Determines if this component is currently in a DIRTY state.
      Specified by:
      isDirty in interface PComponentAttribute
      Returns:
      true if the user has modified the data represented by this component, false otherwise. It also returns false if input tracking is off.
    • setDefault

      public void setDefault()
      Establishes the current value (or element count, depending on the given component) as the default value. Any modifications after this method is called will result in a "dirty" component.
      Specified by:
      setDefault in interface PComponentAttribute
    • isCurrencyDisplay

      public boolean isCurrencyDisplay()
      Determines if the component is displaying currency data.
      Specified by:
      isCurrencyDisplay in interface PComponentAttribute
      Returns:
      true if the widget is displaying currency data; false otherwise
    • setCurrencyDisplay

      public void setCurrencyDisplay(boolean b)
      Used to determine if this component is displaying currency data. Widgets displaying currency data are capable of automatically toggling their data between 2 Portal currency types (primary invalid input: '&' secondary).
      Specified by:
      setCurrencyDisplay in interface PComponentAttribute
      Parameters:
      b - If true, indicates the widget is displaying currency data.
    • togglePrimaryToSecondary

      public Object togglePrimaryToSecondary(int primary, int secondary) throws RemoteException
      Causes the widget to convert its data using the BEIDManager.
      Specified by:
      togglePrimaryToSecondary in interface PComponentAttribute
      Specified by:
      togglePrimaryToSecondary in interface PFieldBean
      Parameters:
      primary -
      secondary -
      Returns:
      The converted value.
      Throws:
      RemoteException
    • revertToPrimary

      public void revertToPrimary(int primary) throws RemoteException
      Causes the widget to display its data in the primary currency
      Specified by:
      revertToPrimary in interface PComponentAttribute
      Specified by:
      revertToPrimary in interface PFieldBean
      Parameters:
      primary - The primary currency ID for an account
      Throws:
      RemoteException
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Listener for tableChanged events
      Specified by:
      tableChanged in interface TableModelListener
      Overrides:
      tableChanged in class JTable
      Parameters:
      the - change event
    • setModel

      public void setModel(TableModel newModel)
      Establish new data for the table. Note that this will wipe out established renderers/editors if set on a per/column basis.
      Overrides:
      setModel in class JTable
      Parameters:
      newModel - the new data model
    • editingStopped

      public void editingStopped(ChangeEvent e)
      Invoked when editing is finished. The changes are saved, the editor object is discarded, and the cell is rendered once again. Overridden to support marking of the table and/or cells.
      Specified by:
      editingStopped in interface CellEditorListener
      Overrides:
      editingStopped in class JTable
      See Also:
    • setHeaderSortingSupported

      public void setHeaderSortingSupported(boolean b)
      Determines if this component allows data sorting by clicking on a column header.
      Parameters:
      b - If true, sorting will be allowed.
    • sortByColumn

      public void sortByColumn(int column, boolean ascending)
      Causes the table to be sorted according to the specified column.
      Parameters:
      column - the view index of the column
      ascending - if true, the sort will be in ascending order
    • isHeaderSortingSupported

      public boolean isHeaderSortingSupported()
      Determines if this component allows data sorting by clicking on a column header.
      Returns:
      true if sorting is supported in this instance, false otherwise
    • getRowPosition

      public Point getRowPosition(int row)
      Gets the screen position of the given row (at column 0). Useful if you need to position dialogs at a given row.
      Parameters:
      row - The row whose position you wish to retrieve
      Returns:
      The screen position
    • getRowPosition

      public Point getRowPosition(int row, int col)
      Gets the screen position of the given row (at column 0). Useful if you need to position dialogs at a given row.
      Parameters:
      row - The row whose position you wish to retrieve
      col - The col whose position you wish to retrieve
      Returns:
      The screen position
    • setSelectedRows

      public void setSelectedRows(int[] selection)
      Convenience method that sets several selected rows.
      Parameters:
      an - array of ints containing the indices of rows to be selected.
    • setRowBackground

      public void setRowBackground(Color c)
      Specifies the background color for the rows in this component
      Parameters:
      c - The (unselected) row background color
    • getRowBackground

      public Color getRowBackground()
      Returns:
      The background color for the rows in this component
    • setRowBackground

      public void setRowBackground(Color c1, Color c2)
      Specifies the alternating row color scheme for the component
      Parameters:
      c1 - The (unselected) row background color for odd rows
      c2 - The (unselected) row background color for even rows
    • setColumnIdentifiers

      public void setColumnIdentifiers(String[] names)
      Establishes the header names for the table columns
      Parameters:
      names - The array of table column header names
    • getColumnIdentifiers

      public String[] getColumnIdentifiers()
      Retrieves the column names from the column model
      Returns:
      The names of the columns
    • setColumnEditable

      public void setColumnEditable(int col, boolean editable)
      Determines if the end-user can click to edit data in the given column.
      Parameters:
      col - The column whose editability is being changed.
      editable - The flag which determines if the column is editable
    • setDefaultEditor

      public void setDefaultEditor(int col, TableCellEditor editor)
      Specifies the editor which should be used for the given column
      Note that this editor takes precedence over the editor set by specifying the Class type.
      Parameters:
      col - the spreadsheet column for which this editor should be used
      editor - the editor component for this column
    • setDefaultRenderer

      public void setDefaultRenderer(int col, TableCellRenderer renderer)
      Specifies the renderer which should be used for the given column
      Note that this renderer takes precedence over the renderer set by specifying the Class type.
      Parameters:
      col - the spreadsheet column for which this renderer should be used
      renderer - the renderer component for this column
    • setData

      public void setData(Vector data)
      Replaces the current data displayed in the spreadsheet with the given data. This method also attempts to type the data and create appropriate renderers/editors.
      Parameters:
      data - The new data to display
    • setData

      public void setData(Object[][] data)
      Replaces the current data displayed in the spreadsheet with the given data. This method also attempts to type the data and create appropriate renderers/editors.
      Parameters:
      data - The new data to display
    • setColumnData

      public void setColumnData(int column, Vector data)
      Used to specify the data that should be displayed in the given column. If there are fewer items in the data Vector than rows, the remaining rows are left unmodified (as-is). If there are more items in the data Vector than rows, the remaining data items are ignored.
      Parameters:
      column - The column number which should contain the associated data
      data - The data that should be displayed in the given column
    • removeColumn

      public void removeColumn(int col)
      Deletes the specified column of data from the spreadsheet
      Parameters:
      col - the column index to delete
    • resetSortColumn

      public void resetSortColumn(int col)
      Resets the sort state for the specified column.
      Parameters:
      col - the sort column index to reset
    • hideColumn

      public void hideColumn(int modelIndex)
      Hides the specified column of data from the spreadsheet
      Parameters:
      modelIndex - the column index to hide
      See Also:
    • hideColumn

      public void hideColumn(int modelIndex, boolean saveToPref)
      Hides the specified column of data from the spreadsheet and stores in user prefrances so that it is hidden for next use also for the same user
      Parameters:
      modelIndex - the model index of the column to hide
      saveToPref - true if its required to save in prefrances, false otherwise (if false the behaviour of this method will be same as hideColumn(int) method
      See Also:
    • showColumn

      public void showColumn(int modelIndex)
      Shows the specified column of data in the spreadsheet
      Parameters:
      col - the column index to show
      See Also:
    • showColumn

      public void showColumn(int modelIndex, boolean saveToPref)
      Shows the specified column of data in the spreadsheet and stores in user prefrances so that it is displayed for next use also for the same user
      Parameters:
      modelIndex - the model index of the column to show
      saveToPref - true if its required to save in prefrances, false otherwise (if false the behaviour of this method will be same as showColumn(int) method
      See Also:
    • removeRow

      public void removeRow(int row)
      Deletes the specified row of data from the spreadsheet
      Parameters:
      row - the row index to delete
    • addRow

      public void addRow(Vector data)
      Used to append a row of data to the display. If there are fewer items in the data Vector than columns, the remaining columns will be blanked out. If there are more items in the data Vector than columns, the remaining data items are ignored.
      Parameters:
      data - The data that should be displayed in the given row
    • insertRow

      public void insertRow(int row, Vector data)
      Inserts a row of data to the table at the specified position regardless of the sort order. If there are fewer items in the data Vector than columns, the remaining columns will be blanked out. If there are more items in the data Vector than columns, the remaining data items are ignored.
      Parameters:
      row - The row number
      data - The data that should be displayed in the given row
    • getIdxDisplayFieldFormat

      public String[] getIdxDisplayFieldFormat()
      Retrieves the MessageFormat-compliant format pattern that should be used when rendering data in the table columns
      Returns:
      the array of formats
    • getIdxDisplayFieldFormat

      public String getIdxDisplayFieldFormat(int col)
      Retrieves the MessageFormat-compliant format pattern that should be used when rendering data in the given column
      Returns:
      the column format
    • setIdxDisplayFieldFormat

      public void setIdxDisplayFieldFormat(String[] pattern) throws IllegalArgumentException, RemoteException
      Specifies the MessageFormat-compliant format pattern that should be used when rendering data in the table columns. For example, given an IdxDisplayFieldDescription of
      FldNameinfo[any].FldLastName,FldNameinfo[any].FldFirstName
      the format could be
      "{0} {1}" for last name followed by first, or "{1} {0}" for the reverse.
      Likewise, it might be "{0} - {1}" for something like 'smith - john'.
      Parameters:
      pattern - a MessageFormat specific pattern
      Throws:
      RemoteException - re
      IllegalArgumentException - iae
    • setIdxDisplayFieldFormat

      public void setIdxDisplayFieldFormat(int col, String pattern) throws IllegalArgumentException, RemoteException
      Specifies the MessageFormat-compliant format pattern that should be used when rendering data in the given column.
      Parameters:
      col - the spreadsheet column this pattern should be applied to
      pattern - a MessageFormat specific pattern
      Throws:
      RemoteException - re
      IllegalArgumentException - iae
    • getNewRenderer

      protected PFieldComponentRenderer getNewRenderer(String pattern)
      Returns the new instance of PFieldComponentRenderer. This method can be overridden in subclass to return a customized renderer.
      Parameters:
      pattern - format that should be applied to the renderer
      Returns:
      instance of PSubFieldComponentRenderer
    • viewDataChange

      public void viewDataChange(PViewDataChangeEvent event) throws RemoteException
      Implements the PViewDataChangeListener interface
      Specified by:
      viewDataChange in interface PViewDataChangeListener
      Parameters:
      event - the data change event
      Throws:
      RemoteException - e
    • valueChanged

      public void valueChanged(ListSelectionEvent e)
      Implements the ListSelectionListener interface. Called when row selection changes.
      Care must be taken if this component is being fed data directly without a field specification being explicitely set. It becomes the responsibility of the encapsulating component to deal with selection and pass along a meaningful event if necessary.
      Specified by:
      valueChanged in interface ListSelectionListener
      Overrides:
      valueChanged in class JTable
      Parameters:
      e - the event indicating the selection changed
    • setValueAt

      public void setValueAt(Object value, int row, int column)
      Override that maintains the selected rows in case the table is sorted and the view position of rows changes as a result of this call.
      Overrides:
      setValueAt in class JTable
    • setValueAt

      public void setValueAt(Object value, int row, int column, boolean dirtyTable)
      Override that maintains the selected rows in case the table is sorted and the view position of rows changes as a result of this call. Passing true in the last argument causes the table to be marked as dirty - if input tracking is turned on.
    • getModelIndex

      public int getModelIndex(int row)
      Returns the table model index based upon the row index. If the table model being used is an instance of PSorterModel, the model index row from PSorterModel is returned. Otherwise, the index row passed in is returned.
      Parameters:
      row - Table row index.
      Returns:
      the index from the table model.
    • addSpreadSheetListener

      public void addSpreadSheetListener(PSpreadSheetListener l)
      Notify the given listener when the user performs a gesture
      Parameters:
      l - The selection listener
    • removeSpreadSheetListener

      public void removeSpreadSheetListener(PSpreadSheetListener l)
      Remove the given listener from the notification list when the user performs a gesture
      Parameters:
      l - The selection listener
    • addIASelectionListener

      public void addIASelectionListener(PIASelectionListener l)
      Notify the given listener when the table row selection changes
      Parameters:
      l - The selection listener
    • removeIASelectionListener

      public void removeIASelectionListener(PIASelectionListener l)
      Don't notify the given listener when the table row selection changes
      Parameters:
      l - The selection listener
    • convertToVector

      protected Vector convertToVector(Object[][] data)
      Takes the given array and converts it to a Vector of Vectors
      Parameters:
      data - The array to be converted
    • createSSDefaultRenderers

      protected void createSSDefaultRenderers()
    • editorFromType

      protected PTableCellEditor editorFromType(Class c)
      An internal method used to determine the appropriate editor for the given Class type
      Parameters:
      type - the Class type
      Returns:
      the cell editor component
    • setupDefaultModel

      protected void setupDefaultModel()
    • getSavedSelectedRows

      public int[] getSavedSelectedRows()
      Returns the saved selected rows.
      Returns:
      int[] mSavedSelectedRows
    • setLayoutID

      public void setLayoutID(String id)
      Specifies the unique id of this table when storing preferences. It must be set for layout preferences (column width and order) to be saved and restored.
      Parameters:
      id - Unique string identifier of this table
      See Also:
    • saveColumnLayout

      public void saveColumnLayout()
      Saves the column layout order and width to properties object mColProps. The mColLayoutID must be set for layout to be saved. Saves the following properties:
      • table.mColLayoutID.colnum: number of colums
      • table.mColLayoutID.widthcol: column col width
      • table.mColLayoutID.indexcol: column col index in the model, which basically says that column appearing in position col is really column x in the model
      See Also:
    • initColumnLayout

      public void initColumnLayout()
      Initialize layout of the column order and width based on saved preferences. Should be called after table has been set up with columns, probably from addNotify(). For this to work, properties should have been saved into mColProps with saveColumnLayout() method and the mColLayoutID needs to be set to the same ID.
      See Also:
    • getAscendingSortIconWidth

      public int getAscendingSortIconWidth()
      Returns the width for the ascending sort icon. If the ascending sort icon is null, 0 is returned.
    • getAscendingSortIcon

      public Icon getAscendingSortIcon()
      Returns the icon used for to indicate ascending sort.
    • setAscendingSortIcon

      public void setAscendingSortIcon(Icon icon)
      Sets the icon used for to indicate ascending sort.
      Parameters:
      icon - Icon to be used for ascending sort.
    • getDescendingSortIconWidth

      public int getDescendingSortIconWidth()
      Returns the width for the descending sort icon. If the descending sort icon is null, 0 is returned.
    • getDescendingSortIcon

      public Icon getDescendingSortIcon()
      Returns the icon used for to indicate descending sort.
    • setDescendingSortIcon

      public void setDescendingSortIcon(Icon icon)
      Sets the icon used for to indicate descending sort.
      Parameters:
      icon - Icon to be used for descending sort.
    • getExportHandler

      public ActionListener getExportHandler(String caption)
      Retrieves an action listener that can be used to support an "export" command for this table. The handler will be automatically invoked when your UI command element (button, menu item, etc) is selected.
      The handler will display a file chooser through which the user can select a location and file name for saving the exported data. They will be forced to select a new file; they will not be allowed to choose a file that already exists.
      This handler will generate a complete HTML "page" including beginning/ending tags. If you want more control over the output, or want to combine multiple tables into one page use the export() method explicitely instead.
      Parameters:
      caption - A caption to display above the table. Can be used to to identify the table's contents.
    • getExportHandler

      public ActionListener getExportHandler(String caption, ExportTemplate h)
      Retrieves an action listener that can be used to support an "export" command for this table. The handler will be automatically invoked when your UI command element (button, menu item, etc) is selected.
      The handler will display a file chooser through which the user can select a location and file name for saving the exported data. They will be forced to select a new file; they will not be allowed to choose a file that already exists.
      This handler will generate a complete HTML "page" including beginning/ending tags.
      The ExportTemplate implementation will be called to retrieve data that will be written out above the table. This provides the caller an opportunity to write out "extra" data that might be useful for the users of this exported data. If this parameter is null it will be ignored.
      If you want even more control over the output, or want to combine multiple tables into one page use the export() method explicitely instead.
      Parameters:
      caption - A caption to display above the table. Can be used to to identify the table's contents.
      If - not null, identifies a provider of HTML data exported along with (above) the table data. The purpose of this data is to provide context (name, date, etc.) of the exported data.
    • export

      public void export(BufferedWriter bw, String caption) throws IOException, UnsupportedEncodingException
      Exports the table's data, as displayed on the screen, to the given FileOutputStream as HTML data. Note that this method will not write out the beginning/closing html tags; this enables the caller to export multiple tables on one stream, or to combine this data with HTML data from another source.
      Parameters:
      bw - The stream to export the data to
      caption - A caption to display above the table. Can be used to to identify the table's contents.
      Throws:
      IOException
      UnsupportedEncodingException
    • htmlProcess

      protected String htmlProcess(String s)
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener