Class AbstractApplicationFrame

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, io.clogr.Clogged, ApplicationFrame, Component, CompositeComponent, ContentComponent, Frame, InputFocusableComponent, InputFocusGroupComponent, ModalComponent<Frame.Mode>, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
DefaultApplicationFrame

public abstract class AbstractApplicationFrame extends AbstractFrame implements ApplicationFrame
Abstract implementation of an application frame.

This implementation binds the command ProcessCommand.CONTINUE to the key input Key.ENTER, as well as the command ProcessCommand.ABORT to the key input Key.ESCAPE.

Author:
Garret Wilson
See Also:
  • Field Details

    • LABEL_SEPARATOR

      public static final String LABEL_SEPARATOR
      The delimiter to use when constructing the label from its various segments.
      See Also:
  • Constructor Details

    • AbstractApplicationFrame

      public AbstractApplicationFrame(Component component)
      Component constructor.
      Parameters:
      component - The single child component, or null if this frame should have no child component.
  • Method Details

    • getChildFrames

      public Iterable<Frame> getChildFrames()
      Specified by:
      getChildFrames in interface ApplicationFrame
      Returns:
      An iterable to all child frames.
    • addChildFrame

      public void addChildFrame(Frame frame)
      Description copied from interface: ApplicationFrame
      Adds a frame to the list of child frames. This method should usually only be called by the frames themselves.
      Specified by:
      addChildFrame in interface ApplicationFrame
      Parameters:
      frame - The frame to add.
    • removeChildFrame

      public void removeChildFrame(Frame frame)
      Description copied from interface: ApplicationFrame
      Removes a frame from the list of child frames. This method should usually only be called by the frames themselves.
      Specified by:
      removeChildFrame in interface ApplicationFrame
      Parameters:
      frame - The frame to remove.
    • setContent

      public void setContent(Component newContent)
      Sets the content child component. This is a bound property

      This version updates the frame label by calling updateLabel().

      Specified by:
      setContent in interface ContentComponent
      Overrides:
      setContent in class AbstractFrame
      Parameters:
      newContent - The content child component, or null if this component does not have a content child component.
      See Also:
    • getBasePlainLabel

      protected abstract String getBasePlainLabel()
      Retrieves the plain-text base title to use when constructing a label.
      Returns:
      A base plain-text string to use when constructing a label, or null if there is no base label.
      See Also:
    • updateLabel

      protected void updateLabel()
      Called when the content changes so that the label can be updated. This version sets the application frame label to match the label of the content, if any, prefixed with a base label, if any. If the label content type is not plain text, the base label is ignored.
      See Also:
    • canClose

      public boolean canClose()
      Description copied from interface: Frame
      Determines whether the frame should be allowed to close. This method is called from Frame.close().
      Specified by:
      canClose in interface Frame
      Overrides:
      canClose in class AbstractFrame
      Returns:
      true if the frame should be allowed to close.
    • getChildList

      protected List<Component> getChildList()
      Retrieves a list of all child components. This method can be overridden to provide further child components to the returned list.

      This version adds all this frame's child frames to the list.

      Overrides:
      getChildList in class AbstractArrayCompositeComponent
      Returns:
      A list of child components.
    • hasChildComponents

      public boolean hasChildComponents()

      This version also checks to see whether there are child frames.

      Specified by:
      hasChildComponents in interface CompositeComponent
      Overrides:
      hasChildComponents in class AbstractArrayCompositeComponent
      Returns:
      Whether this component has childh components.