Class AbstractFrame

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

public abstract class AbstractFrame extends AbstractEnumCompositeComponent<AbstractFrame.FrameComponent> implements Frame
Abstract implementation of a frame. This implementation notifies the user when the frame does not validate in validate().
Author:
Garret Wilson
  • Constructor Details

    • AbstractFrame

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

    • getState

      public Frame.State getState()
      Specified by:
      getState in interface Frame
      Returns:
      The state of the frame.
    • setState

      protected void setState(Frame.State newState)
      Sets the state of the frame. This is a bound property.
      Parameters:
      newState - The new state of the frame.
      Throws:
      NullPointerException - if the given state is null.
      See Also:
    • isModal

      public boolean isModal()
      Specified by:
      isModal in interface Frame
      Returns:
      Whether the frame is modal if and when it is open.
    • setModal

      public void setModal(boolean newModal)
      Description copied from interface: Frame
      Sets whether the frame is modal if and when it is open. This is a bound property of type Boolean.
      Specified by:
      setModal in interface Frame
      Parameters:
      newModal - true if the frame should be modal, else false.
      See Also:
    • getMode

      public Frame.Mode getMode()
      Specified by:
      getMode in interface ModalComponent<Frame.Mode>
      Returns:
      The current mode of interaction, or null if the component is in a modeless state.
    • setMode

      public void setMode(Frame.Mode newMode)
      Description copied from interface: ModalComponent
      Sets the mode of interaction. This is a bound property.
      Specified by:
      setMode in interface ModalComponent<Frame.Mode>
      Parameters:
      newMode - The new mode of component interaction.
      See Also:
    • isMovable

      public boolean isMovable()
      Specified by:
      isMovable in interface Frame
      Returns:
      Whether the frame is movable.
    • setMovable

      public void setMovable(boolean newMovable)
      Description copied from interface: Frame
      Sets whether the frame is movable. This is a bound property of type Boolean.
      Specified by:
      setMovable in interface Frame
      Parameters:
      newMovable - true if the frame should be movable, else false.
      See Also:
    • isResizable

      public boolean isResizable()
      Specified by:
      isResizable in interface Frame
      Returns:
      Whether the frame can be resized.
    • setResizable

      public void setResizable(boolean newResizable)
      Description copied from interface: Frame
      Sets whether the frame can be resized. This is a bound property of type Boolean.
      Specified by:
      setResizable in interface Frame
      Parameters:
      newResizable - true if the frame can be resized, else false.
      See Also:
    • getRelatedComponent

      public Component getRelatedComponent()
      Specified by:
      getRelatedComponent in interface Frame
      Returns:
      The related component such as a popup source, or null if the frame is not related to another component.
    • setRelatedComponent

      public void setRelatedComponent(Component newRelatedComponent)
      Description copied from interface: Frame
      Sets the related component This is a bound property.
      Specified by:
      setRelatedComponent in interface Frame
      Parameters:
      newRelatedComponent - The new related component, or null if the frame is not related to another component.
      See Also:
    • getTitleBackgroundColor

      public Color getTitleBackgroundColor()
      Specified by:
      getTitleBackgroundColor in interface Frame
      Returns:
      The background color of the title, or null if no background color is specified for the title.
    • setTitleBackgroundColor

      public void setTitleBackgroundColor(Color newTitleBackgroundColor)
      Description copied from interface: Frame
      Sets the background color of the title. This is a bound property.
      Specified by:
      setTitleBackgroundColor in interface Frame
      Parameters:
      newTitleBackgroundColor - The background color of the title, or null if the default background color should be used.
      See Also:
    • isTitleVisible

      public boolean isTitleVisible()
      Specified by:
      isTitleVisible in interface Frame
      Returns:
      Whether the title bar is visible.
    • setTitleVisible

      public void setTitleVisible(boolean newTitleVisible)
      Description copied from interface: Frame
      Sets whether the title bar is visible. This is a bound property of type Boolean.
      Specified by:
      setTitleVisible in interface Frame
      Parameters:
      newTitleVisible - true if the title bar should be visible, else false.
      See Also:
    • getOpenEffect

      public Effect getOpenEffect()
      Specified by:
      getOpenEffect in interface Frame
      Returns:
      The effect used for opening the frame, or null if there is no open effect.
    • setOpenEffect

      public void setOpenEffect(Effect newOpenEffect)
      Description copied from interface: Frame
      Sets the effect used for opening the frame. This is a bound property.
      Specified by:
      setOpenEffect in interface Frame
      Parameters:
      newOpenEffect - The new effect used for opening the frame, or null if there should be no open effect.
      See Also:
    • getContent

      public Component getContent()
      Specified by:
      getContent in interface ContentComponent
      Returns:
      The content child component, or null if this component does not have a content child component.
    • setContent

      public void setContent(Component newContent)
      Description copied from interface: ContentComponent
      Sets the content child component. This is a bound property
      Specified by:
      setContent in interface ContentComponent
      Parameters:
      newContent - The content child component, or null if this component does not have a content child component.
      See Also:
    • getMenu

      public Menu getMenu()
      Specified by:
      getMenu in interface Frame
      Returns:
      The frame menu, or null if this frame does not have a menu.
    • setMenu

      public void setMenu(Menu newMenu)
      Description copied from interface: Frame
      Sets the frame menu. This is a bound property.
      Specified by:
      setMenu in interface Frame
      Parameters:
      newMenu - The frame menu, or null if this frame does not have a menu.
      See Also:
    • getToolbar

      public Toolbar getToolbar()
      Specified by:
      getToolbar in interface Frame
      Returns:
      The frame toolbar, or null if this frame does not have a toolbar.
    • setToolbar

      public void setToolbar(Toolbar newToolbar)
      Description copied from interface: Frame
      Sets the frame toolbar. This is a bound property.
      Specified by:
      setToolbar in interface Frame
      Parameters:
      newToolbar - The frame toolbar, or null if this frame does not have a toolbar.
      See Also:
    • getPrototypeProvisionStrategy

      protected FrameMenuToolPrototypeProvisionStrategy getPrototypeProvisionStrategy()
      Returns:
      The strategy for processing prototypes provisions from child prototype providers, along with this frame's prototype provisions.
    • getCloseActionControl

      public ActionControl getCloseActionControl()
      Specified by:
      getCloseActionControl in interface Frame
      Returns:
      The action control for closing the frame, or null if this frame does not have a close action control.
    • setCloseActionControl

      public void setCloseActionControl(ActionControl newCloseActionControl)
      Description copied from interface: Frame
      Sets the action control for closing the frame. This is a bound property.
      Specified by:
      setCloseActionControl in interface Frame
      Parameters:
      newCloseActionControl - The action control for closing the frame, or null if this frame does not have a close action control.
      See Also:
    • getInputFocusStrategy

      public InputFocusStrategy getInputFocusStrategy()
      Specified by:
      getInputFocusStrategy in interface InputFocusGroupComponent
      Returns:
      The input focus strategy for this input focus group.
    • setInputFocusStrategy

      public void setInputFocusStrategy(InputFocusStrategy newInputFocusStrategy)
      Description copied from interface: InputFocusGroupComponent
      Sets the input focus strategy. This is a bound property
      Specified by:
      setInputFocusStrategy in interface InputFocusGroupComponent
      Parameters:
      newInputFocusStrategy - The input focus strategy for this group.
      See Also:
    • getInputFocusedComponent

      public InputFocusableComponent getInputFocusedComponent()
      Description copied from interface: InputFocusGroupComponent
      Indicates the component within this group that has the input focus. The focused component may be another InputFocusGroupComponent, which in turn will have its own focused component.
      Specified by:
      getInputFocusedComponent in interface InputFocusGroupComponent
      Returns:
      The component within this group that has the input focus, or null if no component currently has the input focus.
    • setInputFocusedComponent

      public void setInputFocusedComponent(InputFocusableComponent newInputFocusedComponent) throws PropertyVetoException
      Description copied from interface: InputFocusGroupComponent
      Sets the focused component within this input focus group. This is a bound property.
      Specified by:
      setInputFocusedComponent in interface InputFocusGroupComponent
      Parameters:
      newInputFocusedComponent - The component to receive the input focus.
      Throws:
      PropertyVetoException - if the given component is not a focusable component within this input focus group, the component cannot receive the input focus, or the input focus change has otherwise been vetoed.
      See Also:
    • getCloseActionPrototype

      public ActionPrototype getCloseActionPrototype()
      Specified by:
      getCloseActionPrototype in interface Frame
      Returns:
      The action prototype for closing the frame.
    • open

      public void open()
      Description copied from interface: Frame
      Opens the frame with the currently set modality. Opening the frame registers the frame with the application frame. If the frame is already open, no action occurs.
      Specified by:
      open in interface Frame
      See Also:
    • open

      public void open(boolean modal)
      Description copied from interface: Frame
      Opens the frame, specifying modality. Opening the frame registers the frame with the session. If the frame is already open, no action occurs.
      Specified by:
      open in interface Frame
      Parameters:
      modal - true if the frame should be opened as a modal frame, else false.
      See Also:
    • open

      public void open(com.globalmentor.beans.GenericPropertyChangeListener<Frame.Mode> modeChangeListener)
      Description copied from interface: Frame
      Opens the frame as modal and installs the given property change listener to listen for the mode changing. This is a convenience method that adds the ModalComponent.MODE_PROPERTY change listener using PropertyBindable.addPropertyChangeListener(String, PropertyChangeListener) and then calls Frame.open(boolean) with a value of true.
      Specified by:
      open in interface Frame
      Parameters:
      modeChangeListener - The mode property change listener to add.
      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
      Returns:
      true if the frame should be allowed to close.
    • close

      public final void close()
      Description copied from interface: Frame
      Closes the frame. Closing the frame unregisters the frame with the session. If the frame is already closed, no action occurs.
      Specified by:
      close in interface Frame
      See Also:
    • closeImpl

      protected void closeImpl()
      Implementation of frame closing.
    • validate

      public boolean validate()
      Description copied from class: AbstractCompositeComponent
      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 AbstractComponent.updateValid().

      This version first calls AbstractCompositeComponent.validateChildren() so that all children will be validated before checks are performed on this component.

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

      protected final void updateDefaultPrototypeProvisions()
      Updates the default prototype provisions.
      See Also:
    • provideDefaultPrototypes

      protected Set<PrototypeProvision<?>> provideDefaultPrototypes()
      Provides default prototype provisions to be integrated into the menu and/or toolbar. The default prototype provisions are separate from those provided by any child component prototype producers. Subclasses may override this method to add or modify the default provided prototype provisions.
      Returns:
      A mutable set of default prototype provisions.