Class CpmPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TabClosedListener, FileSelectorListener, TransportControlListener

The Class CpmPanel.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      The Constant serialVersionUID.
      See Also:
    • HELP_MESSAGE

      public static final String HELP_MESSAGE
      The Constant HELP_MESSAGE.
      See Also:
    • PREFS_CPE_DESCRIPTOR_FILE

      private static final String PREFS_CPE_DESCRIPTOR_FILE
      The Constant PREFS_CPE_DESCRIPTOR_FILE.
      See Also:
    • PREFS_SAVE_USING_IMPORTS

      private static final String PREFS_SAVE_USING_IMPORTS
      The Constant PREFS_SAVE_USING_IMPORTS.
      See Also:
    • openCpeDescMenuItem

      private JMenuItem openCpeDescMenuItem
      The open cpe desc menu item.
    • saveCpeDescMenuItem

      private JMenuItem saveCpeDescMenuItem
      The save cpe desc menu item.
    • refreshMenuItem

      private JMenuItem refreshMenuItem
      The refresh menu item.
    • clearAllMenuItem

      private JMenuItem clearAllMenuItem
      The clear all menu item.
    • mainSplitPane

      private JSplitPane mainSplitPane
      The main split pane.
    • readerInitializerSplitPane

      private JSplitPane readerInitializerSplitPane
      The reader initializer split pane.
    • collectionReaderPanel

      private CpmPanel.ResetableMetaDataPanel collectionReaderPanel
      The collection reader panel.
    • collectionReaderTitledBorder

      private TitledBorder collectionReaderTitledBorder
      The collection reader titled border.
    • casInitializerPanel

      private CpmPanel.ResetableMetaDataPanel casInitializerPanel
      The cas initializer panel.
    • casInitializerTitledBorder

      private TitledBorder casInitializerTitledBorder
      The cas initializer titled border.
    • readerFileSelector

      private FileSelector readerFileSelector
      The reader file selector.
    • casInitializerFileSelector

      private FileSelector casInitializerFileSelector
      The cas initializer file selector.
    • aeMainPanel

      private JPanel aeMainPanel
      The ae main panel.
    • aeTabbedPane

      private JTabbedPaneWithCloseIcons aeTabbedPane
      The ae tabbed pane.
    • moveAeRightButton

      private JButton moveAeRightButton
      The move ae right button.
    • moveAeLeftButton

      private JButton moveAeLeftButton
      The move ae left button.
    • addAeButton

      private JButton addAeButton
      The add ae button.
    • aeTitledBorder

      private TitledBorder aeTitledBorder
      The ae titled border.
    • consumersPanel

      private JPanel consumersPanel
      The consumers panel.
    • consumerTitledBorder

      private TitledBorder consumerTitledBorder
      The consumer titled border.
    • addConsumerButton

      private JButton addConsumerButton
      The add consumer button.
    • moveConsumerRightButton

      private JButton moveConsumerRightButton
      The move consumer right button.
    • moveConsumerLeftButton

      private JButton moveConsumerLeftButton
      The move consumer left button.
    • consumerTabbedPane

      private JTabbedPaneWithCloseIcons consumerTabbedPane
      The consumer tabbed pane.
    • aeSpecifiers

      private Vector aeSpecifiers
      The ae specifiers.
    • consumerSpecifiers

      private Vector consumerSpecifiers
      The consumer specifiers.
    • progressBar

      private JProgressBar progressBar
      The progress bar.
    • transportControlPanel

      private TransportControlPanel transportControlPanel
      The transport control panel.
    • startButton

      private AbstractButton startButton
      The start button.
    • stopButton

      private AbstractButton stopButton
      The stop button.
    • statusLabel

      private JLabel statusLabel
      The status label.
    • progressTimer

      private Timer progressTimer
      The progress timer.
    • elapsedTime

      private int elapsedTime
      The elapsed time.
    • performanceQueryTimer

      private Timer performanceQueryTimer
      The performance query timer.
    • collectionReaderDesc

      private CollectionReaderDescription collectionReaderDesc
      The collection reader desc.
    • casInitializerDesc

      private CasInitializerDescription casInitializerDesc
      The cas initializer desc.
    • mCPE

      The m CPE.
    • indeterminateProgressPause

      private boolean indeterminateProgressPause
      The indeterminate progress pause.
    • aeFileChooser

      private JFileChooser aeFileChooser
      The ae file chooser.
    • consumerFileChooser

      private JFileChooser consumerFileChooser
      The consumer file chooser.
    • openSaveFileChooser

      private JFileChooser openSaveFileChooser
      The open save file chooser.
    • fileChooserRootDir

      private File fileChooserRootDir
      The file chooser root dir.
    • collectionReaderLastFileSyncTimestamp

      private long collectionReaderLastFileSyncTimestamp
      The collection reader last file sync timestamp.
    • casInitializerLastFileSyncTimestamp

      private long casInitializerLastFileSyncTimestamp
      The cas initializer last file sync timestamp.
    • lastFileSyncUserPromptTime

      private long lastFileSyncUserPromptTime
      The last file sync user prompt time.
    • prefs

      private Preferences prefs
      Stores user preferences.
    • mShuttingDown

      private boolean mShuttingDown
      The m shutting down.
    • mPaused

      private boolean mPaused
      The m paused.
    • selectedComponentsChanged

      private boolean selectedComponentsChanged
      The selected components changed.
    • viewCasInitializerPanelMenuItem

      private JMenuItem viewCasInitializerPanelMenuItem
      The view cas initializer panel menu item.
    • currentCpeDesc

      private CpeDescription currentCpeDesc
      The current cpe desc.
    • defaultResourceManager

      private final ResourceManager defaultResourceManager
      The default resource manager.
    • saveUsingImports

      private boolean saveUsingImports
      The save using imports.
    • saveUsingImportMenuItem

      private JCheckBoxMenuItem saveUsingImportMenuItem
      The save using import menu item.
  • Constructor Details

    • CpmPanel

      public CpmPanel()
      Instantiates a new cpm panel.
  • Method Details

    • initFileChoosers

      private void initFileChoosers()
      Initialize the file choosers. This is called initially from the constructor but can be called again to reset the file choosers to their default state.
    • getParentFrame

      private Frame getParentFrame()
      Gets the parent frame.
      Returns:
      the parent frame
    • createFileMenuItems

      public List createFileMenuItems()
      Creates JMenuItems that should be added to the File menu.
      Returns:
      a List of JMenuItems
    • createViewMenuItems

      public List createViewMenuItems()
      Creates JMenuItems that should be added to the View menu.
      Returns:
      a List of JMenuItems
    • setCasInitializerPanelVisible

      private void setCasInitializerPanelVisible(boolean visible)
      Sets the cas initializer panel visible.
      Parameters:
      visible - the new cas initializer panel visible
    • readPreferences

      private void readPreferences()
      Read preferences.
    • setSaveUsingImports

      private void setSaveUsingImports(boolean b)
      Sets the save using imports.
      Parameters:
      b - the new save using imports
    • startProcessing

      private void startProcessing()
      Start processing.
    • updateCpeDescriptionParameterOverrides

      private void updateCpeDescriptionParameterOverrides() throws Exception
      Updates the configuration parameter settings in this.currentCpeDesc to match the current state of the GUI.
      Throws:
      Exception - the exception
    • createParameterOverrides

      private void createParameterOverrides(CasProcessorConfigurationParameterSettings aSettings, MetaDataPanel aPanel) throws CpeDescriptorException
      Called by createCpeDescription to add configuration parameter overrides to the CpeDescription being constructed, based on the user's changes in the GUI.
      Parameters:
      aSettings - the CasProcessorConfigurationParameterSettings element that will be modified
      aPanel - the GUI panel representing settings for the CAS Processor
      Throws:
      CpeDescriptorException - the cpe descriptor exception
    • clearDirty

      private void clearDirty()
      Marks all fields as not dirty. To be called when CPE descriptor is opened or saved.
    • actionPerformed

      public void actionPerformed(ActionEvent ev)
      Specified by:
      actionPerformed in interface ActionListener
    • clearAll

      private void clearAll()
      Resets the GUI to an empty state.
    • createEmptyCpeDescription

      private CpeDescription createEmptyCpeDescription()
      Creates the empty cpe description.
      Returns:
      the cpe description
    • saveCpeDescriptor

      private void saveCpeDescriptor()
      Prompt user for file to save CPE Descriptor to, and do the save.
    • doSaveCpeDescriptor

      private void doSaveCpeDescriptor(File aFile) throws Exception
      Do save cpe descriptor.
      Parameters:
      aFile - the a file
      Throws:
      Exception - the exception
    • updateImports

      private void updateImports(File cpeDescSaveFile) throws Exception
      Update imports.
      Parameters:
      cpeDescSaveFile - the cpe desc save file
      Throws:
      Exception - the exception
    • updateImport

      private void updateImport(CpeComponentDescriptor descriptor, File cpeDescSaveFile) throws Exception
      Update import.
      Parameters:
      descriptor - the descriptor
      cpeDescSaveFile - the cpe desc save file
      Throws:
      Exception - the exception
    • urlToFile

      private File urlToFile(URL url) throws URISyntaxException
      Utility method for convertion a URL to a File name, taking care of proper escaping.
      Parameters:
      url - a URL
      Returns:
      File corresponding to that URL
      Throws:
      URISyntaxException - the URI syntax exception
    • displayProgress

      private void displayProgress()
      Display progress.
    • confirmExit

      public boolean confirmExit()
      Ask user to confirm exist. Return true if they confirm, false if not.
      Returns:
      true, if successful
    • checkForOutOfSyncFiles

      public void checkForOutOfSyncFiles()
      Check for out of sync files.
    • refreshOutOfSyncFiles

      public void refreshOutOfSyncFiles()
      Refresh out of sync files.
    • displayError

      public void displayError(String aErrorString)
      Displays an error message to the user.
      Parameters:
      aErrorString - error message to display
    • displayError

      public void displayError(Throwable aThrowable)
      Displays an error message to the user.
      Parameters:
      aThrowable - Throwable whose message is to be displayed.
    • populateCollectionReaderPanel

      private boolean populateCollectionReaderPanel(CpeCollectionReaderIterator cpeColRdr) throws InvalidXMLException, IOException, ResourceConfigurationException
      Populate collection reader panel.
      Parameters:
      cpeColRdr - the cpe col rdr
      Returns:
      true, if successful
      Throws:
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • populateCasInitializerPanel

      private boolean populateCasInitializerPanel(CpeCollectionReaderCasInitializer cpeCasIni) throws InvalidXMLException, IOException, ResourceConfigurationException
      Populate cas initializer panel.
      Parameters:
      cpeCasIni - the cpe cas ini
      Returns:
      true, if successful
      Throws:
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • addAE

      Adds the AE.
      Parameters:
      aeSpecifierFile - the ae specifier file
      Throws:
      CpeDescriptorException - the cpe descriptor exception
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • addAE

      Adds the AE.
      Parameters:
      cpeCasProc - the cpe cas proc
      Returns:
      true, if successful
      Throws:
      CpeDescriptorException - the cpe descriptor exception
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • addConsumer

      private void addConsumer(String consumerSpecifierFile) throws CpeDescriptorException, InvalidXMLException, IOException, ResourceConfigurationException
      Adds the consumer.
      Parameters:
      consumerSpecifierFile - the consumer specifier file
      Throws:
      CpeDescriptorException - the cpe descriptor exception
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • addConsumer

      Adds the consumer.
      Parameters:
      cpeCasProc - the cpe cas proc
      Returns:
      true, if successful
      Throws:
      CpeDescriptorException - the cpe descriptor exception
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      ResourceConfigurationException - the resource configuration exception
    • makeUniqueCasProcessorName

      private String makeUniqueCasProcessorName(String baseName)
      Make unique cas processor name.
      Parameters:
      baseName - the base name
      Returns:
      the string
    • removeAllAEsAndConsumers

      private void removeAllAEsAndConsumers()
      Removes the all A es and consumers.
    • fileSelected

      public boolean fileSelected(JComponent source, String fileString)
      Description copied from interface: FileSelectorListener
      File selected.
      Specified by:
      fileSelected in interface FileSelectorListener
      Parameters:
      source - the source
      fileString - the file string
      Returns:
      true, if successful
    • tabClosed

      public void tabClosed(JTabbedPaneWithCloseIcons source, int tabPos)
      Description copied from interface: TabClosedListener
      Tab closed.
      Specified by:
      tabClosed in interface TabClosedListener
      Parameters:
      source - the JTabbedPaneWithCloseIcons control sending this event
      tabPos - position of the tab that was closed
    • controlStarted

      public void controlStarted()
      Description copied from interface: TransportControlListener
      Control started.
      Specified by:
      controlStarted in interface TransportControlListener
    • controlPaused

      public void controlPaused()
      Description copied from interface: TransportControlListener
      Control paused.
      Specified by:
      controlPaused in interface TransportControlListener
    • controlResumed

      public void controlResumed()
      Description copied from interface: TransportControlListener
      Control resumed.
      Specified by:
      controlResumed in interface TransportControlListener
    • controlStopped

      public void controlStopped()
      Description copied from interface: TransportControlListener
      Control stopped.
      Specified by:
      controlStopped in interface TransportControlListener
    • resetScreen

      private void resetScreen()
      Reset screen.
    • setFrameEnabled

      private void setFrameEnabled(boolean onOff)
      Called to lock the GUI while processing is occurring. We don't actually disable the JFrame, because we don't want to disable the stop/pause buttons. Instead we disable all of the controls that the user shouldn't mess with while processing is occurring.
      Parameters:
      onOff - true to enable, false to disable
    • onCompletion

      public void onCompletion()
      On completion.
    • printStats

      public void printStats()
      Prints the stats.
    • isDirty

      private boolean isDirty()
      Returns whether the GUI is dirty; that is, whether configuration settings have been modified since the last save.
      Returns:
      whether the GUI is dirty
    • openCpeDescriptor

      Open cpe descriptor.
      Parameters:
      aFile - the a file
      Throws:
      InvalidXMLException - the invalid XML exception
      IOException - Signals that an I/O exception has occurred.
      CpeDescriptorException - the cpe descriptor exception
      ResourceConfigurationException - the resource configuration exception
    • isCasConsumerSpecifier

      private boolean isCasConsumerSpecifier(ResourceSpecifier specifier)
      Checks if is cas consumer specifier.
      Parameters:
      specifier - the specifier
      Returns:
      true, if is cas consumer specifier