Class AbstractOptionDialogFrame<O>

Type Parameters:
O - The type of options available.
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, com.globalmentor.model.MutableValued<O>, com.globalmentor.model.Valued<O>, io.clogr.Clogged, Component, CompositeComponent, ContentComponent, Control, DialogFrame<O>, Frame, InputFocusableComponent, InputFocusGroupComponent, ModalComponent<Frame.Mode>, OptionDialogFrame<O>, ValueControl<O>, ValuedComponent<O>, Displayable, Enableable, InfoModel, LabelModel, Model, PresentationModel, ValueModel<O>, DepictedObject
Direct Known Subclasses:
NotificationOptionDialogFrame

public abstract class AbstractOptionDialogFrame<O> extends AbstractDialogFrame<O> implements OptionDialogFrame<O>
Abstract implementation of a frame for communication of an option. An option frame defaults to a single composite child panel with a row of options along the bottom. The contents of an option dialog frame should be accessed by getOptionContent() and setOptionContent(Component). This implementation does not allow its frame content to be changed.
Author:
Garret Wilson
  • Constructor Details

    • AbstractOptionDialogFrame

      public AbstractOptionDialogFrame(ValueModel<O> valueModel, Component component, O... options)
      Value model, component, and options constructor. Duplicate options are ignored.
      Parameters:
      valueModel - The frame value model.
      component - The component representing the content of the option dialog frame, or null if there is no content component.
      options - The available options.
      Throws:
      NullPointerException - if the given value model and/or options is null.
  • Method Details

    • 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
      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:
    • getContentContainer

      protected Container getContentContainer()
      Returns:
      The container component used to hold content, including the option child component.
    • getOptionContent

      public Component getOptionContent()
      Specified by:
      getOptionContent in interface OptionDialogFrame<O>
      Returns:
      The component representing option contents, or null if this frame does not have an option contents component.
    • setOptionContent

      public void setOptionContent(Component newOptionContent)
      Sets the component representing option contents.

      This implementation adds the option content component to the center region of the child container.

      Specified by:
      setOptionContent in interface OptionDialogFrame<O>
      Parameters:
      newOptionContent - The single option contents component, or null if this frame does not have an option contents component.
    • getOptionContainer

      public Container getOptionContainer()
      Specified by:
      getOptionContainer in interface OptionDialogFrame<O>
      Returns:
      The container containing the options.
    • getOptions

      public List<O> getOptions()
      Specified by:
      getOptions in interface OptionDialogFrame<O>
      Returns:
      The read-only list of available options in order.
    • getOptionComponent

      public Component getOptionComponent(O option)
      Description copied from interface: OptionDialogFrame
      Returns the component that represents the specified option.
      Specified by:
      getOptionComponent in interface OptionDialogFrame<O>
      Parameters:
      option - The option for which a component should be returned.
      Returns:
      The component, such as a button, that represents the given option, or null if there is no component that represents the given option.
    • createOptionContainer

      protected Container createOptionContainer()
      Creates a container for holding the options. This implementation creates a horizontal arrange panel.
      Returns:
      a container for holding the options.
      See Also:
    • initializeOptionContainer

      protected void initializeOptionContainer(Container optionContainer, List<O> options)
      Initializes the option container with the available options. Each component is added to the option container and to the map of option components.
      Parameters:
      optionContainer - The container to the options.
      options - The available options.
    • createOptionComponent

      protected abstract Component createOptionComponent(O option)
      Creates a component to represent the given option.
      Parameters:
      option - The option for which a component should be created.
      Returns:
      A component to represents the given option.