Interface IXDataSourceOptions

  • All Known Implementing Classes:
    XSelect

    public interface IXDataSourceOptions
    Interface that may be implemented by an XItem, usually by custom widgets that extend XSelect. By default, the user can choose one of the available data sources for a select item in the Designer, but only when the data source has not got any parameters. By implementing this interface, the user may select data sources with a certain amount of parameters.
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getAllowedDataSourceParameterCount

        Map<String,​List<org.apache.commons.lang3.Range<Integer>>> getAllowedDataSourceParameterCount()
        Use this method to indicate how many parameters each data source type must have in order to be selectable. For example, the default XSelect form element lets the user select CSV, DB and PLUGIN data sources with no parameters:
         @Override
         public Map<String, List<Range<Integer>>> getAllowedDataSourceParameterCount() {
           final Map<String, List<Range<Integer>>> ranges = new HashMap<>();
           ranges.put(EDatasource.CSV.name(), Arrays.asList(Range.is(0)));
           ranges.put(EDatasource.DB.name(), Arrays.asList(Range.is(0)));
           ranges.put(EDatasource.PLUGIN.name(), Arrays.asList(Range.is(0)));
           return ranges;
         }
         
        Returns:
        A map between each data source type as the key and a list of allowed parameter counts (inclusive range) as the value. When null is returned, the defaults (which may change) are used. When a key for a data source type is missing or is mapped to null, no data sources of that type are selectable.