org.openstreetmap.josm.gui.conflict.pair
Class ListMerger.AdjustmentSynchronizer

java.lang.Object
  extended by org.openstreetmap.josm.gui.conflict.pair.ListMerger.AdjustmentSynchronizer
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.util.EventListener
Enclosing class:
ListMerger<T extends PrimitiveId>

 class ListMerger.AdjustmentSynchronizer
extends java.lang.Object
implements java.awt.event.AdjustmentListener

Synchronizes scrollbar adjustments between a set of Adjustables. Whenever the adjustment of one of the registerd Adjustables is updated the adjustment of the other registered Adjustables is adjusted too.


Field Summary
private  java.util.HashMap<java.awt.Adjustable,java.lang.Boolean> enabledMap
           
private  java.util.Observable observable
           
private  java.util.ArrayList<java.awt.Adjustable> synchronizedAdjustables
           
 
Constructor Summary
ListMerger.AdjustmentSynchronizer()
           
 
Method Summary
protected  void adapt(javax.swing.JCheckBox view, java.awt.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 ListMerger.AdjustmentSynchronizer are reflected in the JCheckBox
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          event handler for AdjustmentEvents
protected  boolean isParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable)
          returns true if an adjustable is participating in synchronized scrolling
 void participateInSynchronizedScrolling(java.awt.Adjustable adjustable)
          registers an Adjustable for participation in synchronized scrolling.
protected  void setParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable, boolean isParticipating)
          sets whether adjustable participates in adjustment synchronization or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

synchronizedAdjustables

private final java.util.ArrayList<java.awt.Adjustable> synchronizedAdjustables

enabledMap

private final java.util.HashMap<java.awt.Adjustable,java.lang.Boolean> enabledMap

observable

private final java.util.Observable observable
Constructor Detail

ListMerger.AdjustmentSynchronizer

public ListMerger.AdjustmentSynchronizer()
Method Detail

participateInSynchronizedScrolling

public void participateInSynchronizedScrolling(java.awt.Adjustable adjustable)
registers an Adjustable for participation in synchronized scrolling.

Parameters:
adjustable - the adjustable

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
event handler for AdjustmentEvents

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

setParticipatingInSynchronizedScrolling

protected void setParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable,
                                                       boolean isParticipating)
sets whether adjustable participates in adjustment synchronization or not

Parameters:
adjustable - the adjustable

isParticipatingInSynchronizedScrolling

protected boolean isParticipatingInSynchronizedScrolling(java.awt.Adjustable adjustable)
                                                  throws java.lang.IllegalStateException
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:
java.lang.IllegalStateException - thrown, if adjustable is not registered for synchronized scrolling

adapt

protected void adapt(javax.swing.JCheckBox view,
                     java.awt.Adjustable adjustable)
              throws java.lang.IllegalStateException
wires a JCheckBox to the adjustment synchronizer, in such a way that:
    1. state changes in the checkbox control whether the adjustable participates in synchronized adjustment
      state changes in this ListMerger.AdjustmentSynchronizer are reflected in the JCheckBox
  • Parameters:
    view - the checkbox to control whether an adjustable participates in synchronized adjustment
    adjustable - the adjustable
    Throws:
    java.lang.IllegalArgumentException - thrown, if view is null
    java.lang.IllegalArgumentException - thrown, if adjustable is null
    java.lang.IllegalStateException


    JOSM