Class SourcePanel

java.lang.Object
PamView.dialog.SourcePanel
All Implemented Interfaces:
ActionListener, EventListener
Direct Known Subclasses:
EffortSourcePanel, GroupedSourcePanel, PlaybackSourcePanel

public class SourcePanel extends Object implements ActionListener
Standard panel for dialogs that shows a list of available data sources and, optionally a list of data channels.

This is for general use within other dialog panels.

Author:
Doug Gillespie
  • Field Details Link icon

    • panel Link icon

      protected JPanel panel
    • sourceTypes Link icon

      protected ArrayList<Class> sourceTypes
    • hasChannels Link icon

      protected boolean hasChannels
    • borderTitle Link icon

      protected String borderTitle
    • includeSubClasses Link icon

      protected boolean includeSubClasses
    • sourceList Link icon

      protected JComboBox<PamDataBlock> sourceList
    • channelBoxes Link icon

      protected JCheckBox[] channelBoxes
    • ownerWindow Link icon

      protected Window ownerWindow
    • excludedBlocks Link icon

      protected ArrayList<PamDataBlock> excludedBlocks
  • Constructor Details Link icon

    • SourcePanel Link icon

      public SourcePanel(Window ownerWindow, String borderTitle, Class sourceType, boolean hasChannels, boolean includeSubClasses)
      Construct a panel with a titles border
      Parameters:
      ownerWindow - parentWindow
      borderTitle - Title to go in border
      sourceType - Data Source type
      hasChannels - Include a set of checkboxes to list available channels
      includeSubClasses - inlcude all subclasses of sourceType in the list.
    • SourcePanel Link icon

      public SourcePanel(Window ownerWindow, Class sourceType, boolean hasChannels, boolean includeSubClasses)
      Construct a panel without a border
      Parameters:
      ownerWindow - Parent window
      sourceType - Data Source type
      hasChannels - Include a set of checkboxes to list available channels
      include - subclasses of the sourceType
  • Method Details Link icon

    • setEnabled Link icon

      public void setEnabled(boolean enabled)
    • setEnabledWithChannels Link icon

      public void setEnabledWithChannels(boolean enabled)
    • addSelectionListener Link icon

      public void addSelectionListener(ActionListener listener)
      Add a listener to the data source drop down list
      Parameters:
      listener - listener
    • selectionChanged Link icon

      protected void selectionChanged(int channel)
    • createPanel Link icon

      protected void createPanel()
    • selectNoChannels Link icon

      protected void selectNoChannels()
    • selectAllChannels Link icon

      protected void selectAllChannels()
    • actionPerformed Link icon

      public void actionPerformed(ActionEvent e)
      action listener to update channel list when a a different source is selected
      Specified by:
      actionPerformed in interface ActionListener
    • sourceChanged Link icon

      protected void sourceChanged()
    • showChannels Link icon

      protected void showChannels()
    • rePackOwner Link icon

      protected void rePackOwner(int channelsMap)
      Repack the owner window if the number of channels has changed
      Parameters:
      channelsMap - bitmap of used channels.
    • setSource Link icon

      public boolean setSource(String sourceName)
      Set the current data source using the data source name
      Parameters:
      sourceName -
      Returns:
      true if OK
    • setSource Link icon

      public void setSource(PamDataBlock sourceBlock)
      Set the current data source by block reference
      Parameters:
      sourceBlock -
    • setSourceIndex Link icon

      public void setSourceIndex(int sourceIndex)
    • setSourceList Link icon

      public boolean setSourceList()
      Fill the list of available data sources, taking into account the list of excluded sources
      Returns:
      sets a list of available sources. Returns false if no sources are available.
    • setSourceList Link icon

      public boolean setSourceList(boolean replaceChosen)
    • getCompatibleDataBlocks Link icon

      public ArrayList<PamDataBlock> getCompatibleDataBlocks()
    • getSource Link icon

      public PamDataBlock getSource()
      return the selected data source
      Returns:
      source data block
    • getSourceName Link icon

      public String getSourceName()
      Returns:
      the source data block name, or null if nothing selected.
    • getChannelList Link icon

      public int getChannelList()
      Get a list of selected channels or sequences (depending on the source)
      Returns:
      bitmap of selected channels
    • setChannelList Link icon

      public void setChannelList(int channelList)
      Set the current channel selection Only enables channels that are available (remainder are silently disabled).
      Parameters:
      channelList - bitmap of currently selected channels
    • addSourceType Link icon

      public void addSourceType(Class sourceType)
    • getSourceIndex Link icon

      public int getSourceIndex()
      Get the currently selected source index
      Returns:
      source index within the source list
    • getPanel Link icon

      public JPanel getPanel()
      Get a reference to the JPanel containing the controls
      Returns:
      JPanel container
    • excludeDataBlock Link icon

      public void excludeDataBlock(PamDataBlock block, boolean exclude)
      Exclude specific data blocks from the source list. e.g. a process would normally not be able to use it's own output data block as an input source and should therefore exclude it from the list.
      Parameters:
      block - PamDataBlock to exlcude
      exclude - true - excluse; false - allow
    • clearExcludeList Link icon

      public void clearExcludeList()
      Clear the list of excluded data blocks.
    • getChannelBoxes Link icon

      public JCheckBox[] getChannelBoxes()
    • getLocalisationRequirements Link icon

      public int getLocalisationRequirements()
    • setLocalisationRequirements Link icon

      public void setLocalisationRequirements(int localisationRequirements)
    • getSourceCount Link icon

      public int getSourceCount()
      Get the number of items in the list.
      Returns:
      number of sources of this type of data
    • addSourcePanelMonitor Link icon

      public void addSourcePanelMonitor(SourcePanelMonitor gspm)
    • removeSourcePanelMonitor Link icon

      public void removeSourcePanelMonitor(SourcePanelMonitor gspm)
    • setSourceToolTip Link icon

      public void setSourceToolTip(String toolTip)
      Set a tooltip text for the source panel.
      Parameters:
      toolTip - Tooltip text.
    • isAllowNull Link icon

      public boolean isAllowNull()
      Returns:
      the allowNull
    • setAllowNull Link icon

      public void setAllowNull(boolean allowNull)
      Allow a null selection.
      Parameters:
      allowNull - the allowNull to set