Interface WidgetHandler

  • All Known Implementing Classes:
    RadioGroupWidgetHandler

    public interface WidgetHandler

    Definition of an interface for dealing with widgets.

    A widget is an arbitrary GUI element. It can be an input element like a text field, or a checkbox, but also a simple graphical element like a label, or a panel. Through the methods provided by this interface such widgets can be manipulated; for instance they can be made invisible, or their colors can be changed. This way it is possible to change the GUI dynamically.

    ComponentBuilderData provides methods for obtaining the widgets created during the latest builder operation by name. After a WidgetHandler has been obtained this way, it can be used for doing something with the corresponding widget.

    Note: This interface is not intended to be directly implemented by client code. It is subject to change even in minor releases as new features are made available.

    Version:
    $Id: WidgetHandler.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • getWidget

        Object getWidget()
        Returns a reference to the underlying widget. This is the platform-specific GUI control. For instance, if Swing was used as GUI platform, a Component object would be returned.
        Returns:
        the underlying GUI control
      • isVisible

        boolean isVisible()
        Returns a flag whether the wrapped widget is currently visible.
        Returns:
        the visible flag of the wrapped widget
      • setVisible

        void setVisible​(boolean f)
        Sets the visible flag of the wrapped widget. Using this method a widget can be hidden and made visible again.
        Parameters:
        f - the visible flag of the wrapped widget
      • getBackgroundColor

        Color getBackgroundColor()
        Returns the background color of the underlying widget.
        Returns:
        the background color of this widget
      • setBackgroundColor

        void setBackgroundColor​(Color c)
        Sets the background color of the underlying widget.
        Parameters:
        c - the new background color (as a platform-independent Color object); if the passed in color object is null, this operation has no effect
      • getForegroundColor

        Color getForegroundColor()
        Returns the foreground color of the underlying widget.
        Returns:
        the foreground color of this widget
      • setForegroundColor

        void setForegroundColor​(Color c)
        Sets the foreground color of the underlying widget.
        Parameters:
        c - the new background color (as a platform-independent Color object); if the passed in color object is null, this operation has no effect
      • getToolTip

        String getToolTip()
        Returns the tool tip text of the underlying widget. This can be null if no tool tip was set. Note: It is possible that an implementation returns a different tool tip text than the one passed to setToolTip(String). This is due to the fact that certain control characters like line feeds may have to be converted by a concrete implementation. To avoid confusion related to changed tool tips client code should only interact with the ToolTipManager to manipulate tool tips.
        Returns:
        the tool tip of this widget
      • setToolTip

        void setToolTip​(String tip)
        Sets the tool tip text of the underlying widget. Note: Client code should not call this method directly. Rather, the ToolTipManager should be used for setting tool tips for widgets.
        Parameters:
        tip - the new tool tip text
      • getFont

        Object getFont()
        Returns the font of this widget. This is a platform-specific object.
        Returns:
        the font of this widget
      • setFont

        void setFont​(Object font)
        Sets the font of this widget. The font is a platform-specific object. It can be created in builder scripts using the <f:font> tag or directly using the createFont() method of ComponentManager. Concrete implementations may throw a runtime exception if the font object passed to this method is invalid.
        Parameters:
        font - the font to be set