Package elki.visualization.batikutil
Class LazyCanvasResizer
- java.lang.Object
-
- java.awt.event.ComponentAdapter
-
- elki.visualization.batikutil.LazyCanvasResizer
-
- All Implemented Interfaces:
java.awt.event.ComponentListener,java.util.EventListener
public abstract class LazyCanvasResizer extends java.awt.event.ComponentAdapterClass to lazily process canvas resize events by applying a threshold.- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) doubleactiveRatioLast ratio of the Canvas applied(package private) java.awt.ComponentcomponentComponent the ratio applies to.static doubleDEFAULT_THRESHOLDDefault threshold for resizing.(package private) doublethresholdActive threshold
-
Constructor Summary
Constructors Constructor Description LazyCanvasResizer(java.awt.Component component)Simplified constructor using the default thresholdDEFAULT_THRESHOLDLazyCanvasResizer(java.awt.Component component, double threshold)Full constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcomponentResized(java.awt.event.ComponentEvent e)React to a component resize event.abstract voidexecuteResize(double newratio)Callback function that needs to be overridden with actual implementations.doublegetActiveRatio()Get the components last applied ratio.doublegetCurrentRatio()Get the components current ratio.
-
-
-
Field Detail
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLD
Default threshold for resizing.- See Also:
- Constant Field Values
-
threshold
double threshold
Active threshold
-
activeRatio
double activeRatio
Last ratio of the Canvas applied
-
component
java.awt.Component component
Component the ratio applies to.
-
-
Constructor Detail
-
LazyCanvasResizer
public LazyCanvasResizer(java.awt.Component component, double threshold)Full constructor.- Parameters:
component- Component to trackthreshold- Threshold
-
LazyCanvasResizer
public LazyCanvasResizer(java.awt.Component component)
Simplified constructor using the default thresholdDEFAULT_THRESHOLD- Parameters:
component- Component to track.
-
-
Method Detail
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
React to a component resize event.- Specified by:
componentResizedin interfacejava.awt.event.ComponentListener- Overrides:
componentResizedin classjava.awt.event.ComponentAdapter
-
getCurrentRatio
public final double getCurrentRatio()
Get the components current ratio.- Returns:
- Current ratio.
-
executeResize
public abstract void executeResize(double newratio)
Callback function that needs to be overridden with actual implementations.- Parameters:
newratio- New ratio to apply.
-
getActiveRatio
public double getActiveRatio()
Get the components last applied ratio.- Returns:
- Last applied ratio.
-
-