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
  • Constructor Details

    • SourcePanel

      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

      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

    • setEnabled

      public void setEnabled(boolean enabled)
    • setEnabledWithChannels

      public void setEnabledWithChannels(boolean enabled)
    • addSelectionListener

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

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

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

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

      public void setSourceIndex(int sourceIndex)
    • setSourceList

      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

      public boolean setSourceList(boolean replaceChosen)
    • getCompatibleDataBlocks

      public ArrayList<PamDataBlock> getCompatibleDataBlocks()
    • getSource

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

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

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

      public void setChannelList(int channelList)
      Set the current channel selection
      Parameters:
      channelList - bitmap of currently selected channels
    • addSourceType

      public void addSourceType(Class sourceType)
    • getSourceIndex

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

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

      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

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

      public JCheckBox[] getChannelBoxes()
    • getLocalisationRequirements

      public int getLocalisationRequirements()
    • setLocalisationRequirements

      public void setLocalisationRequirements(int localisationRequirements)
    • getSourceCount

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

      public void addSourcePanelMonitor(SourcePanelMonitor gspm)
    • removeSourcePanelMonitor

      public void removeSourcePanelMonitor(SourcePanelMonitor gspm)
    • setSourceToolTip

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

      public boolean isAllowNull()
      Returns:
      the allowNull
    • setAllowNull

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