Class PreviewPainter
- java.lang.Object
-
- org.pushingpixels.radiance.theming.api.painter.preview.PreviewPainter
-
- Direct Known Subclasses:
DefaultPreviewPainter
public abstract class PreviewPainter extends java.lang.Object
Base class for component preview painters.
-
-
Constructor Summary
Constructors Constructor Description PreviewPainter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Dimension
getPreviewWindowDimension(java.awt.Container parent, java.awt.Component component, int componentIndex)
Returns the dimension for the component preview window.int
getPreviewWindowExtraDelay(java.awt.Container parent, java.awt.Component component, int componentIndex)
Returns extra delay (in milliseconds) for showing the component preview window.int
getUpdateCycle(java.awt.Container parent, java.awt.Component component, int componentIndex)
If the result oftoUpdatePeriodically(Container, Component, int)
istrue
, returns the update cycle length in milliseconds.boolean
hasPreview(java.awt.Container parent, java.awt.Component component, int componentIndex)
Checks whether the specified component is previewable.boolean
hasPreviewWindow(java.awt.Container parent, java.awt.Component component, int componentIndex)
Checks whether the specified component has a preview window.void
previewComponent(java.awt.Container parent, java.awt.Component component, int componentIndex, java.awt.Graphics g, int x, int y, int w, int h)
Draws a component preview on the specified graphics.boolean
toUpdatePeriodically(java.awt.Container parent, java.awt.Component component, int componentIndex)
Returns indication whether the thumbnail preview should be updated periodically.
-
-
-
Method Detail
-
previewComponent
public void previewComponent(java.awt.Container parent, java.awt.Component component, int componentIndex, java.awt.Graphics g, int x, int y, int w, int h)
Draws a component preview on the specified graphics.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.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(java.awt.Container parent, java.awt.Component component, int componentIndex)
Checks whether the specified component is previewable.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.componentIndex
- Component index in its parent. May be negative.- Returns:
true
if the specified component is previewable,false
otherwise.
-
hasPreviewWindow
public boolean hasPreviewWindow(java.awt.Container parent, java.awt.Component component, int componentIndex)
Checks whether the specified component has a preview window.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.componentIndex
- Component index in its parent. May be negative.- Returns:
true
if the specified component has a preview window,false
otherwise.
-
getPreviewWindowDimension
public java.awt.Dimension getPreviewWindowDimension(java.awt.Container parent, java.awt.Component component, int componentIndex)
Returns the dimension for the component preview window.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.componentIndex
- Component index in its parent. May be negative.- Returns:
- Dimension of the component preview window.
-
getPreviewWindowExtraDelay
public int getPreviewWindowExtraDelay(java.awt.Container parent, java.awt.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 benull
.component
- Component. May benull
.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(java.awt.Container parent, java.awt.Component component, int componentIndex)
Returns indication whether the thumbnail preview should be updated periodically. If the return value istrue
, then the implementation ofgetUpdateCycle(Container, Component, int)
returns the refresh cycle length in milliseconds.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.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(java.awt.Container parent, java.awt.Component component, int componentIndex)
If the result oftoUpdatePeriodically(Container, Component, int)
istrue
, returns the update cycle length in milliseconds.- Parameters:
parent
- Component parent. May benull
.component
- Component. May benull
.componentIndex
- Component index in its parent. May be negative.- Returns:
- Update cycle length in milliseconds for the thumbnail preview of the specified component.
-
-