Class ComponentAdapter


  • public abstract class ComponentAdapter
    extends Object
    A component adapter provides the GUI components used to edit a bound property value.

    Clients may derive their own component adapters by implementing this abstract class.

    The actual binding is established by calling BindingContext.bind(String, ComponentAdapter). The returned binding may be undone later by calling BindingContext.unbind(Binding).

    Since:
    Ceres 0.6
    Version:
    $Revision$ $Date$
    • Constructor Detail

      • ComponentAdapter

        public ComponentAdapter()
    • Method Detail

      • getBinding

        public Binding getBinding()
        Gets the binding which is using this adapter.
        Returns:
        The binding.
      • setBinding

        public final void setBinding​(Binding binding)
        Sets the binding which is using this adapter.

        Clients shall never call this method directly, it is called by the framework.

        Parameters:
        binding - The binding.
        Throws:
        IllegalStateException - if the binding has already been set.
      • getComponents

        public abstract JComponent[] getComponents()
        Gets the components participating in the binding.
        Returns:
        The array of components. Must not be empty.
      • bindComponents

        public abstract void bindComponents()
        Called by the framework in order to bind the GUI components to the bound property.

        The frameworks called this method immediately after setBinding(Binding) has been called.

        Most implementations will register a change listener in the editor component which convert the input value and set the bound property by calling getBinding().setPropertyValue(value).

        See Also:
        adjustComponents(), unbindComponents()
      • unbindComponents

        public abstract void unbindComponents()
        Called by the framework in order to unbind the GUI components from the bound property.

        Most implementations will deregister any registered change listeners from the editor component.

        See Also:
        bindComponents(), adjustComponents()