Class AbstractCompositeComponent

    • Constructor Detail

      • AbstractCompositeComponent

        public AbstractCompositeComponent​(InfoModel infoModel)
        Info model constructor.
        Parameters:
        infoModel - The component info model.
        Throws:
        java.lang.NullPointerException - if the given info model is null.
    • Method Detail

      • initializeChildComponent

        protected void initializeChildComponent​(Component childComponent)
        Initializes a component to be added as a child component of this composite component. This method should be called for every child component added to this composite component. This version installs a listener for the component's valid status. This version installs a listener to refire copies of notification events. This version installs a listener to refire copies of composite component events. This version loads the preferences of the child component, but not its descendants.
        Parameters:
        childComponent - The component to add to this component.
        See Also:
        Component.loadPreferences(boolean)
      • uninitializeChildComponent

        protected void uninitializeChildComponent​(Component childComponent)
        Uninitializes a comopnent to be removed as a child comopnent of this composite component. This method should be called for every child component removed from this composite component. This version uninstalls a listener for the component's valid status. This version uninstalls a listener to refire copies of notification events. This version uninstalls a listener to refire copies of composite component events. This version saves any preferences of the child component and any descendants.
        Parameters:
        childComponent - The component to remove from this component.
        See Also:
        Component.savePreferences(boolean)
      • childComponentValidPropertyChanged

        protected void childComponentValidPropertyChanged​(Component childComponent,
                                                          boolean oldValid,
                                                          boolean newValid)
        Called when the Component.VALID_PROPERTY of a child component changes. Every child version should call this version. This version updates the composite component's valid state by calling AbstractComponent.updateValid().
        Parameters:
        childComponent - The child component the valid property of which changed.
        oldValid - The old valid property.
        newValid - The new valid property.
      • determineValid

        protected boolean determineValid()
        Checks the state of the component for validity. This version returns true.

        This version calls determineChildrenValid().

        Overrides:
        determineValid in class AbstractComponent
        Returns:
        true if the component and all children passes all validity tests, else false.
      • 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.
        Returns:
        true if the relevant children pass all validity tests.
      • validateChildren

        protected boolean validateChildren()
        Validates the user input of child components. Children that are not visible and/or not displayed are not taken into account.
        Returns:
        true if all child validations return true.
      • resetTheme

        public void resetTheme()
        Resets this object's theme. This method sets to false the state of whether a theme has been applied to this object. This method is called for any child components resetting its own theme. No new theme is actually loaded. There is normally no need to override this method or to call this method directly by applications.

        This version recursively calls the resetTheme() method of all child components before resetting the theme of this component.

        Specified by:
        resetTheme in interface Component
        Overrides:
        resetTheme in class AbstractComponent
        See Also:
        Component.setThemeApplied(boolean)
      • updateTheme

        public void updateTheme()
                         throws java.io.IOException
        Updates this object's theme. This method checks whether a theme has been applied to this object. If a theme has not been applied to this object this method calls Component.applyTheme(). This method is called for any child components before applying the theme to the component itself, to assure that child theme updates have already occurred before theme updates occur for this component. There is normally no need to override this method or to call this method directly by applications.

        This version recursively calls the updateTheme() method of all child components before updating the theme of this component.

        Specified by:
        updateTheme in interface Component
        Overrides:
        updateTheme in class AbstractComponent
        Throws:
        java.io.IOException - if there was an error loading or applying a theme.
        See Also:
        Component.isThemeApplied(), Component.applyTheme()
      • loadPreferences

        public void loadPreferences​(boolean includeDescendants)
                             throws java.io.IOException
        Loads the preferences for this component and optionally any descendant components. Any preferences returned from Component.getPreferenceProperties() will be loaded automatically.

        This version loads the preferences of child components if descendants should be included.

        Specified by:
        loadPreferences in interface Component
        Overrides:
        loadPreferences in class AbstractComponent
        Parameters:
        includeDescendants - true if preferences of any descendant components should also be loaded, else false.
        Throws:
        java.io.IOException - if there is an error loading preferences.
      • savePreferences

        public void savePreferences​(boolean includeDescendants)
                             throws java.io.IOException
        Saves the preferences for this component and optionally any descendant components. Any preferences returned from Component.getPreferenceProperties() will be saved automatically.

        This version loads the preferences of child components if descendants should be included.

        Specified by:
        savePreferences in interface Component
        Overrides:
        savePreferences in class AbstractComponent
        Parameters:
        includeDescendants - true if preferences of any descendant components should also be saved, else false.
        Throws:
        java.io.IOException - if there is an error saving preferences.
      • dispatchInputEvent

        protected void dispatchInputEvent​(InputEvent inputEvent,
                                          Component target)
        Dispatches an input event to the specified target child hierarchy. If the given target is not a descendant of this component, or if the target is this component, no action occurs.
        Parameters:
        inputEvent - The input event to dispatch.
        target - The target indicating the child hierarchy to which this event should be directed.
        Throws:
        java.lang.NullPointerException - if the given event and/or target is null.
        See Also:
        AbstractComponent.fireInputEvent(InputEvent), InputEvent.isConsumed(), TargetedEvent, MouseEvent
      • addCompositeComponentListener

        public void addCompositeComponentListener​(CompositeComponentListener compositeComponentListener)
        Description copied from interface: CompositeComponent
        Adds a composite component listener. An event will be fired for each descendant component added or removed, with the event target indicating the parent composite component of the change.
        Specified by:
        addCompositeComponentListener in interface CompositeComponent
        Parameters:
        compositeComponentListener - The composite component listener to add.
      • removeCompositeComponentListener

        public void removeCompositeComponentListener​(CompositeComponentListener compositeComponentListener)
        Description copied from interface: CompositeComponent
        Removes a composite component listener. An event will be fired for each descendant component added or removed, with the event target indicating the parent composite component of the change.
        Specified by:
        removeCompositeComponentListener in interface CompositeComponent
        Parameters:
        compositeComponentListener - The composite component listener to remove.
      • fireChildComponentAdded

        protected void fireChildComponentAdded​(ComponentEvent childComponentEvent)
        Fires a given component added event to all registered composite component listeners.
        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.
        Parameters:
        childComponentEvent - The child component event to fire.
        See Also:
        CompositeComponentListener