Class SourceProductList


  • public class SourceProductList
    extends com.bc.ceres.swing.binding.ComponentAdapter
    Enables clients to create a component for choosing source products. The list of source products can arbitrarily be composed of
    • currently opened products
    • single products anywhere in the file system
    • whole directories anywhere in the file system and
    • recursive directories anywhere in the file system

    The file paths the user chooses are stored as objects of type File within the property that is passed into the constructor. Products that are chosen from the product tree can be retrieved via getSourceProducts(). So, clients of these must take care that the value in the given property is taken into account as well as the return value of that method. The property that serves as target container for the source product paths must be of type String[].class. Changes in the list are synchronised with the property. If the changes of the property values outside this component shall be synchronised with the list, it is necessary that the property lies within a property container.

    • Constructor Detail

      • SourceProductList

        public SourceProductList​(AppContext appContext)
        Constructor.
        Parameters:
        appContext - The context of the app using this component.
    • Method Detail

      • getComponents

        public JComponent[] getComponents()
        Creates an array of two JPanels. The first panel contains a list displaying the chosen products. The second panel contains buttons for adding and removing products, laid out in vertical direction. Note that it makes only sense to use both components.
        Specified by:
        getComponents in class com.bc.ceres.swing.binding.ComponentAdapter
        Returns:
        an array of two JPanels.
      • clear

        public void clear()
        Clears the list of source products.
      • addProduct

        public void addProduct​(Product product)
        Allows clients to add single products.
        Parameters:
        product - A product to add.
      • getSourceProducts

        public Product[] getSourceProducts()
        Returns those source products that have been chosen from the product tree.
        Returns:
        An array of source products.
      • setDefaultPattern

        public void setDefaultPattern​(String pattern)
        If set, users will be asked whether to use this pattern for recursively collecting products from directories. To unset this, pass null as pattern.
        Parameters:
        pattern - The pattern to be used when collecting products from directories
        Since:
        SNAP 3.2
      • bindComponents

        public void bindComponents()
        Specified by:
        bindComponents in class com.bc.ceres.swing.binding.ComponentAdapter
      • unbindComponents

        public void unbindComponents()
        Specified by:
        unbindComponents in class com.bc.ceres.swing.binding.ComponentAdapter
      • adjustComponents

        public void adjustComponents()
        Specified by:
        adjustComponents in class com.bc.ceres.swing.binding.ComponentAdapter
      • addChangeListener

        public void addChangeListener​(ListDataListener changeListener)
        Add a listener that is informed every time the list's contents change.
        Parameters:
        changeListener - the listener to add
      • removeChangeListener

        public void removeChangeListener​(ListDataListener changeListener)
        Remove a change listener
        Parameters:
        changeListener - the listener to remove
      • addSelectionListener

        public void addSelectionListener​(ListSelectionListener selectionListener)
        Add a listener that is informed every time the list's selection is changed.
        Parameters:
        selectionListener - the listener to add
        Since:
        SNAP 3.2
      • removeSelectionListener

        public void removeSelectionListener​(ListSelectionListener selectionListener)
        Remove a selection listener
        Parameters:
        selectionListener - the listener to remove
        Since:
        SNAP 3.2
      • isSelected

        public boolean isSelected​(Object object)
        Parameters:
        object - the object which may be selected or not
        Returns:
        true, if the object is selected
        Since:
        SNAP 3.2
      • setProductFilter

        public void setProductFilter​(ProductFilter productFilter)
        The filter to be used to filter the list of opened products which are offered to the user for selection.
        Parameters:
        productFilter - the filter
      • setPropertyNameLastOpenedFormat

        public void setPropertyNameLastOpenedFormat​(String propertyNameLastOpenedFormat)
        Setter for property name indicating the last directory the user has opened
        Parameters:
        propertyNameLastOpenedFormat - property name indicating the last directory the user has opened
      • setPropertyNameLastOpenInputDir

        public void setPropertyNameLastOpenInputDir​(String propertyNameLastOpenInputDir)
        Setter for property name indicating the last product format the user has opened
        Parameters:
        propertyNameLastOpenInputDir - property name indicating the last product format the user has opened
      • setPropertyNameFormatNames

        public void setPropertyNameFormatNames​(String formatNamesKey)
        Setter for property name which defines the formats offered to the user. The value of the list should be a comma separated list of formats. If the property is not set, all formats will be offered.
        Parameters:
        formatNamesKey - property name
      • setXAxis

        public void setXAxis​(boolean xAxis)
        Setter for xAxis property.
        Parameters:
        xAxis - true if the buttons on the second panel shall be laid out in horizontal direction