Class FxComponentDelegate

    • Field Detail

      • MANDATORY_STYLE

        public static final java.lang.String MANDATORY_STYLE
        Mandatory CSS style class.
        See Also:
        Constant Field Values
      • ERROR_STYLE

        public static final java.lang.String ERROR_STYLE
        Error CSS style class.
        See Also:
        Constant Field Values
      • INFO_STYLE

        public static final java.lang.String INFO_STYLE
        Info CSS style class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FxComponentDelegate

        public FxComponentDelegate()
    • Method Detail

      • getComponent

        public abstract FxComponent getComponent()
        Gets the component of this delegate.
        Returns:
        the component
      • getNode

        public javafx.scene.Node getNode()
        Gets the component as a node.
        Returns:
        the node
      • getParentContainer

        public FxContainer getParentContainer()
        Description copied from interface: FxControl
        Gets the parent container.
        Specified by:
        getParentContainer in interface FxControl
        Returns:
        the parent, null if not a component of a container
      • toGenericString

        public java.lang.String toGenericString()
        Description copied from interface: FxControl
        Returns the classname plus optional fx:id.
        Specified by:
        toGenericString in interface FxControl
        Returns:
        the generic string for diagnostics and logging
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • updateChangeable

        protected void updateChangeable​(boolean changeable)
        Description copied from class: FxControlDelegate
        Updates other properties if changeable is bound to something else.
        Overrides:
        updateChangeable in class FxControlDelegate
        Parameters:
        changeable - the flag
      • createChangeableProperty

        protected javafx.beans.property.ReadOnlyBooleanWrapper createChangeableProperty​(boolean changeable)
        Description copied from class: FxControlDelegate
        Creates the changeable property.
        Overrides:
        createChangeableProperty in class FxControlDelegate
        Parameters:
        changeable - the initial value
        Returns:
        the property
      • setContainerChangeable

        public void setContainerChangeable​(boolean containerChangeable)
        Description copied from interface: FxControl
        Invoked when setChangeable() is invoked on the container of this component.
        Specified by:
        setContainerChangeable in interface FxControl
        Parameters:
        containerChangeable - true if container is changeable, false if all components readonly
      • setValueTranslator

        public void setValueTranslator​(ValueTranslator<?,​?> valueTranslator)
        Description copied from interface: FxComponent
        Sets a value translator.
        Specified by:
        setValueTranslator in interface FxComponent
        Parameters:
        valueTranslator - the translator
      • isUpdatingModel

        protected boolean isUpdatingModel()
        Returns a flag to avoid recursive invocations of updateModel().
        Returns:
        true if currently updating the model
      • isUpdatingView

        protected boolean isUpdatingView()
        Returns a flag to avoid recursive invocations of updateView().
        Returns:
        true if currently updating the view
      • updateView

        public void updateView()
        Description copied from interface: FxControl
        Updates the view according to the model.
        Specified by:
        updateView in interface FxControl
      • updateModel

        public void updateModel()
        Description copied from interface: FxControl
        Updates the model according to the view.
        Specified by:
        updateModel in interface FxControl
      • handleInputFailure

        protected void handleInputFailure​(java.lang.String msg)
        Handles a failure during conversion of the user's input to the model.
        Parameters:
        msg - the failure message
      • isModelUpdated

        public boolean isModelUpdated()
        Description copied from interface: FxComponent
        Returns whether model was updated and updateview not invoked since then.
        Some components, such as FxTableView, never update the model because this is already done by the ObservableList. On those cases, false will be returned.
        Specified by:
        isModelUpdated in interface FxComponent
        Returns:
        true if updateView could make sense
      • setError

        public void setError​(java.lang.String errorMessage)
        Description copied from interface: ErrorPopupSupported
        Sets the error message.
        Notice that an empty string will set the style but dows not show any popup.
        Specified by:
        setError in interface ErrorPopupSupported
        Parameters:
        errorMessage - the error message, null to clear
      • setErrorTemporary

        public void setErrorTemporary​(boolean errorTemporary)
        Description copied from interface: ErrorPopupSupported
        Sets the temporary error flag.
        Specified by:
        setErrorTemporary in interface ErrorPopupSupported
        Parameters:
        errorTemporary - true if this is a temporary error
      • isErrorTemporary

        public boolean isErrorTemporary()
        Description copied from interface: ErrorPopupSupported
        Returns whether this is a temporary error.
        Temporary errors are set by the value translators typically if some parsing failed. Non-temporary are set by the application, for example when a persistence validation failed.
        Specified by:
        isErrorTemporary in interface ErrorPopupSupported
        Returns:
        true if temporary error
      • updateErrorStyle

        protected void updateErrorStyle​(boolean enable)
        Updates the error style and shows/hides the popup if component has focus.
        Parameters:
        enable - true to enable style
      • getInfo

        public java.lang.String getInfo()
        Description copied from interface: InfoPopupSupported
        Gets the info message.
        Specified by:
        getInfo in interface InfoPopupSupported
        Returns:
        the message, null if no info
      • setInfo

        public void setInfo​(java.lang.String infoMessage)
        Description copied from interface: InfoPopupSupported
        Sets the info message.
        Notice that an empty string will set the style but dows not show any popup.
        Specified by:
        setInfo in interface InfoPopupSupported
        Parameters:
        infoMessage - the info message, null to clear
      • updateInfoStyle

        protected void updateInfoStyle​(boolean enable)
        Updates the info style and shows/hides the popup if component has focus.
        Parameters:
        enable - true to enable style
      • triggerViewModified

        public void triggerViewModified()
        Description copied from interface: FxControl
        Walks up the component hierarchy and updates the viewModified property.
        This is done by comparing the saved view value with the current view.
        Specified by:
        triggerViewModified in interface FxControl
      • saveView

        public void saveView()
        Description copied from interface: FxControl
        Creates a copy of the value shown to the user.
        Specified by:
        saveView in interface FxControl
      • invalidateSavedView

        public void invalidateSavedView()
        Description copied from interface: FxControl
        Invalidates the saved view.
        Specified by:
        invalidateSavedView in interface FxControl
      • isSavedViewObjectValid

        public boolean isSavedViewObjectValid()
        Description copied from interface: FxComponent
        Returns whether the view object is saved.
        Specified by:
        isSavedViewObjectValid in interface FxComponent
        Returns:
        true if saved, false if invalid
      • getSavedViewObject

        public java.lang.Object getSavedViewObject()
        Description copied from interface: FxComponent
        Retrieves the view value saved with FxControl.saveView().
        The returned type is the internal native type of the component.
        Specified by:
        getSavedViewObject in interface FxComponent
        Returns:
        the saved view value
      • setType

        public void setType​(java.lang.Class<?> type)
        Description copied from interface: FxComponent
        Sets the type for this component.

        Notice that the type can be applied only once. This is because previously installed listeners could cause memleaks.

        Specified by:
        setType in interface FxComponent
        Parameters:
        type - the type
      • setGenericType

        public void setGenericType​(java.lang.reflect.Type genericType)
        Description copied from interface: FxComponent
        Sets the generic type.
        Specified by:
        setGenericType in interface FxComponent
        Parameters:
        genericType - the generic type
      • getGenericType

        public java.lang.reflect.Type getGenericType()
        Description copied from interface: FxComponent
        Gets the generic type.
        Specified by:
        getGenericType in interface FxComponent
        Returns:
        the generic type
      • setMandatory

        public void setMandatory​(boolean mandatory)
        Description copied from interface: FxComponent
        Sets the mandatory option.
        Mandatory fields are differently visualized. There is no further functional difference.
        Specified by:
        setMandatory in interface FxComponent
        Parameters:
        mandatory - true if mandatory
      • isMandatory

        public boolean isMandatory()
        Description copied from interface: FxComponent
        Gets the mandatory option.
        Specified by:
        isMandatory in interface FxComponent
        Returns:
        true if mandatory
      • mandatoryProperty

        public javafx.beans.property.BooleanProperty mandatoryProperty()
        Description copied from interface: FxComponent
        Gets the mandatory property.
        Specified by:
        mandatoryProperty in interface FxComponent
        Returns:
        the property
      • updateMandatoryStyle

        protected void updateMandatoryStyle​(boolean mandatory)
        Does the physical update of the style. See resources/org/tentackle/fx/tentackle.css
        Parameters:
        mandatory - true if mandatory
      • setBindingPath

        public void setBindingPath​(java.lang.String bindingPath)
        Description copied from interface: FxComponent
        Sets the path to bind this component to.

        Usually the binding path will be determined from the components declared name. However, it can be set programatically as well.

        Specified by:
        setBindingPath in interface FxComponent
        Parameters:
        bindingPath - the binding path, for ex. "invoiceNumber", null if autobinding
        See Also:
        Binder
      • getBindingPath

        public java.lang.String getBindingPath()
        Description copied from interface: FxComponent
        Gets the binding path.
        Specified by:
        getBindingPath in interface FxComponent
        Returns:
        the field path, null if autobinding (default)
      • setComponentPath

        public void setComponentPath​(java.lang.String componentPath)
        Description copied from interface: FxComponent
        Sets the component path.

        The path is <declaring-class-name>.<field-name>. Example "de.krake.invoicer.InvoicePanel.customerNumberField".

        Notice: the component path is set during binding.

        Specified by:
        setComponentPath in interface FxComponent
        Parameters:
        componentPath - the component path
      • getComponentPath

        public java.lang.String getComponentPath()
        Description copied from interface: FxComponent
        Gets the component path.
        Specified by:
        getComponentPath in interface FxComponent
        Returns:
        the component path, null if not bound
      • getTableCell

        public FxTableCell<?,​?> getTableCell()
        Description copied from interface: FxComponent
        Gets the table cell if the component is used as a table cell editor.
        Specified by:
        getTableCell in interface FxComponent
        Returns:
        the cell, null if not a cell editor
      • setTableCell

        public void setTableCell​(FxTableCell<?,​?> tableCell)
        Description copied from interface: FxComponent
        Sets the table cell if the component is used as a table cell editor.
        Specified by:
        setTableCell in interface FxComponent
        Parameters:
        tableCell - the cell, null to disconnect from table cell