Class EntityInputComponents


  • public final class EntityInputComponents
    extends Object
    Provides input components for editing entities.
    • Method Detail

      • createInputComponent

        public static JComponent createInputComponent​(Property property,
                                                      Value value)
        Parameters:
        property - the property for which to create the input component
        value - the value to bind to the field
        Returns:
        the component handling input for property
      • createInputComponent

        public static JComponent createInputComponent​(Property property,
                                                      Value value,
                                                      StateObserver enabledState)
        Parameters:
        property - the property for which to create the input component
        value - the value to bind to the field
        enabledState - the enabled state
        Returns:
        the component handling input for property
      • createLabel

        public static JLabel createLabel​(Property property)
        Creates a JLabel with a caption from the given property, using the default label text alignment
        Parameters:
        property - the property for which to create the label
        Returns:
        a JLabel for the given property
        See Also:
        LABEL_TEXT_ALIGNMENT
      • createLabel

        public static JLabel createLabel​(Property property,
                                         int horizontalAlignment)
        Creates a JLabel with a caption from the given property
        Parameters:
        property - the property for which to create the label
        horizontalAlignment - the horizontal text alignment
        Returns:
        a JLabel for the given property
      • createCheckBox

        public static JCheckBox createCheckBox​(Property property,
                                               Value value)
        Creates a JCheckBox based on the given boolean property
        Parameters:
        property - the property on which value to base the checkbox
        value - the value to bind to the field
        Returns:
        a check box based on the given property
        Throws:
        IllegalArgumentException - in case the property is not a boolean property
      • createCheckBox

        public static JCheckBox createCheckBox​(Property property,
                                               Value value,
                                               StateObserver enabledState)
        Creates a JCheckBox based on the given boolean property
        Parameters:
        property - the property on which value to base the checkbox
        value - the value to bind to the field
        enabledState - the state controlling the enabled state of the checkbox
        Returns:
        a check box based on the given property
        Throws:
        IllegalArgumentException - in case the property is not a boolean property
      • createCheckBox

        public static JCheckBox createCheckBox​(Property property,
                                               Value value,
                                               StateObserver enabledState,
                                               boolean includeCaption)
        Creates a JCheckBox based on the given boolean property
        Parameters:
        property - the property on which value to base the checkbox
        value - the value to bind to the field
        enabledState - the state controlling the enabled state of the checkbox
        includeCaption - if true then the property caption is included as the checkbox text
        Returns:
        a check box based on the given property
        Throws:
        IllegalArgumentException - in case the property is not a boolean property
      • createNullableCheckBox

        public static NullableCheckBox createNullableCheckBox​(Property property,
                                                              Value value,
                                                              StateObserver enabledState,
                                                              boolean includeCaption)
        Creates a NullableCheckBox based on the given boolean property
        Parameters:
        property - the property on which value to base the checkbox
        value - the value to bind to the field
        enabledState - the state controlling the enabled state of the checkbox
        includeCaption - if true then the property caption is included as the checkbox text
        Returns:
        a check box based on the given property
        Throws:
        IllegalArgumentException - in case the property is not a nullable boolean property
      • createBooleanComboBox

        public static SteppedComboBox createBooleanComboBox​(Property property,
                                                            Value value)
        Creates a combobox containing the values (null, yes, no) based on the given boolean property
        Parameters:
        property - the property on which to base the combobox
        value - the value to bind to the field
        Returns:
        a SteppedComboBox based on the given boolean property
      • createBooleanComboBox

        public static SteppedComboBox createBooleanComboBox​(Property property,
                                                            Value value,
                                                            StateObserver enabledState)
        Creates a combobox containing the values (null, yes, no) based on the given boolean property
        Parameters:
        property - the property on which to base the combobox
        value - the value to bind to the field
        enabledState - the state controlling the enabled state of the combobox
        Returns:
        a SteppedComboBox based on the given boolean property
      • createForeignKeyComboBox

        public static EntityComboBox createForeignKeyComboBox​(ForeignKeyProperty foreignKeyProperty,
                                                              Value value,
                                                              SwingEntityComboBoxModel comboBoxModel)
        Creates EntityComboBox based on the given foreign key property
        Parameters:
        foreignKeyProperty - the foreign key property on which entity to base the combobox
        value - the value to bind to the field
        comboBoxModel - the combo box model
        Returns:
        a SwingEntityComboBox based on the given foreign key property
      • createForeignKeyComboBox

        public static EntityComboBox createForeignKeyComboBox​(ForeignKeyProperty foreignKeyProperty,
                                                              Value value,
                                                              SwingEntityComboBoxModel comboBoxModel,
                                                              StateObserver enabledState)
        Creates EntityComboBox based on the given foreign key property
        Parameters:
        foreignKeyProperty - the foreign key property on which entity to base the combobox
        value - the value to bind to the field
        comboBoxModel - the combo box model
        enabledState - the state controlling the enabled state of the combobox
        Returns:
        a EntityComboBox based on the given foreign key property
      • createForeignKeyLookupField

        public static EntityLookupField createForeignKeyLookupField​(ForeignKeyProperty foreignKeyProperty,
                                                                    Value value,
                                                                    EntityLookupModel lookupModel)
        Creates a EntityLookupField based on the given foreign key property
        Parameters:
        foreignKeyProperty - the foreign key property on which entity to base the lookup model
        value - the value to bind to the field
        lookupModel - the EntityLookupModel to use and to bind with the value
        Returns:
        a lookup model based on the given foreign key property
      • createForeignKeyLookupField

        public static EntityLookupField createForeignKeyLookupField​(ForeignKeyProperty foreignKeyProperty,
                                                                    Value value,
                                                                    EntityLookupModel lookupModel,
                                                                    StateObserver enabledState)
        Creates a EntityLookupField based on the given foreign key property
        Parameters:
        foreignKeyProperty - the foreign key property on which entity to base the lookup model
        value - the value to bind to the field
        lookupModel - the EntityLookupModel to use and to bind with the value
        enabledState - the state controlling the enabled state of the lookup field
        Returns:
        a lookup model based on the given foreign key property
      • createValueListComboBox

        public static SteppedComboBox createValueListComboBox​(ValueListProperty property,
                                                              Value value)
        Creates a combo box based on the values in the given value list property
        Parameters:
        property - the property
        value - the value to bind to the field
        Returns:
        a combo box based on the given values
      • createValueListComboBox

        public static SteppedComboBox createValueListComboBox​(ValueListProperty property,
                                                              Value value,
                                                              StateObserver enabledState)
        Creates a combo box based on the values in the given value list property
        Parameters:
        property - the property
        value - the value to bind to the field
        enabledState - the state controlling the enabled state of the combo box
        Returns:
        a combo box based on the given values
      • createValueListComboBox

        public static SteppedComboBox createValueListComboBox​(ValueListProperty property,
                                                              Value value,
                                                              boolean sortItems)
        Creates a combo box based on the values in the given value list property
        Parameters:
        property - the property
        value - the value to bind to the field
        sortItems - if true then the items are sorted
        Returns:
        a combo box based on the given values
      • createValueListComboBox

        public static SteppedComboBox createValueListComboBox​(ValueListProperty property,
                                                              Value value,
                                                              boolean sortItems,
                                                              StateObserver enabledState)
        Creates a combo box based on the values in the given value list property. If the property is nullable and the value list items do not include a null item, one is added to the combo box model.
        Parameters:
        property - the property
        value - the value to bind to the field
        sortItems - if true then the items are sorted
        enabledState - the state controlling the enabled state of the combo box
        Returns:
        a combo box based on the given values
      • createComboBox

        public static SteppedComboBox createComboBox​(Property property,
                                                     Value value,
                                                     ComboBoxModel model,
                                                     StateObserver enabledState)
        Creates a combo box based on the given combo box model
        Parameters:
        property - the property
        value - the value to bind to the field
        model - the combo box model
        enabledState - the state controlling the enabled state of the combo box
        Returns:
        a combo box based on the given model
      • createComboBox

        public static SteppedComboBox createComboBox​(Property property,
                                                     Value value,
                                                     ComboBoxModel model,
                                                     StateObserver enabledState,
                                                     boolean editable)
        Creates a combo box based on the given combo box model
        Parameters:
        property - the property
        value - the value to bind to the field
        model - the combo box model
        enabledState - the state controlling the enabled state of the combo box
        editable - if true then the combo box is made editable
        Returns:
        a combo box based on the given model
      • createTemporalInputPanel

        public static TemporalInputPanel createTemporalInputPanel​(Property property,
                                                                  Value value,
                                                                  UpdateOn updateOn,
                                                                  boolean includeButton)
        Creates a panel with a date input field and a button for opening a date input dialog
        Parameters:
        property - the property
        value - the value to bind to the field
        updateOn - specifies when the underlying value should be updated
        includeButton - if true then a button for opening a date input dialog is included (only available for LocalDate)
        Returns:
        a date input panel
      • createTemporalInputPanel

        public static TemporalInputPanel createTemporalInputPanel​(Property property,
                                                                  Value value,
                                                                  UpdateOn updateOn,
                                                                  boolean includeCalendarButton,
                                                                  StateObserver enabledState)
        Creates a panel with a date input field and a button for opening a date input dialog (if applicable)
        Parameters:
        property - the property
        value - the value to bind to the field
        updateOn - specifies when the underlying value should be updated
        includeCalendarButton - if true then a button for opening a calendar dialog is included
        enabledState - the state controlling the enabled state of the panel
        Returns:
        a date input panel
      • createTextInputPanel

        public static TextInputPanel createTextInputPanel​(Property property,
                                                          Value value,
                                                          UpdateOn updateOn,
                                                          boolean buttonFocusable)
        Creates a panel with a text field and a button for opening a dialog with a text area
        Parameters:
        property - the property
        value - the value to bind to the field
        updateOn - specifies when the underlying value should be updated
        buttonFocusable - if true then the dialog button is focusable
        Returns:
        a text input panel
      • createTextArea

        public static JTextArea createTextArea​(Property property,
                                               Value value,
                                               UpdateOn updateOn)
        Creates a text area based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        updateOn - specifies when the underlying value should be updated
        Returns:
        a text area
      • createTextArea

        public static JTextArea createTextArea​(Property property,
                                               Value value,
                                               int rows,
                                               int columns,
                                               UpdateOn updateOn)
        Creates a text area based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        rows - the number of rows
        columns - the number of columns
        updateOn - specifies when the underlying value should be updated
        Returns:
        a text area
      • createTextArea

        public static JTextArea createTextArea​(Property property,
                                               Value value,
                                               int rows,
                                               int columns,
                                               UpdateOn updateOn,
                                               StateObserver enabledState)
        Creates a text area based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        rows - the number of rows
        columns - the number of columns
        updateOn - specifies when the underlying value should be updated
        enabledState - a state indicating when the text area should be enabled
        Returns:
        a text area
      • createTextField

        public static JTextField createTextField​(Property property,
                                                 Value value)
        Creates a text field based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        Returns:
        a text field for the given property
      • createTextField

        public static JTextField createTextField​(Property property,
                                                 Value value,
                                                 String formatMaskString,
                                                 UpdateOn updateOn)
        Creates a text field based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        formatMaskString - if specified the resulting text field is a JFormattedField with this mask
        updateOn - specifies when the underlying value should be updated
        Returns:
        a text field for the given property
      • createTextField

        public static JTextField createTextField​(Property property,
                                                 Value value,
                                                 String formatMaskString,
                                                 UpdateOn updateOn,
                                                 StateObserver enabledState)
        Creates a text field based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        formatMaskString - if specified the resulting text field is a JFormattedField with this mask
        updateOn - specifies when the underlying value should be updated
        enabledState - the state controlling the enabled state of the panel
        Returns:
        a text field for the given property
      • createTextField

        public static JTextField createTextField​(Property property,
                                                 Value value,
                                                 String formatMaskString,
                                                 UpdateOn updateOn,
                                                 StateObserver enabledState,
                                                 boolean valueContainsLiteralCharacters)
        Creates a text field based on the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        formatMaskString - if specified the resulting text field is a JFormattedField with this mask
        updateOn - specifies when the underlying value should be updated
        enabledState - the state controlling the enabled state of the panel
        valueContainsLiteralCharacters - whether or not the value should contain any literal characters associated with a the format mask
        Returns:
        a text field for the given property
      • createPropertyComboBox

        public static SteppedComboBox createPropertyComboBox​(ColumnProperty property,
                                                             Value value,
                                                             ComboBoxModel comboBoxModel,
                                                             StateObserver enabledState)
        Creates a combo box based on the values of the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        comboBoxModel - the combo box model
        enabledState - the state controlling the enabled state of the panel
        Returns:
        a combo box based on the property values
      • createPropertyComboBox

        public static SteppedComboBox createPropertyComboBox​(ColumnProperty property,
                                                             Value value,
                                                             ComboBoxModel comboBoxModel,
                                                             StateObserver enabledState,
                                                             boolean editable)
        Creates a combo box based on the values of the given property
        Parameters:
        property - the property
        value - the value to bind to the field
        comboBoxModel - the combo box model
        enabledState - the state controlling the enabled state of the panel
        editable - if true then the combo box will be editable
        Returns:
        a combo box based on the property values
      • createEntityComboBoxFilterPanel

        public static JPanel createEntityComboBoxFilterPanel​(EntityComboBox entityComboBox,
                                                             String foreignKeyPropertyId,
                                                             boolean filterButtonTakesFocus)
        Creates a panel containing an EntityComboBox and a button for filtering that combo box based on a foreign key
        Parameters:
        entityComboBox - the combo box
        foreignKeyPropertyId - the foreign key to base the filtering on
        filterButtonTakesFocus - if true then the filter button is focusable
        Returns:
        a panel with a combo box and a button