public class AdjustmentSynchronizer extends Object implements AdjustmentListener
Adjustable
s.
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 Set<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
AdjustmentEvent s |
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 Set<Adjustable> synchronizedAdjustables
private final Map<Adjustable,Boolean> enabledMap
private final Observable observable
public AdjustmentSynchronizer()
AdjustmentSynchronizer
public void participateInSynchronizedScrolling(Adjustable adjustable)
Adjustable
for participation in synchronized scrolling.adjustable
- the adjustablepublic void adjustmentValueChanged(AdjustmentEvent e)
AdjustmentEvent
sadjustmentValueChanged
in interface AdjustmentListener
protected void setParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating)
adjustable
participates in adjustment synchronization or notadjustable
- the adjustableisParticipating
- true
if adjustable
participates in adjustment synchronizationprotected boolean isParticipatingInSynchronizedScrolling(Adjustable adjustable)
adjustable
- the adjustableIllegalStateException
- 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
JCheckBox
view
- the checkbox to control whether an adjustable participates in synchronized adjustmentadjustable
- the adjustableIllegalArgumentException
- if view is nullIllegalArgumentException
- if adjustable is null