Package org.openstreetmap.josm.gui.util
Class AdjustmentSynchronizer
java.lang.Object
org.openstreetmap.josm.gui.util.AdjustmentSynchronizer
- All Implemented Interfaces:
AdjustmentListener,EventListener
Synchronizes scrollbar adjustments between a set of
Adjustables.
Whenever the adjustment of one of the registered Adjustables is updated
the adjustment of the other registered Adjustables is adjusted too.- Since:
- 6147
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Adjustable,Boolean> private final ChangeNotifierprivate final Set<Adjustable> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadapt(JCheckBox view, Adjustable adjustable) Wires aJCheckBoxto the adjustment synchronizer, in such a way that: state changes in the checkbox control whether the adjustable participates in synchronized adjustment state changes in thisAdjustmentSynchronizerare reflected in theJCheckBoxvoidEvent handler forAdjustmentEventsprotected booleanisParticipatingInSynchronizedScrolling(Adjustable adjustable) Returns true if an adjustable is participating in synchronized scrollingvoidparticipateInSynchronizedScrolling(Adjustable adjustable) Registers anAdjustablefor participation in synchronized scrolling.protected voidsetParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating) Sets whetheradjustableparticipates in adjustment synchronization or not
-
Field Details
-
synchronizedAdjustables
-
enabledMap
-
observable
-
-
Constructor Details
-
AdjustmentSynchronizer
public AdjustmentSynchronizer()Constructs a newAdjustmentSynchronizer
-
-
Method Details
-
participateInSynchronizedScrolling
Registers anAdjustablefor participation in synchronized scrolling.- Parameters:
adjustable- the adjustable
-
adjustmentValueChanged
Event handler forAdjustmentEvents- Specified by:
adjustmentValueChangedin interfaceAdjustmentListener
-
setParticipatingInSynchronizedScrolling
protected void setParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating) Sets whetheradjustableparticipates in adjustment synchronization or not- Parameters:
adjustable- the adjustableisParticipating-trueifadjustableparticipates in adjustment synchronization
-
isParticipatingInSynchronizedScrolling
Returns true if an adjustable is participating in synchronized scrolling- Parameters:
adjustable- the adjustable- Returns:
- true, if the adjustable is participating in synchronized scrolling, false otherwise
- Throws:
IllegalStateException- if adjustable is not registered for synchronized scrolling
-
adapt
Wires aJCheckBoxto 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
AdjustmentSynchronizerare reflected in theJCheckBox
- Parameters:
view- the checkbox to control whether an adjustable participates in synchronized adjustmentadjustable- the adjustable- Throws:
IllegalArgumentException- if view is nullIllegalArgumentException- if adjustable is null
-