Interface PercentLayoutPlatformAdapter


  • public interface PercentLayoutPlatformAdapter

    Definition of an interface that encapsulates platform (library) specific access to GUI components that are managed by a percent layout manager.

    The family of percent layout managers is intended to work together with different GUI libraries. To achieve this the classes cannot directly access the managed components. They rather implement only the layouting algorithms and delegate to a platform specific adapter when it comes to manipulating components.

    This interface defines how such an adapter looks like. It contains methods that can roughly be devided into two different groups: One group allows access to the components currently associated with this layout manager and their layout constraints. The other group supports manipulating of components and accessing their properties.

    For each specific GUI library to be supported by percent layouts an adapter class has to be created. This single adapter class will then play together with all different percent layout implementations.

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

      • getComponentCount

        int getComponentCount()
        Returns the number of components that belong to this layout manager.
        Returns:
        the number of managed components
      • getComponent

        Object getComponent​(int index)
        Returns the component with the given index.
        Parameters:
        index - the index of a component (0-based)
        Returns:
        the component with this index
      • getConstraints

        Object getConstraints​(int index)
        Returns the constraints object for the component with the given index.
        Parameters:
        index - the index of a component (0-based)
        Returns:
        the constraints object for this component
      • getSizeHandler

        UnitSizeHandler getSizeHandler()
        Returns the platform specific UnitSizeHandler implementation.
        Returns:
        the SizeHandler for this platform
      • getMinimumComponentSize

        int getMinimumComponentSize​(Object component,
                                    boolean vert)
        Returns the minimum component size of the specified component for the given axis.
        Parameters:
        component - the component
        vert - the direction flag (true for the y axis, false for the x axis)
        Returns:
        the minimum component size
      • getPreferredComponentSize

        int getPreferredComponentSize​(Object component,
                                      boolean vert)
        Returns the preferred component size of the specified component for the given axis.
        Parameters:
        component - the component
        vert - the direction flag (true for the y axis, false for the x axis)
        Returns:
        the preferred component size
      • setComponentBounds

        void setComponentBounds​(Object component,
                                Rectangle bounds)
        Sets the bounds of a component. This method will be invoked after the layout manager has calculated the final bounds of a component.
        Parameters:
        component - the affected component
        bounds - the bounds for this component