Class PreviewPainter

  • Direct Known Subclasses:
    DefaultPreviewPainter

    public abstract class PreviewPainter
    extends Object
    Base class for component preview painters.
    • Constructor Detail

      • PreviewPainter

        public PreviewPainter()
    • Method Detail

      • previewComponent

        public void previewComponent​(Container parent,
                                     Component component,
                                     int componentIndex,
                                     Graphics g,
                                     int x,
                                     int y,
                                     int w,
                                     int h)
        Draws a component preview on the specified graphics.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        g - Graphics context.
        x - X coordinate of the preview area.
        y - Y coordinate of the preview area.
        w - Width of the preview area.
        h - Height of the preview area.
      • hasPreview

        public boolean hasPreview​(Container parent,
                                  Component component,
                                  int componentIndex)
        Checks whether the specified component is previewable.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        true if the specified component is previewable, false otherwise.
      • hasPreviewWindow

        public boolean hasPreviewWindow​(Container parent,
                                        Component component,
                                        int componentIndex)
        Checks whether the specified component has a preview window.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        true if the specified component has a preview window, false otherwise.
      • getPreviewWindowDimension

        public Dimension getPreviewWindowDimension​(Container parent,
                                                   Component component,
                                                   int componentIndex)
        Returns the dimension for the component preview window.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        Dimension of the component preview window.
      • getPreviewWindowExtraDelay

        public int getPreviewWindowExtraDelay​(Container parent,
                                              Component component,
                                              int componentIndex)
        Returns extra delay (in milliseconds) for showing the component preview window. The base delay is 2000 milliseconds (2 seconds). This function must return a non-negative value. Note that this method may not be called in some preview scenarios (that require immediate preview functionality).
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        Non-negative extra delay (in milliseconds) for showing the component preview window.
      • toUpdatePeriodically

        public boolean toUpdatePeriodically​(Container parent,
                                            Component component,
                                            int componentIndex)
        Returns indication whether the thumbnail preview should be updated periodically. If the return value is true, then the implementation of getUpdateCycle(Container, Component, int) returns the refresh cycle length in milliseconds.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        true if the thumbnail preview of the specified component should be updated periodically, false otherwise.
      • getUpdateCycle

        public int getUpdateCycle​(Container parent,
                                  Component component,
                                  int componentIndex)
        If the result of toUpdatePeriodically(Container, Component, int) is true, returns the update cycle length in milliseconds.
        Parameters:
        parent - Component parent. May be null.
        component - Component. May be null.
        componentIndex - Component index in its parent. May be negative.
        Returns:
        Update cycle length in milliseconds for the thumbnail preview of the specified component.