Class AbstractListSelectContainerControl

    • Constructor Detail

      • AbstractListSelectContainerControl

        protected AbstractListSelectContainerControl​(AbstractValueLayout<?> layout)
        Layout constructor.
        Parameters:
        layout - The layout definition for the container.
        Throws:
        java.lang.NullPointerException - if the given layout is null.
    • Method Detail

      • getComponent

        public Component getComponent​(Component object)
        Retrieves the component for the given value.

        This version returns the given component to fulfill the interface contract of ListSelectControl.

        Specified by:
        getComponent in interface ListSelectControl<Component>
        Parameters:
        object - The value for which a representation component should be returned.
        Returns:
        The child component representing the given value.
      • firePropertyChange

        protected <VV> void firePropertyChange​(java.lang.String propertyName,
                                               VV oldValue,
                                               VV newValue)

        This version first updates the valid status if the value is reported as being changed.

        Overrides:
        firePropertyChange in class com.globalmentor.beans.BoundPropertyObject
      • determineChildrenValid

        protected boolean determineChildrenValid()
        Checks the state of child components for validity. This version checks all child components for validity using the current Component.isValid(); child component are not asked to update their valid state. Children that are not visible and/or not displayed are not taken into account.

        This version only checks the validity of the selected card.

        Overrides:
        determineChildrenValid in class AbstractCompositeComponent
        Returns:
        true if the relevant children pass all validity tests.
      • validateChildren

        public boolean validateChildren()
        Validates the user input of child components. Children that are not visible and/or not displayed are not taken into account.

        This version only validates the selected card.

        Overrides:
        validateChildren in class AbstractCompositeComponent
        Returns:
        true if all child validations return true.
      • setValue

        public void setValue​(Component newValue)
                      throws java.beans.PropertyVetoException
        Description copied from interface: ValueModel
        Sets the new value. This is a bound property that only fires a change event when the new value is different via the equals() method. If a validator is installed, the value will first be validated before the current value is changed. Validation always occurs if a validator is installed, even if the value is not changing. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().
        Specified by:
        setValue in interface com.globalmentor.model.MutableValued<Component>
        Specified by:
        setValue in interface ValuedComponent<Component>
        Specified by:
        setValue in interface ValueModel<Component>
        Parameters:
        newValue - The new value.
        Throws:
        java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
        See Also:
        ValueModel.getValidator(), ValueModel.VALUE_PROPERTY
      • isValidValue

        public boolean isValidValue()
        Description copied from interface: ValueModel
        Determines whether the value of this model is valid.
        Specified by:
        isValidValue in interface ValueModel<Component>
        Returns:
        Whether the value of this model is valid.
      • replace

        public boolean replace​(Component oldValue,
                               Component newValue)
        Description copied from interface: SelectModel
        Replaces the first occurrence in the of the given value with its replacement. This method ensures that another thread does not change the model while the search and replace operation occurs.
        Specified by:
        replace in interface SelectModel<Component>
        Parameters:
        oldValue - The value for which to search.
        newValue - The replacement value.
        Returns:
        Whether the operation resulted in a modification of the model.
      • getSelectedValue

        public Component getSelectedValue()
        Description copied from interface: SelectModel
        Determines the selected value. This method delegates to the selection strategy. If more than one value is selected, the lead selected value will be returned.
        Specified by:
        getSelectedValue in interface SelectModel<Component>
        Returns:
        The value currently selected, or null if no value is currently selected.
      • getSelectedValues

        public Component[] getSelectedValues()
        Description copied from interface: SelectModel
        Determines the selected values. This method delegates to the selection strategy.
        Specified by:
        getSelectedValues in interface SelectModel<Component>
        Returns:
        The values currently selected.
      • setSelectedValues

        public void setSelectedValues​(Component... values)
                               throws java.beans.PropertyVetoException
        Description copied from interface: SelectModel
        Sets the selected values. If a value occurs more than one time in the model, all occurrences of the value will be selected. Values that do not occur in the select model will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause(). This method delegates to the selection strategy.
        Specified by:
        setSelectedValues in interface SelectModel<Component>
        Parameters:
        values - The values to select.
        Throws:
        java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
      • isValueDisplayed

        public boolean isValueDisplayed​(Component value)
        Description copied from interface: ListSelectModel
        Determines the displayed status of the first occurrence of a given value.
        Specified by:
        isValueDisplayed in interface ListSelectModel<Component>
        Parameters:
        value - The value for which the displayed status is to be determined.
        Returns:
        true if the value is displayed, else false.
      • isIndexDisplayed

        public boolean isIndexDisplayed​(int index)
        Description copied from interface: ListSelectModel
        Determines the displayed status of a given index.
        Specified by:
        isIndexDisplayed in interface ListSelectModel<Component>
        Parameters:
        index - The index of the value for which the displayed status is to be determined.
        Returns:
        true if the value at the given index is displayed, else false.
      • setIndexDisplayed

        public void setIndexDisplayed​(int index,
                                      boolean newDisplayed)
        Description copied from interface: ListSelectModel
        Sets the displayed status of a given index. This is a bound value state property.
        Specified by:
        setIndexDisplayed in interface ListSelectModel<Component>
        Parameters:
        index - The index of the value to display.
        newDisplayed - Whether the value at the given index should be displayed.
        See Also:
        Displayable.DISPLAYED_PROPERTY
      • isValueEnabled

        public boolean isValueEnabled​(Component value)
        Description copied from interface: ListSelectModel
        Determines the enabled status of the first occurrence of a given value.
        Specified by:
        isValueEnabled in interface ListSelectModel<Component>
        Parameters:
        value - The value for which the enabled status is to be determined.
        Returns:
        true if the value is enabled, else false.
      • setValueEnabled

        public void setValueEnabled​(Component value,
                                    boolean newEnabled)
        Description copied from interface: ListSelectModel
        Sets the enabled status of the first occurrence of a given value. This is a bound value state property.
        Specified by:
        setValueEnabled in interface ListSelectModel<Component>
        Parameters:
        value - The value to enable or disable.
        newEnabled - Whether the value should be enabled.
        See Also:
        Enableable.ENABLED_PROPERTY
      • isIndexEnabled

        public boolean isIndexEnabled​(int index)
        Description copied from interface: ListSelectModel
        Determines the enabled status of a given index.
        Specified by:
        isIndexEnabled in interface ListSelectModel<Component>
        Parameters:
        index - The index of the value for which the enabled status is to be determined.
        Returns:
        true if the value at the given index is enabled, else false.
      • setIndexEnabled

        public void setIndexEnabled​(int index,
                                    boolean newEnabled)
        Description copied from interface: ListSelectModel
        Sets the enabled status of a given index. This is a bound value state property.
        Specified by:
        setIndexEnabled in interface ListSelectModel<Component>
        Parameters:
        index - The index of the value to enable or disable.
        newEnabled - Whether the value at the given index should be enabled.
        See Also:
        Enableable.ENABLED_PROPERTY
      • fireChildComponentAdded

        protected void fireChildComponentAdded​(ComponentEvent childComponentEvent)
        Fires a given component added event to all registered composite component listeners.

        This implementation also fires a list modified event to all registered list listeners, if any.

        Overrides:
        fireChildComponentAdded in class AbstractCompositeComponent
        Parameters:
        childComponentEvent - The child component event to fire.
      • fireChildComponentRemoved

        protected void fireChildComponentRemoved​(ComponentEvent childComponentEvent)
        Fires a given component removed event to all registered composite component listeners. This implementation also fires a list modified event to all registered list listeners, if any.
        Overrides:
        fireChildComponentRemoved in class AbstractCompositeComponent
        Parameters:
        childComponentEvent - The child component event to fire.
        See Also:
        CompositeComponentListener
      • fireSelectionChanged

        protected void fireSelectionChanged​(java.lang.Integer addedIndex,
                                            java.lang.Integer removedIndex)
        Fires an event to all registered selection listeners indicating the selection changed.
        Parameters:
        addedIndex - The index that was added to the selection, or null if no index was added or it is unknown whether or which indices were added.
        removedIndex - The index that was removed from the list, or null if no index was removed or it is unknown whether or which indices were removed.
        See Also:
        ListSelectionListener, ListSelectionEvent
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<Component>
        Specified by:
        toArray in interface java.util.List<Component>
      • toArray

        public <T> T[] toArray​(T[] array)
        Specified by:
        toArray in interface java.util.Collection<Component>
        Specified by:
        toArray in interface java.util.List<Component>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> collection)
        Specified by:
        containsAll in interface java.util.Collection<Component>
        Specified by:
        containsAll in interface java.util.List<Component>
      • addAll

        public boolean addAll​(java.util.Collection<? extends Component> collection)
        Specified by:
        addAll in interface java.util.Collection<Component>
        Specified by:
        addAll in interface java.util.List<Component>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends Component> collection)
        Specified by:
        addAll in interface java.util.List<Component>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> collection)
        Specified by:
        removeAll in interface java.util.Collection<Component>
        Specified by:
        removeAll in interface java.util.List<Component>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> collection)
        Specified by:
        retainAll in interface java.util.Collection<Component>
        Specified by:
        retainAll in interface java.util.List<Component>
      • listIterator

        public java.util.ListIterator<Component> listIterator()
        Specified by:
        listIterator in interface java.util.List<Component>
      • listIterator

        public java.util.ListIterator<Component> listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List<Component>
      • subList

        public java.util.List<Component> subList​(int fromIndex,
                                                 int toIndex)
        Specified by:
        subList in interface java.util.List<Component>
      • isDisplayed

        public boolean isDisplayed​(Component component)
        Convenience method to determine whether a card is displayed based upon its associated constraints.
        Parameters:
        component - The component for which the card should be displayed or not displayed.
        Returns:
        Whether the card is displayed or has no representation, taking up no space.
        Throws:
        java.lang.IllegalStateException - if the given component has no associated constraints.
        See Also:
        ControlConstraints.isDisplayed()
      • setDisplayed

        public void setDisplayed​(Component component,
                                 boolean newDisplayed)
        Sets a card displayed or not displayed. This convenience method changes the displayed status of the component's associated constraints.
        Parameters:
        component - The component for which the card should be displayed or not displayed.
        newDisplayed - true if the card should be displayed.
        Throws:
        java.lang.IllegalStateException - if the given component has no associated constraints.
        See Also:
        ControlConstraints.setDisplayed(boolean)
      • isEnabled

        public boolean isEnabled​(Component component)
        Convenience method to determine whether a card is enabled based upon its associated constraints.
        Parameters:
        component - The component for which the card should be enabled or disabled.
        Returns:
        Whether the card is enabled and can receive user input.
        Throws:
        java.lang.IllegalStateException - if the given component has no associated constraints.
        See Also:
        ControlConstraints.isEnabled()
      • setEnabled

        public void setEnabled​(Component component,
                               boolean newEnabled)
        Enables or disables a card. This convenience method changes the enabled status of the component's associated constraints.
        Parameters:
        component - The component for which the card should be enabled or disabled.
        newEnabled - true if the card can be selected.
        Throws:
        java.lang.IllegalStateException - if the given component has no associated constraints.
        See Also:
        ControlConstraints.setEnabled(boolean)