Package org.eclipse.ui.forms.widgets
Class LayoutCache
java.lang.Object
org.eclipse.ui.forms.widgets.LayoutCache
Caches the preferred sizes of an array of controls
- Since:
- 3.0
-
Constructor Summary
ConstructorDescriptionCreates an empty layout cacheLayoutCache
(Control[] controls) Creates a cache for the given array of controls -
Method Summary
Modifier and TypeMethodDescriptioncomputeSize
(int controlIndex, int widthHint, int heightHint) Computes the preferred size of the nth controlvoid
flush()
Flushes the cache.void
flush
(int controlIndex) Flushes the cache for the given control.getCache
(int idx) Returns the size cache for the given controlvoid
setControls
(Control[] controls) Sets the controls that are being cached here.
-
Constructor Details
-
LayoutCache
public LayoutCache()Creates an empty layout cache -
LayoutCache
Creates a cache for the given array of controls- Parameters:
controls
- controls to cache
-
-
Method Details
-
getCache
Returns the size cache for the given control- Parameters:
idx
- control's index- Returns:
- the size cache for the given control
-
setControls
Sets the controls that are being cached here. If these are the same controls that were used last time, this method does nothing. Otherwise, the cache is flushed and a new cache is created for the new controls.- Parameters:
controls
- new controls to cache
-
computeSize
Computes the preferred size of the nth control- Parameters:
controlIndex
- index of the control whose size will be computedwidthHint
- width of the control (or SWT.DEFAULT if unknown)heightHint
- height of the control (or SWT.DEFAULT if unknown)- Returns:
- the preferred size of the control
-
flush
public void flush(int controlIndex) Flushes the cache for the given control. This should be called if exactly one of the controls has changed but the remaining controls remain unmodified- Parameters:
controlIndex
- index of control to flush
-
flush
public void flush()Flushes the cache.
-