Class IrisTable

All Implemented Interfaces:
Linkable, LinkContainer, LinkSource, LinkTarget, ViewIdSink, Workspace, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class IrisTable extends GuiTable implements LinkTarget, LinkSource, LinkContainer, ViewIdSink
The GUI component for rendering tables within the IrisConsole. Extends the standard GuiTable with appropriate context menus, and a transfer handler for viewports.
See Also:
  • Field Details

    • log

      protected final com.fishlib.io.logger.Logger log
  • Constructor Details

  • Method Details

    • setColumnCreateOverride

      public static void setColumnCreateOverride(Class<?> columnType, IrisTable.ColumnCreateOverride columnCreateOverride)
      Set an override function for creating columns of a given type.
      Parameters:
      columnType - the type of the column we will override the create function for
      columnCreateOverride - an instance of ColumnCreateOverride for this column type
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Specified by:
      tableChanged in interface TableModelListener
      Overrides:
      tableChanged in class GuiTable
    • getLayoutHints

      public LayoutHintBuilder getLayoutHints()
    • createTransferHandler

      protected TransferHandler createTransferHandler()
      Description copied from class: GuiTable
      Creates the transfer handler.
      Overrides:
      createTransferHandler in class GuiTable
      Returns:
      the transfer handler
    • setFreezeColumnsManager

      public void setFreezeColumnsManager(FreezeColumnsManager freezeColumnsManager)
      Description copied from class: GuiTable
      Sets the FreezeColumnsManager to allow this GuiTable to support Freeze Columns.
      Overrides:
      setFreezeColumnsManager in class GuiTable
      Parameters:
      freezeColumnsManager - the FreezeColumnsManager
    • getFreezeColumnsManager

      public FreezeColumnsManager getFreezeColumnsManager()
      Description copied from class: GuiTable
      Gets the FreezeColumnsManager. This will be null if the table does no support Freeze Columns.
      Overrides:
      getFreezeColumnsManager in class GuiTable
      Returns:
      the FreezeColumnsManager, null if Freeze Columns are not supported
    • setModel

      public void setModel(IrisTableModel model)
      Overrides:
      setModel in class GuiTable
    • maybeAddSelectionModel

      protected void maybeAddSelectionModel()
      Overrides:
      maybeAddSelectionModel in class GuiTable
    • getHeaderToolTipText

      public String getHeaderToolTipText(MouseEvent e)
      Overrides:
      getHeaderToolTipText in class GuiTable
    • getToolTipText

      public String getToolTipText(@NotNull MouseEvent e)
      Overrides:
      getToolTipText in class JTable
    • processSingleClick

      protected void processSingleClick(int row, int col, MouseEvent e)
      Description copied from class: GuiTable
      Process a single click. The base method does nothing and may be overridden.
      Overrides:
      processSingleClick in class GuiTable
      Parameters:
      row - The row clicked.
      col - The column clicked.
      e - The details of the click event.
    • processDoubleClick

      public void processDoubleClick(int row, int col, MouseEvent e)
      Description copied from class: GuiTable
      Process a double click. The base method does nothing and may be overridden.
      Overrides:
      processDoubleClick in class GuiTable
      Parameters:
      row - The row clicked.
      col - The column clicked.
      e - The details of the click event.
    • updateLinkTargets

      public void updateLinkTargets(int row, IrisTableModel model)
    • processHeaderClick

      protected void processHeaderClick(int col, MouseEvent e)
      Description copied from class: GuiTable
      Process a header single or double click. The base method creates a TableHeaderPopup but may be overridden.
      Overrides:
      processHeaderClick in class GuiTable
      Parameters:
      col - The column clicked.
      e - The details of the click event.
    • addPopupProvider

      public void addPopupProvider(PopupProvider provider)
    • removePopupProvider

      public void removePopupProvider(PopupProvider provider)
    • isLinked

      public boolean isLinked()
      Specified by:
      isLinked in interface Linkable
      Returns:
      If this target has any links.
    • addTarget

      public void addTarget(LinkTarget target)
      Description copied from interface: LinkSource
      Add the specified target to this Source's list of links.
      Specified by:
      addTarget in interface LinkSource
      Parameters:
      target - The target to add.
    • removeTarget

      public void removeTarget(LinkTarget target)
      Description copied from interface: LinkSource
      Remove the specified Target from this source's notification list.
      Specified by:
      removeTarget in interface LinkSource
      Parameters:
      target - The target to remove.
    • makeLink

      public void makeLink(LinkSource from, String sourceColumn, String targetColumn, Condition condition)
      Description copied from interface: LinkTarget
      Create a link from sourceColumn on a LinkSource to the targetColumn of this LinkTarget using the specified Condition as a filter condition
      Specified by:
      makeLink in interface LinkTarget
      Parameters:
      from - The source of the filter link.
      sourceColumn - The source column of the filter link
      targetColumn - The column to compare to the sourceColumn
      condition - The condition to apply to the matching
    • removeLink

      public void removeLink(LinkSource from, String srcColumn, String targetColumn, Condition condition)
      Description copied from interface: LinkTarget
      Remove a link between the specified columns and condition between this target and it's source. Note that for a link to be removed all of the specified parameters must match what was added via LinkTarget.makeLink(LinkSource, String, String, Condition).
      Specified by:
      removeLink in interface LinkTarget
      Parameters:
      from - The source to remove a link to
      srcColumn - The column link being removed
      targetColumn - The column being linked to
      condition - The condition of the filter
    • removeAllLinks

      public void removeAllLinks(LinkSource from)
      Description copied from interface: LinkTarget
      Remove all column filter links between this object and the specified source.
      Specified by:
      removeAllLinks in interface LinkTarget
      Parameters:
      from - The source of the links to remove.
    • removeAllLinks

      public void removeAllLinks()
      Description copied from interface: Linkable
      Remove all target links from this source.
      Specified by:
      removeAllLinks in interface Linkable
    • getLinkableColumns

      @NotNull public List<String> getLinkableColumns()
      Specified by:
      getLinkableColumns in interface Linkable
      Returns:
      A list of columns available to be linked to.
    • getAllowedConditions

      @NotNull public Collection<Condition> getAllowedConditions(String columnName)
      Specified by:
      getAllowedConditions in interface Linkable
      Returns:
    • getId

      @NotNull public String getId()
      Specified by:
      getId in interface Linkable
      Returns:
      The ID that uniquely identifies this Linkable.
    • getFriendlyName

      @NotNull public String getFriendlyName()
      Specified by:
      getFriendlyName in interface Linkable
      Returns:
      A user friendly name for UI presentation.
    • getType

      public String getType()
    • getViewId

      public String getViewId()
    • getLinks

      public Map<LinkSource,Collection<LinkDescriptor>> getLinks()
      Specified by:
      getLinks in interface LinkTarget
      Returns:
      A collection of all links attached to this target.
    • getLinks

      public Collection<LinkDescriptor> getLinks(LinkSource source)
      Specified by:
      getLinks in interface LinkTarget
      Parameters:
      source - The source to check links from.
      Returns:
      A collection of all links between the specified source and this target.
    • getClearFiltersBeforeUpdate

      public boolean getClearFiltersBeforeUpdate()
      Description copied from interface: LinkTarget
      Indicates if a Link Target will clear its filters before an update.
      Specified by:
      getClearFiltersBeforeUpdate in interface LinkTarget
      Returns:
      true if it will clear, false otherwise
    • setClearFiltersBeforeUpdate

      public void setClearFiltersBeforeUpdate(boolean shouldClear)
      Description copied from interface: LinkTarget
      Sets if a Link Target should clear its filters before an update.
      Specified by:
      setClearFiltersBeforeUpdate in interface LinkTarget
      Parameters:
      shouldClear - true to clear, false otherwise
    • getTargets

      public Collection<LinkTarget> getTargets()
      Specified by:
      getTargets in interface LinkSource
      Returns:
      A collection of all the targets this source affects.
    • update

      public void update(LinkEvent event)
      Description copied from interface: LinkTarget
      Notify this LinkTarget of an event from a source.
      Specified by:
      update in interface LinkTarget
      Parameters:
      event - A LinkEvent containing the details of the event.
    • applyDefaultFilters

      public void applyDefaultFilters()
      Description copied from interface: LinkTarget
      Requests that LinkTarget apply its own default filters (if any) to a column.
      Specified by:
      applyDefaultFilters in interface LinkTarget
    • getCurrentFilters

      public org.jdom2.Element getCurrentFilters()
      Description copied from interface: LinkTarget
      Return a persistable copy of the current filters (if any).
      Specified by:
      getCurrentFilters in interface LinkTarget
    • applyFilters

      public void applyFilters(org.jdom2.Element filters)
      Description copied from interface: LinkTarget
      Requests that LinkTarget apply a saved filter state
      Specified by:
      applyFilters in interface LinkTarget
      Parameters:
      filters - The saved workspace data to apply.
    • applyFilters

      public void applyFilters(String column, Collection<FilterData> filters)
      Description copied from interface: LinkTarget
      Requests that LinkTarget apply a collection of filters to a column.
      Specified by:
      applyFilters in interface LinkTarget
      Parameters:
      column - the column to filter
      filters - the filters to apply
    • getSourceLinkColumns

      public Set<String> getSourceLinkColumns()
      Specified by:
      getSourceLinkColumns in interface LinkSource
      Returns:
      A set of all the columns for which this source is linked.
    • getView

      public IrisView getView()
    • readyForLinks

      public boolean readyForLinks()
      Specified by:
      readyForLinks in interface Linkable
      Returns:
      If this linkable can accept links.
    • getComponent

      @Nullable public JComponent getComponent()
      Description copied from interface: Linkable
      Get's the UI component for this Linkable. If this Linkable is not a UI component, implementations may return null.
      Specified by:
      getComponent in interface Linkable
      Returns:
      The component of this Linkable or null if there was none
    • setView

      public void setView(@NotNull IrisView newView)
      Specified by:
      setView in interface ViewIdSink
    • close

      public void close()
    • getLinkable

      public Linkable getLinkable()
      Description copied from interface: LinkContainer
      Return the underlying linkable object.
      Specified by:
      getLinkable in interface LinkContainer
      Returns:
      The underlying linkable object.
    • getTrueTarget

      public LinkTarget getTrueTarget()
      Description copied from interface: LinkTarget
      Gets the true target if this link target is a proxy.
      Specified by:
      getTrueTarget in interface LinkTarget
      Returns:
      the true target for this link
    • getTrueSource

      public LinkSource getTrueSource()
      Description copied from interface: LinkSource
      Gets the true link source if this is a proxy link.
      Specified by:
      getTrueSource in interface LinkSource
      Returns:
      the true link source
    • getTrueLinkable

      public Linkable getTrueLinkable()
      Description copied from interface: Linkable
      Gets the true linkable if this is a proxy.
      Specified by:
      getTrueLinkable in interface Linkable
      Returns:
      the true linkable
    • areSavedLayoutsAllowed

      protected boolean areSavedLayoutsAllowed()
      Overrides:
      areSavedLayoutsAllowed in class GuiTable
    • getFrontColumns

      @NotNull protected Set<String> getFrontColumns()
      Overrides:
      getFrontColumns in class GuiTable
    • getBackColumns

      @NotNull protected Set<String> getBackColumns()
      Overrides:
      getBackColumns in class GuiTable
    • getAutoFilterColumns

      @NotNull protected Set<String> getAutoFilterColumns()
      Overrides:
      getAutoFilterColumns in class GuiTable
    • getFreezeColumns

      @NotNull protected Set<String> getFreezeColumns()
      Overrides:
      getFreezeColumns in class GuiTable
    • getHiddenColumns

      @NotNull protected Set<String> getHiddenColumns()
      Overrides:
      getHiddenColumns in class GuiTable
    • getViewportAdjuster

      public ViewportAdjuster getViewportAdjuster()
    • setColumnFormatter

      protected void setColumnFormatter(String columnName, org.jdom2.Element formatInfo)
      Description copied from class: GuiTable
      Sets the column formatter from workspace info. The default implementation does nothing but subclasses should override this method to create the correct concrete formatter.
      Overrides:
      setColumnFormatter in class GuiTable
      Parameters:
      columnName - the name of the column
      formatInfo - element containing workspace info
    • isTreeTable

      public boolean isTreeTable()
    • getCellRenderer

      public TableCellRenderer getCellRenderer(int row, int column)
      Overrides:
      getCellRenderer in class JTable
    • getWorkspaceInfo

      public org.jdom2.Element getWorkspaceInfo()
      Description copied from interface: Workspace
      Serialize the class into an element to be stored in the workspace
      Specified by:
      getWorkspaceInfo in interface Workspace
      Overrides:
      getWorkspaceInfo in class GuiTable
      Returns:
      An Element containing the data to persist.
    • getCurrentWorkspace

      public org.jdom2.Element getCurrentWorkspace()
      Get the workspace for the visible table. This bypasses any indirection that may happen when a UI applied rollup happens. This should only be used by RollupHelper to save the state of the rollup itself.
      Returns:
      the workspace of the table.
    • setWorkspaceInfo

      public void setWorkspaceInfo(org.jdom2.Element workspaceInfo)
      Description copied from interface: Workspace
      Restore the class to the state defined by the data persisted in workspaceInfo
      Specified by:
      setWorkspaceInfo in interface Workspace
      Overrides:
      setWorkspaceInfo in class GuiTable
      Parameters:
      workspaceInfo - An Element containing the persisted state.
    • setWorkspaceInfo

      public void setWorkspaceInfo(org.jdom2.Element workspaceInfo, boolean addRollupListener)
    • createFilterMenu

      public JMenu createFilterMenu(GuiColumn column, FilterStrategyImpl filterStrategy)
      Description copied from class: GuiTable
      Creates a menu for the Filter by... option.
      Overrides:
      createFilterMenu in class GuiTable
      Parameters:
      column - the column to filter
      filterStrategy - the filter strategy for the model
      Returns:
      a new filter menu