Interface ComponentHandler<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object getComponent()
      Returns a reference to the real component that is wrapped by this component handler.
      T getData()
      Returns the data of the wrapped component.
      Object getOuterComponent()
      Returns the outer most component, which is the component to be added to the enclosing container.
      Class<?> getType()
      Returns the data type used by this component.
      boolean isEnabled()
      Returns a flag whether this component is enabled.
      void setData​(T data)
      Sets the data of the wrapped component.
      void setEnabled​(boolean f)
      Allows to set the enabled flag.
    • Method Detail

      • getComponent

        Object getComponent()
        Returns a reference to the real component that is wrapped by this component handler.
        Returns:
        the underlying component
      • getOuterComponent

        Object getOuterComponent()
        Returns the outer most component, which is the component to be added to the enclosing container. It may sometimes be necessary that for one GUI widget not a single component can be created, but multiple ones are necessary. An example would be a text area in Swing, which is comprised of the Swing text area itself plus a scroll pane object. In this example the outer component would be the scroll pane, the component (returned by getComponent() would be the text area. The mechanism with the outer component allows a GUI library specific implementation to construct composite components for certain complex widgets, but from the client's view they behave like a single one.
        Returns:
        the outer component
      • getData

        T getData()
        Returns the data of the wrapped component. This is the data the user has entered, e.g. text.
        Returns:
        the component's data
      • setData

        void setData​(T data)
        Sets the data of the wrapped component. This method can be used to initialize GUI widgets, e.g. to set default text at start up.
        Parameters:
        data - the data to set
      • getType

        Class<?> getType()
        Returns the data type used by this component. The Class object returned here determines, which type is allowed for the getData() and setData() methods. It depends on the concrete GUI component. For text fields it will be a string, for checkboxes probably a boolean etc.
        Returns:
        the data type used by this component
      • isEnabled

        boolean isEnabled()
        Returns a flag whether this component is enabled.
        Returns:
        the enabled flag
      • setEnabled

        void setEnabled​(boolean f)
        Allows to set the enabled flag. A disabled component cannot be focused and does not accept user input.
        Parameters:
        f - the value of the enabled flag