Class AbstractComponent

java.lang.Object
com.globalmentor.beans.BoundPropertyObject
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Component, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
AbstractCompositeComponent, AbstractControl, AbstractImageComponent, AbstractLabel, Flash, LikeButton, Message

public abstract class AbstractComponent extends AbstractPresentationModel implements Component
An abstract implementation of a component.

A component should never fire a property event directly. It should rather create a postponed event and queue that event with the session. This implementation automatically handles postponed property change events when BoundPropertyObject.firePropertyChange(String, Object, Object) or a related method is called.

Property changes to a component's constraints are repeated with the component as the source and the constraints as the target.

Author:
Garret Wilson
  • Constructor Details

    • AbstractComponent

      public AbstractComponent()
      Default constructor.
      Throws:
      IllegalStateException - if no controller is registered for this component type.
      IllegalStateException - if no view is registered for this component type.
    • AbstractComponent

      public AbstractComponent(InfoModel infoModel)
      Info model constructor.
      Parameters:
      infoModel - The component info model.
      Throws:
      NullPointerException - if the given info model is null.
      IllegalStateException - if no depictor is registered for this component type.
  • Method Details

    • getEventListenerManager

      protected com.globalmentor.event.EventListenerManager getEventListenerManager()
      Returns:
      The object managing event listeners.
    • addPreferenceProperty

      public void addPreferenceProperty(String propertyName)
      Description copied from interface: Component
      Adds a property to be saved and loaded as a preference.
      Specified by:
      addPreferenceProperty in interface Component
      Parameters:
      propertyName - The property to store as a preference.
      See Also:
    • isPreferenceProperty

      public boolean isPreferenceProperty(String propertyName)
      Description copied from interface: Component
      Determines whether the given property is saved and loaded as a preference.
      Specified by:
      isPreferenceProperty in interface Component
      Parameters:
      propertyName - The property to determine if it is stored as a preference.
      Returns:
      true if the given property is saved and loaded as a preference.
      See Also:
    • getPreferenceProperties

      public Iterable<String> getPreferenceProperties()
      Description copied from interface: Component
      Returns all properties stored as preferences.
      Specified by:
      getPreferenceProperties in interface Component
      Returns:
      An iterable of all properties saved and loaded as preferences.
      See Also:
    • removePreferenceProperty

      public void removePreferenceProperty(String propertyName)
      Description copied from interface: Component
      Removes a property from being saved and loaded as preferences.
      Specified by:
      removePreferenceProperty in interface Component
      Parameters:
      propertyName - The property that should no longer be stored as a preference.
      See Also:
    • getInfoModel

      protected InfoModel getInfoModel()
      Returns:
      The info model decorated by this component.
    • getName

      public String getName()
      Specified by:
      getName in interface Component
      Returns:
      The name of the component, not guaranteed to be unique (but guaranteed not to be the empty string) and useful only for searching for components within a component sub-hierarchy, or null if the component has no name.
    • setName

      public void setName(String newName)
      Description copied from interface: Component
      Sets the name of the component. This is a bound property.
      Specified by:
      setName in interface Component
      Parameters:
      newName - The new name of the component, or null if the component should have no name.
      See Also:
    • getGlyphURI

      public URI getGlyphURI()
      Specified by:
      getGlyphURI in interface LabelModel
      Returns:
      The glyph URI, which may be a resource URI, or null if there is no glyph URI.
    • setGlyphURI

      public void setGlyphURI(URI newLabelIcon)
      Description copied from interface: LabelModel
      Sets the URI of the icon. This is a bound property.
      Specified by:
      setGlyphURI in interface LabelModel
      Parameters:
      newLabelIcon - The new URI of the icon, which may be a resource URI.
      See Also:
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface LabelModel
      Returns:
      The label text, which may include a resource reference, or null if there is no label text.
    • setLabel

      public void setLabel(String newLabelText)
      Description copied from interface: LabelModel
      Sets the text of the label. This is a bound property.
      Specified by:
      setLabel in interface LabelModel
      Parameters:
      newLabelText - The new text of the label, which may include a resource reference.
      See Also:
    • getLabelContentType

      public com.globalmentor.net.MediaType getLabelContentType()
      Specified by:
      getLabelContentType in interface LabelModel
      Returns:
      The content type of the label text.
    • setLabelContentType

      public void setLabelContentType(com.globalmentor.net.MediaType newLabelTextContentType)
      Description copied from interface: LabelModel
      Sets the content type of the label text. This is a bound property.
      Specified by:
      setLabelContentType in interface LabelModel
      Parameters:
      newLabelTextContentType - The new label text content type.
      See Also:
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface InfoModel
      Returns:
      The description text, such as might appear in a flyover, or null if there is no description.
    • setDescription

      public void setDescription(String newDescription)
      Description copied from interface: InfoModel
      Sets the description text, such as might appear in a flyover. This is a bound property.
      Specified by:
      setDescription in interface InfoModel
      Parameters:
      newDescription - The new text of the description, such as might appear in a flyover.
      See Also:
    • getDescriptionContentType

      public com.globalmentor.net.MediaType getDescriptionContentType()
      Specified by:
      getDescriptionContentType in interface InfoModel
      Returns:
      The content type of the description text.
    • setDescriptionContentType

      public void setDescriptionContentType(com.globalmentor.net.MediaType newDescriptionContentType)
      Description copied from interface: InfoModel
      Sets the content type of the description text. This is a bound property.
      Specified by:
      setDescriptionContentType in interface InfoModel
      Parameters:
      newDescriptionContentType - The new description text content type.
      See Also:
    • getInfo

      public String getInfo()
      Specified by:
      getInfo in interface InfoModel
      Returns:
      The advisory information text, such as might appear in a tooltip, or null if there is no advisory information.
    • setInfo

      public void setInfo(String newInfo)
      Description copied from interface: InfoModel
      Sets the advisory information text, such as might appear in a tooltip. This is a bound property.
      Specified by:
      setInfo in interface InfoModel
      Parameters:
      newInfo - The new text of the advisory information, such as might appear in a tooltip.
      See Also:
    • getInfoContentType

      public com.globalmentor.net.MediaType getInfoContentType()
      Specified by:
      getInfoContentType in interface InfoModel
      Returns:
      The content type of the advisory information text.
    • setInfoContentType

      public void setInfoContentType(com.globalmentor.net.MediaType newInfoContentType)
      Description copied from interface: InfoModel
      Sets the content type of the advisory information text. This is a bound property.
      Specified by:
      setInfoContentType in interface InfoModel
      Parameters:
      newInfoContentType - The new advisory information text content type.
      See Also:
    • getConstraints

      public Constraints getConstraints()
      Specified by:
      getConstraints in interface Component
      Returns:
      The layout constraints describing individual component layout information, or null if no constraints have been specified for this component.
    • setConstraints

      public void setConstraints(Constraints newConstraints)
      Sets the layout constraints of this component. This is a bound property.
      Specified by:
      setConstraints in interface Component
      Parameters:
      newConstraints - The layout constraints describing individual component layout information, or null if no constraints have been specified for this component.
      See Also:
    • getInputStrategy

      public InputStrategy getInputStrategy()
      Specified by:
      getInputStrategy in interface Component
      Returns:
      The strategy for processing input, or null if this component has no input strategy.
    • setInputStrategy

      public void setInputStrategy(InputStrategy newInputStrategy)
      Description copied from interface: Component
      Sets the strategy for processing input. This is a bound property.
      Specified by:
      setInputStrategy in interface Component
      Parameters:
      newInputStrategy - The new strategy for processing input, or null if this component is to have no input strategy.
      See Also:
    • getNotification

      public Notification getNotification()
      Specified by:
      getNotification in interface Component
      Returns:
      The notification associated with the component, or null if no notification is associated with this component.
    • setNotification

      public void setNotification(Notification newNotification)
      Description copied from interface: Component
      Sets the component notification. This is a bound property. The notification is also fired as a NotificationEvent on this component if a new notification is given. Parents are expected to refire the notification event up the hierarchy.
      Specified by:
      setNotification in interface Component
      Parameters:
      newNotification - The notification for the component, or null if no notification is associated with this component.
      See Also:
    • isValid

      public boolean isValid()

      This implementation initializes the valid property if needed.

      Specified by:
      isValid in interface Component
      Returns:
      Whether the state of the component and all child components represents valid user input.
    • setValid

      protected void setValid(boolean newValid)
      Sets whether the state of the component and all child components represents valid user input This is a bound property of type Boolean. This implementation initializes the valid property if needed.
      Parameters:
      newValid - true if user input of this component and all child components should be considered valid
      See Also:
    • updateValid

      protected void updateValid()
      Rechecks user input validity of this component and all child components, and updates the valid state. This implementation only updates the valid property if the property is already initialized or there is at least one listener to the Component.VALID_PROPERTY.
      See Also:
    • determineValid

      protected boolean determineValid()
      Checks the state of the component for validity. This version returns true.
      Returns:
      true if the component and all children passes all validity tests, else false.
    • getDepictor

      public Depictor<? extends Component> getDepictor()
      Specified by:
      getDepictor in interface Component
      Specified by:
      getDepictor in interface DepictedObject
      Returns:
      The depictor for this component.
    • processEvent

      public void processEvent(PlatformEvent event)
      Description copied from interface: DepictedObject
      Processes an event from the platform. This method delegates to the currently installed depictor.
      Specified by:
      processEvent in interface DepictedObject
      Parameters:
      event - The event to be processed.
      See Also:
    • depict

      public void depict() throws IOException
      Description copied from interface: DepictedObject
      Updates the depiction of the object. The depiction will be marked as updated. This method delegates to the currently installed depictor.
      Specified by:
      depict in interface DepictedObject
      Throws:
      IOException - if there is an error updating the depiction.
      See Also:
    • getDepictID

      public long getDepictID()
      Specified by:
      getDepictID in interface DepictedObject
      Returns:
      The object depiction identifier.
    • getOrientation

      public Orientation getOrientation()
      Description copied from interface: Component
      Returns this component's requested orientation. To resolve the orientation up the hierarchy, Component.getComponentOrientation() should be used.
      Specified by:
      getOrientation in interface Component
      Returns:
      The internationalization orientation of the component's contents, or null if the default orientation should be used.
      See Also:
    • getComponentOrientation

      public Orientation getComponentOrientation()
      Description copied from interface: Component
      Determines the internationalization orientation of the component's contents. This method returns the local orientation value, if there is one. If there is no orientation specified for this component, the request is deferred to this component's parent. If there is no parent component, a default orientation is retrieved from the current session.
      Specified by:
      getComponentOrientation in interface Component
      Returns:
      The internationalization orientation of the component's contents.
      See Also:
    • setOrientation

      public void setOrientation(Orientation newOrientation)
      Description copied from interface: Component
      Sets the orientation. This is a bound property
      Specified by:
      setOrientation in interface Component
      Parameters:
      newOrientation - The new internationalization orientation of the component's contents, or null if default orientation should be determined based upon the session's locale.
      See Also:
    • getParent

      public CompositeComponent getParent()
      Specified by:
      getParent in interface Component
      Returns:
      The parent of this component, or null if this component does not have a parent.
    • getAncestor

      public <A extends CompositeComponent> A getAncestor(Class<A> ancestorClass)
      Description copied from interface: Component
      Retrieves the first ancestor of the given type.
      Specified by:
      getAncestor in interface Component
      Type Parameters:
      A - The type of ancestor component requested.
      Parameters:
      ancestorClass - The class of ancestor component requested.
      Returns:
      The first ancestor component of the given type, or null if this component has no such ancestor.
    • setParent

      public void setParent(CompositeComponent newParent)
      Description copied from interface: Component
      Sets the parent of this component. This method is managed by containers, and normally should not be called by applications. A component cannot be given a parent if it already has a parent. A component's parent cannot be removed if that parent is a container and this component is still a child of that container. A container's parent cannot be set to a container unless that container already recognizes this component as one of its children. If a component is given the same parent it already has, no action occurs.
      Specified by:
      setParent in interface Component
      Parameters:
      newParent - The new parent for this component, or null if this component is being removed from a parent.
      See Also:
    • isDragEnabled

      public boolean isDragEnabled()
      Specified by:
      isDragEnabled in interface Component
      Returns:
      Whether the component has dragging enabled.
    • setDragEnabled

      public void setDragEnabled(boolean newDragEnabled)
      Description copied from interface: Component
      Sets whether the component has dragging enabled. This is a bound property of type Boolean.
      Specified by:
      setDragEnabled in interface Component
      Parameters:
      newDragEnabled - true if the component should allow dragging, else false.
      See Also:
    • isDropEnabled

      public boolean isDropEnabled()
      Specified by:
      isDropEnabled in interface Component
      Returns:
      Whether the component has dropping enabled.
    • setDropEnabled

      public void setDropEnabled(boolean newDropEnabled)
      Description copied from interface: Component
      Sets whether the component has dropping enabled. This is a bound property of type Boolean.
      Specified by:
      setDropEnabled in interface Component
      Parameters:
      newDropEnabled - true if the component should allow dropping, else false.
      See Also:
    • isFlyoverEnabled

      public boolean isFlyoverEnabled()
      Specified by:
      isFlyoverEnabled in interface Component
      Returns:
      Whether flyovers are enabled for this component.
    • setFlyoverEnabled

      public void setFlyoverEnabled(boolean newFlyoverEnabled)
      Sets whether flyovers are enabled for this component. Flyovers contain information from the component model's "description" property. This is a bound property of type Boolean.

      This implementation adds or removes a default flyover strategy if one is not already installed. This is a bound property of type Boolean.

      Specified by:
      setFlyoverEnabled in interface Component
      Parameters:
      newFlyoverEnabled - true if the component should display flyovers, else false.
      See Also:
    • getFlyoverStrategy

      public Component.FlyoverStrategy<?> getFlyoverStrategy()
      Specified by:
      getFlyoverStrategy in interface Component
      Returns:
      The installed flyover strategy, or null if there is no flyover strategy installed.
    • setFlyoverStrategy

      public void setFlyoverStrategy(Component.FlyoverStrategy<?> newFlyoverStrategy)
      Description copied from interface: Component
      Sets the strategy for controlling flyovers. The flyover strategy will be registered as a mouse listener for this component. This is a bound property.
      Specified by:
      setFlyoverStrategy in interface Component
      Parameters:
      newFlyoverStrategy - The new flyover strategy, or null if there is no flyover strategy installed.
      See Also:
    • isThemeApplied

      public boolean isThemeApplied()
      Specified by:
      isThemeApplied in interface Component
      Returns:
      Whether a theme has been applied to this component.
    • setThemeApplied

      public void setThemeApplied(boolean newThemeApplied)
      Description copied from interface: Component
      Sets whether a theme has been applied to this component. This is a bound property of type Boolean.
      Specified by:
      setThemeApplied in interface Component
      Parameters:
      newThemeApplied - true if a theme has been applied to this component, else false.
      See Also:
    • addExportStrategy

      public void addExportStrategy(ExportStrategy<?> exportStrategy)
      Description copied from interface: Component
      Adds an export strategy to the component. The export strategy will take precedence over any compatible export strategy previously added.
      Specified by:
      addExportStrategy in interface Component
      Parameters:
      exportStrategy - The export strategy to add.
    • removeExportStrategy

      public void removeExportStrategy(ExportStrategy<?> exportStrategy)
      Description copied from interface: Component
      Removes an export strategy from the component.
      Specified by:
      removeExportStrategy in interface Component
      Parameters:
      exportStrategy - The export strategy to remove.
    • exportTransfer

      public Transferable<?> exportTransfer()
      Description copied from interface: Component
      Exports data from the component. Each export strategy, from last to first added, will be asked to export data, until one is successful.
      Specified by:
      exportTransfer in interface Component
      Specified by:
      exportTransfer in interface DepictedObject
      Returns:
      The object to be transferred, or null if no data can be transferred.
    • addImportStrategy

      public void addImportStrategy(ImportStrategy<?> importStrategy)
      Description copied from interface: Component
      Adds an import strategy to the component. The import strategy will take precedence over any compatible import strategy previously added.
      Specified by:
      addImportStrategy in interface Component
      Parameters:
      importStrategy - The import strategy to add.
    • removeImportStrategy

      public void removeImportStrategy(ImportStrategy<?> importStrategy)
      Description copied from interface: Component
      Removes an import strategy from the component.
      Specified by:
      removeImportStrategy in interface Component
      Parameters:
      importStrategy - The import strategy to remove.
    • importTransfer

      public boolean importTransfer(Transferable<?> transferable)
      Description copied from interface: Component
      Imports data to the component. Each import strategy, from last to first added, will be asked to import data, until one is successful.
      Specified by:
      importTransfer in interface Component
      Parameters:
      transferable - The object to be transferred.
      Returns:
      true if the given object was be imported.
    • initialize

      public void initialize()
      Description copied from interface: Component
      Initializes the component after construction. This method can only be called once during the life of a component. Subclasses should call this version.
      Specified by:
      initialize in interface Component
    • update

      protected void update()
      Updates the condition of the component based upon the state. This method is a convenience method for complex components that would like to perform wholesale updates any prototypes, enabled/disabled status, proxied actions, etc. This version does nothing.
    • validate

      public boolean validate()
      Validates the user input of this component and all child components. The component will be updated with error information.

      This version clears all notifications. This version calls updateValid().

      Specified by:
      validate in interface Component
      Returns:
      The current state of Component.isValid() as a convenience.
    • dispatchInputEvent

      public void dispatchInputEvent(InputEvent inputEvent)
      Dispatches an input event to this component and all child components, if any. If this is a FocusedInputEvent, the event will be directed towards the branch in which lies the focused component of any InputFocusGroupComponent ancestor of this component (or this component, if it is a focus group). If this is instead a TargetedEvent, the event will be directed towards the branch in which lies the target component of the event. Otherwise, the event will be dispatched to all child components. Only after the event has been dispatched to any children will the event be fired to any event listeners and then passed to the installed input strategy, if any. Once the event is consumed, no further processing takes place.

      This version fires all events that are not consumed.

      Specified by:
      dispatchInputEvent in interface Component
      Parameters:
      inputEvent - The input event to dispatch.
      See Also:
    • fireInputEvent

      public void fireInputEvent(InputEvent inputEvent)
      Description copied from interface: Component
      Fire the given even to all registered listeners, if any. If the event is consumed further processing should cease.
      Specified by:
      fireInputEvent in interface Component
      Parameters:
      inputEvent - The input event to fire.
      See Also:
    • getTheme

      public Theme getTheme() throws IOException
      Returns the theme to apply to this component. If there is no theme to this component, the parent theme will be returned.

      This version delegates to the parent version, if there is a parent component; otherwise, the session theme is returned.

      Specified by:
      getTheme in interface Component
      Returns:
      The theme to apply to this component.
      Throws:
      IOException - if there is an error loading the theme.
    • resetTheme

      public void resetTheme()
      Description copied from interface: Component
      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.
      Specified by:
      resetTheme in interface Component
      See Also:
    • updateTheme

      public void updateTheme() throws IOException
      Description copied from interface: Component
      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.
      Specified by:
      updateTheme in interface Component
      Throws:
      IOException - if there was an error loading or applying a theme.
      See Also:
    • applyTheme

      public void applyTheme() throws IOException
      Description copied from interface: Component
      Applies the theme to this object. Themes are only applied of the application is themed. This method may be overridden to effectively override theme settings by ensuring the state of important properties after the theme has been set. If the theme is successfully applied, this method updates the theme applied status.
      Specified by:
      applyTheme in interface Component
      Throws:
      IOException - if there was an error loading or applying a theme.
      See Also:
    • applyTheme

      public void applyTheme(Theme theme)
      Description copied from interface: Component
      Applies a theme and its parents to this object. The theme's rules will be applied to this object and any related objects. Theme application occurs unconditionally, regardless of whether themes have been applied to this component before. There is normally no need to call this method directly by applications.
      Specified by:
      applyTheme in interface Component
      Parameters:
      theme - The theme to apply to the object.
    • loadPreferences

      public void loadPreferences(boolean includeDescendants) throws IOException
      Description copied from interface: Component
      Loads the preferences for this component and optionally any descendant components. Any preferences returned from Component.getPreferenceProperties() will be loaded automatically.
      Specified by:
      loadPreferences in interface Component
      Parameters:
      includeDescendants - true if preferences of any descendant components should also be loaded, else false.
      Throws:
      IOException - if there is an error loading preferences.
    • savePreferences

      public void savePreferences(boolean includeDescendants) throws IOException
      Description copied from interface: Component
      Saves the preferences for this component and optionally any descendant components. Any preferences returned from Component.getPreferenceProperties() will be saved automatically.
      Specified by:
      savePreferences in interface Component
      Parameters:
      includeDescendants - true if preferences of any descendant components should also be saved, else false.
      Throws:
      IOException - if there is an error saving preferences.
    • addCommandListener

      public void addCommandListener(CommandListener commandListener)
      Description copied from interface: Component
      Adds a command listener.
      Specified by:
      addCommandListener in interface Component
      Parameters:
      commandListener - The command listener to add.
    • removeCommandListener

      public void removeCommandListener(CommandListener commandListener)
      Description copied from interface: Component
      Removes a command listener.
      Specified by:
      removeCommandListener in interface Component
      Parameters:
      commandListener - The command listener to remove.
    • hasCommandListeners

      public boolean hasCommandListeners()
      Specified by:
      hasCommandListeners in interface Component
      Returns:
      true if there is one or more command listeners registered.
    • getCommandListeners

      protected Iterable<CommandListener> getCommandListeners()
      Returns:
      all registered command listeners.
    • addKeyListener

      public void addKeyListener(KeyboardListener keyListener)
      Description copied from interface: Component
      Adds a key listener.
      Specified by:
      addKeyListener in interface Component
      Parameters:
      keyListener - The key listener to add.
    • removeKeyListener

      public void removeKeyListener(KeyboardListener keyListener)
      Description copied from interface: Component
      Removes a key listener.
      Specified by:
      removeKeyListener in interface Component
      Parameters:
      keyListener - The key listener to remove.
    • hasKeyListeners

      public boolean hasKeyListeners()
      Specified by:
      hasKeyListeners in interface Component
      Returns:
      true if there is one or more key listeners registered.
    • getKeyListeners

      protected Iterable<KeyboardListener> getKeyListeners()
      Returns:
      all registered key listeners.
    • addMouseListener

      public void addMouseListener(MouseListener mouseListener)
      Description copied from interface: Component
      Adds a mouse listener.
      Specified by:
      addMouseListener in interface Component
      Parameters:
      mouseListener - The mouse listener to add.
    • removeMouseListener

      public void removeMouseListener(MouseListener mouseListener)
      Description copied from interface: Component
      Removes a mouse listener.
      Specified by:
      removeMouseListener in interface Component
      Parameters:
      mouseListener - The mouse listener to remove.
    • hasMouseListeners

      public boolean hasMouseListeners()
      Specified by:
      hasMouseListeners in interface Component
      Returns:
      true if there is one or more mouse listeners registered.
    • getMouseListeners

      protected Iterable<MouseListener> getMouseListeners()
      Returns:
      all registered mouse listeners.
    • getRootComponent

      public static Component getRootComponent(Component component)
      Determines the root parent of the given component.
      Parameters:
      component - The component for which the root should be found.
      Returns:
      The root component (the component or ancestor which has no parent).
    • hasAncestor

      public static boolean hasAncestor(Component component, CompositeComponent ancestor)
      Determines whether a component has a given component as its ancestor, not including the component itself.
      Parameters:
      component - The component for which the potential ancestor should be checked.
      ancestor - The component to check as an ancestor.
      Returns:
      true if the given ancestor component is its parent or one of its parent's parents.
      Throws:
      NullPointerException - if the given component and/or ancestor is null.
    • getComponentByID

      public static Component getComponentByID(Component component, long id)
      Retrieves a component with the given ID. This method checks the given component and all descendant components.
      Parameters:
      component - The component that should be checked, along with its descendants, for the given ID.
      id - The ID of the component.
      Returns:
      The component with the given ID, or null if this component and all descendant components do not have the given ID.
    • getComponentByName

      public static Component getComponentByName(Component component, String name)
      Retrieves a component with the given name. This method checks the given component and all descendant components.
      Parameters:
      component - The component that should be checked, along with its descendants, for the given name.
      name - The name of the component.
      Returns:
      The first component with the given name, or null if this component and all descendant components do not have the given name.
    • getDirtyComponents

      public static List<Component> getDirtyComponents(Component component)
      Retrieves all components that have views needing updated. This method checks the given component and all descendant components. If a given component is dirty, its child views will not be checked.
      Parameters:
      component - The component that should be checked, along with its descendants, for out-of-date views.
      Returns:
      The components with views needing to be updated.
    • getDirtyComponents

      public static List<Component> getDirtyComponents(Component component, List<Component> dirtyComponents)
      Retrieves all components that have views needing updated. This method checks the given component and all descendant components. If a given component is dirty, its child views will not be checked.
      Parameters:
      component - The component that should be checked, along with its descendants, for out-of-date views.
      dirtyComponents - The list that will be updated with more dirty components if any are found.
      Returns:
      The components with views needing to be updated.
    • setDepicted

      public static void setDepicted(Component component, boolean newUpdated)
      Changes the updated status of the views of an entire component descendant hierarchy.
      Parameters:
      component - The component from which, along with its descendants, notifications should be retrieved.
      newUpdated - Whether the views of this component and all child components are up to date.
    • getNotifications

      public static List<Notification> getNotifications(Component component)
      Retrieves the the notifications of all components in a hierarchy. This method checks the given component and all descendant components. Children that are not visible and/or not displayed are not taken into account.
      Parameters:
      component - The component from which, along with its descendants, notifications should be retrieved.
      Returns:
      The notifications of all components in the hierarchy.
    • getNotifications

      protected static List<Notification> getNotifications(Component component, List<Notification> notifications)
      Retrieves the the notifications of all components in a hierarchy. This method checks the given component and all descendant components. Children that are not visible and/or not displayed are not taken into account.
      Parameters:
      component - The component from which, along with its descendants, notifications should be retrieved.
      notifications - The list that will be updated with more dirty components if any are found.
      Returns:
      The notifications of all components in the hierarchy.
    • addNotificationListener

      public void addNotificationListener(NotificationListener notificationListener)
      Description copied from interface: Component
      Adds a notification listener.
      Specified by:
      addNotificationListener in interface Component
      Parameters:
      notificationListener - The notification listener to add.
    • removeNotificationListener

      public void removeNotificationListener(NotificationListener notificationListener)
      Description copied from interface: Component
      Removes a notification listener.
      Specified by:
      removeNotificationListener in interface Component
      Parameters:
      notificationListener - The notification listener to remove.
    • fireNotified

      protected void fireNotified(Notification notification)
      Fires an event to all registered notification listeners with the new notification information. Parents are expected to refire the notification event up the hierarchy.
      Parameters:
      notification - The notification to send to the notification listeners.
      Throws:
      NullPointerException - if the given notification is null.
      See Also:
    • fireNotified

      protected void fireNotified(NotificationEvent notificationEvent)
      Fires an event to all registered notification listeners with the new notification information. Parents are expected to refire copies of the notification event up the hierarchy, keeping the original target.
      Parameters:
      notificationEvent - The notification event to send to the notification listeners.
      Throws:
      NullPointerException - if the given notification event is null.
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)

      This implementation returns whether the object is a component with the same ID.

      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • notify

      public void notify(Notification notification)
      Description copied from interface: Component
      Notifies the user of the given notification information. The notification is stored in this component using Component.setNotification(Notification), which fires appropriate notification events. This method calls GuiseSession.notify(Notification...).
      Specified by:
      notify in interface Component
      Parameters:
      notification - The notification information to relay.