Package edu.hws.jcm.awt

# Class Tie

java.lang.Object
edu.hws.jcm.awt.Tie

public class Tie extends Object
A Tie associates several Tieable objects. When the check() mehtod of the Tie is called, it determines which of the Tieables has the largest serial number. It then tells each Tieable to synchronize with that object. Ordinarily, the Tie is added to a Controller, which is responsible for calling the Tie's check() method.

This is meant to be used, for example, to Tie together two InputObjects to synchronize the values that they represent. For example, you might want a VariableSlider and a VariableInput to be alternative ways of inputting the same value. If so, you can put them in a Tie and add that Tie to any Controller that is set to respond to changes in the VariableSlider or VariableInput. The x- and y- variables of a MouseTracker are also Tieable objects, so you can synchronize the values of two MouseTrackers (in different CoordinateRects, presumably) and you can synchronize the value of a MouseTracker variable with a VariableInput or VariableSlider.

CoordinateRects and LimitControlPanels are also Tieable (to each other -- not to Value objects). This is used to allow the LimitControlPanel to synchronize with the Limits on the CoordinateRects that it controls. It could also synchronize the Limits on two CoordinateRects, even in the absense of a LimitControlPanel.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected Vector`
`items`
The Tieables in this Tie.

## Constructor Summary

Constructors
Constructor
Description
`Tie()`
Create a Tie, initially containing no objects.
`Tie(Tieable item)`
Create a Tie initally containing only the object item.
`Tie(Tieable item1, Tieable item2)`
Create a Tie initially containing item1 and item2.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Tieable item)`
Add item to the tie, and sync it with the items that are already in the Tie.
`void`
`check()`
If this Tie contains more than one item, find the newest one and sync all the items with that item.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### items

protected Vector items
The Tieables in this Tie.

## Constructor Details

### Tie

public Tie()
Create a Tie, initially containing no objects.

### Tie

public Tie(Tieable item)
Create a Tie initally containing only the object item. item should be non-null.

Parameters:
  `item` - the only initial item in this tieable.

### Tie

public Tie(Tieable item1, Tieable item2)
Create a Tie initially containing item1 and item2. The items should be non-null. The items will be synced with each other at the time the Tie is created.

## Method Details

### add

public void add(Tieable item)
Add item to the tie, and sync it with the items that are already in the Tie. It should be non-null. Note that synchronization of the objects is forced even if they all have the same serial number, since the values might not be the same when they are first added to the Tie.

### check

public void check()
If this Tie contains more than one item, find the newest one and sync all the items with that item. If the serial numbers of all the items are already the same, nothing is done.