Class AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>

    • Constructor Detail

      • ConverterInfoModelValueRepresentationStrategy

        public ConverterInfoModelValueRepresentationStrategy​(java.lang.Class<VV> valueClass,
                                                             java.lang.Class<? extends Component> componentClass)
        Value class constructor with a default converter. This implementation uses a DefaultStringLiteralConverter.
        Parameters:
        valueClass - The class indicating the type of value to convert.
        componentClass - The class of component to create.
        Throws:
        java.lang.NullPointerException - if the given value class and/or component class is null.
        java.lang.IllegalArgumentException - if the given component class does not have a constructor with a single InfoModel constructor.
      • ConverterInfoModelValueRepresentationStrategy

        public ConverterInfoModelValueRepresentationStrategy​(java.lang.Class<? extends Component> componentClass,
                                                             Converter<VV,​java.lang.String> converter)
        Converter constructor.
        Parameters:
        converter - The converter to use for displaying the value as a string.
        componentClass - The class of component to create.
        Throws:
        java.lang.NullPointerException - if the given converter is null.
        java.lang.IllegalArgumentException - if the given component class does not have a constructor with a single InfoModel constructor.
    • Method Detail

      • getConverter

        public Converter<VV,​java.lang.String> getConverter()
        Returns:
        The converter to use for displaying the value as a string.
      • createComponent

        public Component createComponent​(ListSelectModel<VV> model,
                                         VV value,
                                         int index,
                                         boolean selected,
                                         boolean focused)
        Creates a component for the given list value. This implementation constructs a component from a info model that converts the value using the saved converter.
        Specified by:
        createComponent in interface ListSelectControl.ValueRepresentationStrategy<VV>
        Parameters:
        model - The model containing the value.
        value - The value for which a component should be created.
        index - The index of the value within the list, or -1 if the value is not in the list (e.g. for representing no selection).
        selected - true if the value is selected.
        focused - true if the value has the focus.
        Returns:
        A new component to represent the given value.
        See Also:
        getConverter()