Class BaseController

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javafx.scene.control.Button clearButton
      The Clear Selections button, injected by the parent view.
      protected static java.text.NumberFormat DOLLAR_FORMATTER
      Currency formatter for displaying monetary values.
      protected javafx.scene.control.Button nextButton
      The Next/Generate PDF button, injected by the parent view.
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseController()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void bindIntegerTextField​(javafx.scene.control.TextField field, javafx.beans.property.IntegerProperty prop)
      Binds a TextField bidirectionally to an IntegerProperty, displaying a blank field when the value is zero.
      protected javafx.scene.control.CheckBox buildCheckBox​(java.lang.String label, int row, javafx.scene.layout.GridPane grid)
      Builds a CheckBox and adds it to column 0 of the specified row in the grid.
      protected javafx.scene.control.TextField buildPriceField​(javafx.beans.property.ObjectProperty<java.math.BigDecimal> priceProperty, int row, javafx.scene.layout.GridPane grid)
      Builds an editable price TextField bound to the given BigDecimal property.
      protected void buildPriceLabel​(java.math.BigDecimal cost, int row, javafx.scene.layout.GridPane grid)
      Builds a read-only price Label and adds it to column 2 of the specified row.
      protected javafx.scene.control.TextField buildTextField​(int columnCount, int column, int row, javafx.scene.layout.GridPane grid)
      Builds a TextField and adds it to the specified column and row in the grid.
      protected void clearAll()
      Clears all selections and refreshes the tab total.
      protected void configTextFieldForInts​(javafx.scene.control.TextField... fields)
      Applies an integer-only TextFormatter to the given text fields, restricting input to digits and an optional leading minus sign.
      protected void configureClearButton​(java.util.List<javafx.scene.control.CheckBox> checkBoxes)
      Configures the clear button with a disabled binding and action.
      javafx.beans.binding.BooleanBinding hasInvalidSelections()
      Returns a binding that is true when any checked item is missing a required price.
      protected void onClearButtonSet()
      Called after the clear button is injected.
      void onHide()
      Called when this tab is deselected.
      protected void onNextButtonSet()
      Called after the next button is injected.
      void onShow()
      Called when this tab becomes selected.
      protected void refreshTotal()
      Refreshes the tab total label.
      void reset()
      No-op in the base class.
      void setClearButton​(javafx.scene.control.Button clearButton)
      Injects the clear button and triggers onClearButtonSet().
      void setNextButton​(javafx.scene.control.Button nextButton)
      Injects the next button and triggers onNextButtonSet().
      protected void wireTextFieldToCheckBox​(javafx.scene.control.TextField tf, javafx.scene.control.CheckBox cb)
      Wires a TextField to a CheckBox such that the checkbox is selected when the field has a non-empty value, and the tab total is refreshed on every change.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DOLLAR_FORMATTER

        protected static final java.text.NumberFormat DOLLAR_FORMATTER
        Currency formatter for displaying monetary values.
      • clearButton

        protected javafx.scene.control.Button clearButton
        The Clear Selections button, injected by the parent view.
      • nextButton

        protected javafx.scene.control.Button nextButton
        The Next/Generate PDF button, injected by the parent view.
    • Constructor Detail

      • BaseController

        public BaseController()
    • Method Detail

      • setClearButton

        public void setClearButton​(javafx.scene.control.Button clearButton)
        Injects the clear button and triggers onClearButtonSet().
        Parameters:
        clearButton - the button to use for clearing selections
      • setNextButton

        public void setNextButton​(javafx.scene.control.Button nextButton)
        Injects the next button and triggers onNextButtonSet().
        Parameters:
        nextButton - the button to use for advancing to the next tab
      • onClearButtonSet

        protected void onClearButtonSet()
        Called after the clear button is injected. Override to wire clear button behavior specific to the controller.
      • onNextButtonSet

        protected void onNextButtonSet()
        Called after the next button is injected. Override to wire next button behavior specific to the controller.
      • reset

        public void reset()
        No-op in the base class. Override to reset the controller to its default state.
      • buildCheckBox

        protected javafx.scene.control.CheckBox buildCheckBox​(java.lang.String label,
                                                              int row,
                                                              javafx.scene.layout.GridPane grid)
        Builds a CheckBox and adds it to column 0 of the specified row in the grid.
        Parameters:
        label - the display text for the checkbox
        row - the grid row index
        grid - the target GridPane
        Returns:
        the constructed CheckBox
      • buildPriceLabel

        protected void buildPriceLabel​(java.math.BigDecimal cost,
                                       int row,
                                       javafx.scene.layout.GridPane grid)
        Builds a read-only price Label and adds it to column 2 of the specified row. Displays a blank label if cost is null.
        Parameters:
        cost - the monetary value to display, or null for a blank label
        row - the grid row index
        grid - the target GridPane
      • buildTextField

        protected javafx.scene.control.TextField buildTextField​(int columnCount,
                                                                int column,
                                                                int row,
                                                                javafx.scene.layout.GridPane grid)
        Builds a TextField and adds it to the specified column and row in the grid.
        Parameters:
        columnCount - the preferred column count for sizing
        column - the grid column index
        row - the grid row index
        grid - the target GridPane
        Returns:
        the constructed TextField
      • wireTextFieldToCheckBox

        protected void wireTextFieldToCheckBox​(javafx.scene.control.TextField tf,
                                               javafx.scene.control.CheckBox cb)
        Wires a TextField to a CheckBox such that the checkbox is selected when the field has a non-empty value, and the tab total is refreshed on every change.
        Parameters:
        tf - the text field to observe
        cb - the checkbox to drive
      • configureClearButton

        protected void configureClearButton​(java.util.List<javafx.scene.control.CheckBox> checkBoxes)
        Configures the clear button with a disabled binding and action. The button is disabled when no checkboxes are selected. Override in subclasses to add additional dependencies (e.g. a ComboBox).
        Parameters:
        checkBoxes - the list of checkboxes the button should observe and clear
      • clearAll

        protected void clearAll()
        Clears all selections and refreshes the tab total. Override in subclasses to add additional clearing behavior.
      • configTextFieldForInts

        protected void configTextFieldForInts​(javafx.scene.control.TextField... fields)
        Applies an integer-only TextFormatter to the given text fields, restricting input to digits and an optional leading minus sign.
        Parameters:
        fields - one or more text fields to configure
      • bindIntegerTextField

        protected void bindIntegerTextField​(javafx.scene.control.TextField field,
                                            javafx.beans.property.IntegerProperty prop)
        Binds a TextField bidirectionally to an IntegerProperty, displaying a blank field when the value is zero.
        Parameters:
        field - the text field to bind
        prop - the integer property to bind to
      • buildPriceField

        protected javafx.scene.control.TextField buildPriceField​(javafx.beans.property.ObjectProperty<java.math.BigDecimal> priceProperty,
                                                                 int row,
                                                                 javafx.scene.layout.GridPane grid)
        Builds an editable price TextField bound to the given BigDecimal property. Input is restricted to valid currency format, and the value is formatted as currency via BigDecimalCurrencyConverter.
        Parameters:
        priceProperty - the property to bind the field's value to
        row - the grid row index
        grid - the target GridPane
        Returns:
        the constructed price TextField
      • hasInvalidSelections

        public javafx.beans.binding.BooleanBinding hasInvalidSelections()
        Returns a binding that is true when any checked item is missing a required price. Always false in the base class; overridden in GridTabController.
        Returns:
        a BooleanBinding indicating whether any checked item is missing a required price
      • refreshTotal

        protected void refreshTotal()
        Refreshes the tab total label. No-op in the base class; overridden in GridTabController when a total supplier is set.
      • onShow

        public void onShow()
        Called when this tab becomes selected. Override to perform any refresh or update logic needed on tab activation.
      • onHide

        public void onHide()
        Called when this tab is deselected. Override to perform any cleanup logic needed on tab deactivation.