public class AdjustmentSynchronizer extends Object implements AdjustmentListener
Adjustables.
Whenever the adjustment of one of the registered Adjustables is updated
the adjustment of the other registered Adjustables is adjusted too.| Modifier and Type | Field and Description |
|---|---|
private Map<Adjustable,Boolean> |
enabledMap |
private Observable |
observable |
private List<Adjustable> |
synchronizedAdjustables |
| Constructor and Description |
|---|
AdjustmentSynchronizer()
Constructs a new
AdjustmentSynchronizer |
| Modifier and Type | Method and Description |
|---|---|
void |
adapt(JCheckBox view,
Adjustable adjustable)
Wires a
JCheckBox to the adjustment synchronizer, in such a way that:
state changes in the checkbox control whether the adjustable participates
in synchronized adjustment
state changes in this AdjustmentSynchronizer are reflected in the
JCheckBox
|
void |
adjustmentValueChanged(AdjustmentEvent e)
Event handler for
AdjustmentEvents |
protected boolean |
isParticipatingInSynchronizedScrolling(Adjustable adjustable)
Returns true if an adjustable is participating in synchronized scrolling
|
void |
participateInSynchronizedScrolling(Adjustable adjustable)
Registers an
Adjustable for participation in synchronized scrolling. |
protected void |
setParticipatingInSynchronizedScrolling(Adjustable adjustable,
boolean isParticipating)
Sets whether adjustable participates in adjustment synchronization or not
|
private final List<Adjustable> synchronizedAdjustables
private final Map<Adjustable,Boolean> enabledMap
private final Observable observable
public AdjustmentSynchronizer()
AdjustmentSynchronizerpublic void participateInSynchronizedScrolling(Adjustable adjustable)
Adjustable for participation in synchronized scrolling.adjustable - the adjustablepublic void adjustmentValueChanged(AdjustmentEvent e)
AdjustmentEventsadjustmentValueChanged in interface AdjustmentListenerprotected void setParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating)
adjustable - the adjustableprotected boolean isParticipatingInSynchronizedScrolling(Adjustable adjustable) throws IllegalStateException
adjustable - the adjustableIllegalStateException - thrown, if adjustable is not registered for synchronized scrollingpublic void adapt(JCheckBox view, Adjustable adjustable)
JCheckBox to the adjustment synchronizer, in such a way that:
AdjustmentSynchronizer are reflected in the
JCheckBoxview - the checkbox to control whether an adjustable participates in synchronized adjustmentadjustable - the adjustableIllegalArgumentException - thrown, if view is nullIllegalArgumentException - thrown, if adjustable is null