java.lang.Object
is.codion.swing.framework.ui.component.EntityComponents

public class EntityComponents extends Object
A factory for ComponentBuilder instances based on attributes from a given entity definition.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    A factory for list builders.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntityComponents(is.codion.framework.domain.entity.EntityDefinition entityDefinition)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final is.codion.swing.common.ui.component.text.NumberField.Builder<BigDecimal>
    bigDecimalField(is.codion.framework.domain.entity.attribute.Attribute<BigDecimal> attribute)
    Creates a NumberField builder based on the given attribute.
    final is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<Boolean>
    booleanComboBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
    Creates a boolean ComboBox builder based on the given attribute.
    final is.codion.swing.common.ui.component.button.CheckBoxBuilder
    checkBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
    Creates a CheckBox builder based on the given attribute.
    final <T, C extends JComboBox<T>, B extends is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T, C, B>>
    is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T,C,B>
    comboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, ComboBoxModel<T> comboBoxModel)
    Creates a JComboBox builder based on the given attribute.
    <T, C extends JComponent, B extends is.codion.swing.common.ui.component.builder.ComponentBuilder<T, C, B>>
    is.codion.swing.common.ui.component.builder.ComponentBuilder<T,C,B>
    component(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns a ComponentBuilder instance for a default input component for the given attribute.
    final is.codion.swing.common.ui.component.text.NumberField.Builder<Double>
    doubleField(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute)
    Creates a NumberField builder based on the given attribute.
    final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Double>
    doubleSpinner(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute)
    Creates a JSpinner builder based on the given attribute.
    final is.codion.framework.domain.entity.EntityDefinition
     
    foreignKeyComboBox(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel)
    Creates a foreign key ComboBox builder based on the given foreign key.
    foreignKeyComboBoxPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel, Supplier<EntityEditPanel> editPanel)
    Creates a builder for a foreign key combo box panel with optional buttons for adding and editing items.
    final is.codion.swing.common.ui.component.label.LabelBuilder<is.codion.framework.domain.entity.Entity>
    foreignKeyLabel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
    Creates a foreign key label builder based on the given foreign key.
    foreignKeySearchField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel)
    Creates a foreign key search field builder based on the given foreign key.
    foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel)
    Creates a builder for a foreign key search field panel with an optional button for performing a search.
    foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel, Supplier<EntityEditPanel> editPanel)
    Creates a builder for a foreign key search field panel with optional buttons for adding and editing items.
    final <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity, JTextField, B>>
    is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,JTextField,B>
    foreignKeyTextField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
    Creates foreign key text field builder for the given foreign key, read-only and non-focusable.
    final is.codion.swing.common.ui.component.text.NumberField.Builder<Integer>
    integerField(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
    Creates a NumberField builder based on the given attribute.
    final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Integer>
    integerSpinner(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
    Creates a JSpinner builder based on the given attribute.
    final <T> is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<T>
    itemComboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Creates a JComboBox builder based on the given attribute.
    final <T> is.codion.swing.common.ui.component.spinner.ItemSpinnerBuilder<T>
    itemSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Creates a JSpinner builder based on the given attribute.
    list(ListModel<T> listModel)
     
    final <T> is.codion.swing.common.ui.component.spinner.ListSpinnerBuilder<T>
    listSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, SpinnerListModel listModel)
    Creates a JSpinner builder based on the given attribute.
    final is.codion.swing.common.ui.component.text.NumberField.Builder<Long>
    longField(is.codion.framework.domain.entity.attribute.Attribute<Long> attribute)
    Creates a NumberField builder based on the given attribute.
    final is.codion.swing.common.ui.component.text.MaskedTextFieldBuilder
    maskedTextField(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
    Creates a masked text field builder based on the given attribute.
    final is.codion.swing.common.ui.component.text.NumberField.Builder<Short>
    shortField(is.codion.framework.domain.entity.attribute.Attribute<Short> attribute)
    Creates a NumberField builder based on the given attribute.
    final is.codion.swing.common.ui.component.slider.SliderBuilder
    slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
    Creates a JSlider builder based on the given attribute, with a bounded range model based on the min/max values of the associated attribute.
    final is.codion.swing.common.ui.component.slider.SliderBuilder
    slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute, BoundedRangeModel boundedRangeModel)
    Creates a JSlider builder based on the given attribute.
    boolean
    supports(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
     
    final <T extends Temporal>
    is.codion.swing.common.ui.component.text.TemporalField.Builder<T>
    temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Creates a TemporalField builder based on the given attribute.
    final <T extends Temporal>
    is.codion.swing.common.ui.component.text.TemporalField.Builder<T>
    temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern)
    Creates a TemporalField builder based on the given attribute.
    final <T extends Temporal>
    is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T>
    temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Creates a TemporalFieldPanel builder based on the given attribute.
    final <T extends Temporal>
    is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T>
    temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern)
    Creates a TemporalFieldPanel builder based on the given attribute.
    final is.codion.swing.common.ui.component.text.TextAreaBuilder
    textArea(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
    Creates a TextArea builder based on the given attribute.
    final <T, C extends JTextField, B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<T, C, B>>
    is.codion.swing.common.ui.component.text.TextFieldBuilder<T,C,B>
    textField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Creates a text field builder based on the given attribute.
    final is.codion.swing.common.ui.component.text.TextFieldPanel.Builder
    textFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
    Creates a TextFieldPanel builder based on the given attribute.
    final <B extends is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean, JToggleButton, B>>
    is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,JToggleButton,B>
    toggleButton(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
    Creates a ToggleButton builder based on the given attribute.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntityComponents

      public EntityComponents(is.codion.framework.domain.entity.EntityDefinition entityDefinition)
      Parameters:
      entityDefinition - the entity definition
  • Method Details

    • entityDefinition

      public final is.codion.framework.domain.entity.EntityDefinition entityDefinition()
      Returns:
      the underlying entity definition
    • supports

      public boolean supports(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Parameters:
      attribute - the attribute
      Returns:
      true if component(Attribute) supports the given attribute
    • component

      public <T, C extends JComponent, B extends is.codion.swing.common.ui.component.builder.ComponentBuilder<T, C, B>> is.codion.swing.common.ui.component.builder.ComponentBuilder<T,C,B> component(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns a ComponentBuilder instance for a default input component for the given attribute.
      Type Parameters:
      T - the attribute type
      C - the component type
      B - the builder type
      Parameters:
      attribute - the attribute for which to create the input component
      Returns:
      the component builder handling input for attribute
      Throws:
      IllegalArgumentException - in case the attribute type is not supported
      See Also:
    • checkBox

      public final is.codion.swing.common.ui.component.button.CheckBoxBuilder checkBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
      Creates a CheckBox builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JCheckBox builder
    • toggleButton

      public final <B extends is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean, JToggleButton, B>> is.codion.swing.common.ui.component.button.ButtonBuilder<Boolean,JToggleButton,B> toggleButton(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
      Creates a ToggleButton builder based on the given attribute.
      Type Parameters:
      B - the builder type
      Parameters:
      attribute - the attribute
      Returns:
      a JToggleButton builder
    • booleanComboBox

      public final is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<Boolean> booleanComboBox(is.codion.framework.domain.entity.attribute.Attribute<Boolean> attribute)
      Creates a boolean ComboBox builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a boolean JComboBox builder
    • foreignKeyComboBox

      public final EntityComboBox.Builder foreignKeyComboBox(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel)
      Creates a foreign key ComboBox builder based on the given foreign key.
      Parameters:
      foreignKey - the foreign key
      comboBoxModel - the combo box model
      Returns:
      a foreign key JComboBox builder
    • foreignKeyComboBoxPanel

      public final EntityComboBoxPanel.Builder foreignKeyComboBoxPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.swing.framework.model.component.EntityComboBoxModel comboBoxModel, Supplier<EntityEditPanel> editPanel)
      Creates a builder for a foreign key combo box panel with optional buttons for adding and editing items.
      Parameters:
      foreignKey - the foreign key
      comboBoxModel - the combo box model
      editPanel - supplies the edit panel to use for the add and/or edit buttons
      Returns:
      a foreign key combo box panel builder
    • foreignKeySearchField

      public final EntitySearchField.Builder foreignKeySearchField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel)
      Creates a foreign key search field builder based on the given foreign key.
      Parameters:
      foreignKey - the foreign key
      searchModel - the search model
      Returns:
      a foreign key EntitySearchField builder
    • foreignKeySearchFieldPanel

      public final EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel)
      Creates a builder for a foreign key search field panel with an optional button for performing a search.
      Parameters:
      foreignKey - the foreign key
      searchModel - the search model
      Returns:
      a foreign key search field panel builder
    • foreignKeySearchFieldPanel

      public final EntitySearchFieldPanel.Builder foreignKeySearchFieldPanel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, is.codion.framework.model.EntitySearchModel searchModel, Supplier<EntityEditPanel> editPanel)
      Creates a builder for a foreign key search field panel with optional buttons for adding and editing items.
      Parameters:
      foreignKey - the foreign key
      searchModel - the search model
      editPanel - supplies the edit panel to use for the add and/or edit buttons
      Returns:
      a foreign key search field panel builder
    • foreignKeyTextField

      public final <B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity, JTextField, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<is.codion.framework.domain.entity.Entity,JTextField,B> foreignKeyTextField(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Creates foreign key text field builder for the given foreign key, read-only and non-focusable.
      Type Parameters:
      B - the builder type
      Parameters:
      foreignKey - the foreign key
      Returns:
      a foreign key JTextField builder
    • foreignKeyLabel

      public final is.codion.swing.common.ui.component.label.LabelBuilder<is.codion.framework.domain.entity.Entity> foreignKeyLabel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Creates a foreign key label builder based on the given foreign key.
      Parameters:
      foreignKey - the foreign key
      Returns:
      a foreign key JLabel builder
    • itemComboBox

      public final <T> is.codion.swing.common.ui.component.combobox.ItemComboBoxBuilder<T> itemComboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Creates a JComboBox builder based on the given attribute. Note that the attribute must have items associated.
      Type Parameters:
      T - the attribute type
      Parameters:
      attribute - the attribute
      Returns:
      an Item based JComboBox builder
      Throws:
      IllegalArgumentException - in case the given attribute has no associated items
    • comboBox

      public final <T, C extends JComboBox<T>, B extends is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T, C, B>> is.codion.swing.common.ui.component.combobox.ComboBoxBuilder<T,C,B> comboBox(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, ComboBoxModel<T> comboBoxModel)
      Creates a JComboBox builder based on the given attribute.
      Type Parameters:
      T - the attribute type
      C - the component type
      B - the builder type
      Parameters:
      attribute - the attribute
      comboBoxModel - the combo box model
      Returns:
      a JComboBox builder
    • temporalFieldPanel

      public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T> temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Creates a TemporalFieldPanel builder based on the given attribute.
      Type Parameters:
      T - the attribute type
      Parameters:
      attribute - the attribute
      Returns:
      a TemporalFieldPanel builder
    • temporalFieldPanel

      public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalFieldPanel.Builder<T> temporalFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern)
      Creates a TemporalFieldPanel builder based on the given attribute.
      Type Parameters:
      T - the attribute type
      Parameters:
      attribute - the attribute
      dateTimePattern - the date time pattern
      Returns:
      a TemporalFieldPanel builder
    • textFieldPanel

      public final is.codion.swing.common.ui.component.text.TextFieldPanel.Builder textFieldPanel(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
      Creates a TextFieldPanel builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a TextFieldPanel builder
    • textArea

      public final is.codion.swing.common.ui.component.text.TextAreaBuilder textArea(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
      Creates a TextArea builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JTextArea builder
    • textField

      public final <T, C extends JTextField, B extends is.codion.swing.common.ui.component.text.TextFieldBuilder<T, C, B>> is.codion.swing.common.ui.component.text.TextFieldBuilder<T,C,B> textField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Creates a text field builder based on the given attribute.
      Type Parameters:
      T - the attribute type
      C - the text field type
      B - the builder type
      Parameters:
      attribute - the attribute
      Returns:
      a JTextField builder
    • temporalField

      public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalField.Builder<T> temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Creates a TemporalField builder based on the given attribute.
      Type Parameters:
      T - the temporal type
      Parameters:
      attribute - the attribute
      Returns:
      a TemporalField builder
    • temporalField

      public final <T extends Temporal> is.codion.swing.common.ui.component.text.TemporalField.Builder<T> temporalField(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, String dateTimePattern)
      Creates a TemporalField builder based on the given attribute.
      Type Parameters:
      T - the temporal type
      Parameters:
      attribute - the attribute
      dateTimePattern - the date time pattern
      Returns:
      a TemporalField builder
    • shortField

      public final is.codion.swing.common.ui.component.text.NumberField.Builder<Short> shortField(is.codion.framework.domain.entity.attribute.Attribute<Short> attribute)
      Creates a NumberField builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder
    • integerField

      public final is.codion.swing.common.ui.component.text.NumberField.Builder<Integer> integerField(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
      Creates a NumberField builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder
    • longField

      public final is.codion.swing.common.ui.component.text.NumberField.Builder<Long> longField(is.codion.framework.domain.entity.attribute.Attribute<Long> attribute)
      Creates a NumberField builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder
    • doubleField

      public final is.codion.swing.common.ui.component.text.NumberField.Builder<Double> doubleField(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute)
      Creates a NumberField builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder
    • bigDecimalField

      public final is.codion.swing.common.ui.component.text.NumberField.Builder<BigDecimal> bigDecimalField(is.codion.framework.domain.entity.attribute.Attribute<BigDecimal> attribute)
      Creates a NumberField builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a NumberField builder
    • slider

      public final is.codion.swing.common.ui.component.slider.SliderBuilder slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
      Creates a JSlider builder based on the given attribute, with a bounded range model based on the min/max values of the associated attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JSlider builder
    • slider

      public final is.codion.swing.common.ui.component.slider.SliderBuilder slider(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute, BoundedRangeModel boundedRangeModel)
      Creates a JSlider builder based on the given attribute.
      Parameters:
      attribute - the attribute
      boundedRangeModel - the bounded range model
      Returns:
      a JSlider builder
    • integerSpinner

      public final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Integer> integerSpinner(is.codion.framework.domain.entity.attribute.Attribute<Integer> attribute)
      Creates a JSpinner builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JSpinner builder
    • doubleSpinner

      public final is.codion.swing.common.ui.component.spinner.NumberSpinnerBuilder<Double> doubleSpinner(is.codion.framework.domain.entity.attribute.Attribute<Double> attribute)
      Creates a JSpinner builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JSpinner builder
    • listSpinner

      public final <T> is.codion.swing.common.ui.component.spinner.ListSpinnerBuilder<T> listSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, SpinnerListModel listModel)
      Creates a JSpinner builder based on the given attribute.
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      listModel - the spinner model
      Returns:
      a JSpinner builder
    • itemSpinner

      public final <T> is.codion.swing.common.ui.component.spinner.ItemSpinnerBuilder<T> itemSpinner(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Creates a JSpinner builder based on the given attribute.
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      a JSpinner builder
    • maskedTextField

      public final is.codion.swing.common.ui.component.text.MaskedTextFieldBuilder maskedTextField(is.codion.framework.domain.entity.attribute.Attribute<String> attribute)
      Creates a masked text field builder based on the given attribute.
      Parameters:
      attribute - the attribute
      Returns:
      a JFormattedTextField builder
    • list

      public final <T> EntityComponents.EntityListBuilderFactory<T> list(ListModel<T> listModel)
      Type Parameters:
      T - the value type
      Parameters:
      listModel - the list model to base the list on
      Returns:
      a builder factory for a list