FileDocCategorySizeDatePackage
FollowerRangeModel.javaAPI DocExample2318Tue Dec 12 18:59:14 GMT 2000None

FollowerRangeModel

public class FollowerRangeModel extends ConverterRangeModel implements ChangeListener

Fields Summary
ConverterRangeModel
dataModel
Constructors Summary
public FollowerRangeModel(ConverterRangeModel dataModel)

        this.dataModel = dataModel;
        dataModel.addChangeListener(this);
    
Methods Summary
public doublegetDoubleValue()

        return dataModel.getDoubleValue()
               * dataModel.getMultiplier()
               / multiplier;
    
public intgetExtent()

        return super.getExtent();
    
public intgetMaximum()

        int modelMax = dataModel.getMaximum();
        double multiplyBy = dataModel.getMultiplier()/multiplier;
        if (DEBUG) {
            System.out.println("In FollowerRangeModel getMaximum");
            System.out.println("  dataModel.getMaximum = " + modelMax
                                + "; multiply by " + multiplyBy
                                + "; result: " + modelMax*multiplyBy);
        }
        return (int)(modelMax * multiplyBy);
    
public intgetValue()

        return (int)getDoubleValue();
    
public voidsetDoubleValue(double newValue)

        dataModel.setDoubleValue(
                     newValue * multiplier
                     / dataModel.getMultiplier());
    
public voidsetExtent(int newExtent)

        super.setExtent(newExtent);
    
public voidsetMaximum(int newMaximum)

        dataModel.setMaximum((int)(newMaximum * 
                     (multiplier/dataModel.getMultiplier())));
    
public voidsetRangeProperties(int value, int extent, int min, int max, boolean adjusting)

        double multiplyBy = multiplier/dataModel.getMultiplier();
        dataModel.setRangeProperties(value*multiplyBy,
                                     extent, min, 
                                     (int)(max*multiplyBy),
                                     adjusting);
    
public voidsetValue(int newValue)

        setDoubleValue((double)newValue);
    
public voidstateChanged(javax.swing.event.ChangeEvent e)

        fireStateChanged();