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:

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.
Garret Wilson
  • Constructor Details

    • AbstractOptionDialogFrame

      public AbstractOptionDialogFrame(ValueModel<O> valueModel, Component component, O... options)
      Value model, component, and options constructor. Duplicate options are ignored.
      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.
      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
      setContent in class AbstractFrame
      newContent - The content child component, or null if this component does not have a content child component.
      See Also:
    • getContentContainer

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

      public Component getOptionContent()
      Specified by:
      getOptionContent in interface OptionDialogFrame<O>
      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>
      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>
      The container containing the options.
    • getOptions

      public List<O> getOptions()
      Specified by:
      getOptions in interface OptionDialogFrame<O>
      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>
      option - The option for which a component should be returned.
      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.
      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.
      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.
      option - The option for which a component should be created.
      A component to represents the given option.