sonification.dataimport.visbards_resourcetoolkit.model
Class DefaultRangeControllerModel

java.lang.Object
  extended by sonification.dataimport.visbards_resourcetoolkit.model.DefaultRangeControllerModel
All Implemented Interfaces:
RangeControllerModel, SettingsHolder

public class DefaultRangeControllerModel
extends java.lang.Object
implements RangeControllerModel, SettingsHolder


Constructor Summary
DefaultRangeControllerModel()
          constructor
DefaultRangeControllerModel(RangeModel rangeModel)
          constructor
 
Method Summary
 void addRangeControllerListener(RangeControllerListener listener)
          adds a RangeControllerListener to the model's listener list.
 boolean canUnzoom()
          returns true if the selected range can be unzoomed, false otherwise
 boolean canZoom()
          returns true if the the selected range can be zoomed, false otherwise
protected  void fireRangeControllerEvent(RangeControllerEvent evt)
          this helper method fires RangeControllerEvents
 Range getDisplayedRange()
          returns the displayed time range, i.e.
 double getExtent()
          Return the model's extent.
 java.lang.String getHolderID()
          Returns a string which identifies this object uniquely.
 double getMaximum()
          returns the model's maximum.
 double getMinimum()
          returns the model's minimum.
 double getMinimumExtent()
          returns the minimum size of the extent
 Range getOverallRange()
          Returns the overall time range, i.e.
 RangeModel getRangeModel()
          returns the associated range model
 Range getSelectedRange()
          returns the selected time range
 java.util.HashMap getSettings()
          Returns a hashmap of settings (strings) which represent the current object state, and are keyed by string names.
 double getStart()
          returns the start value.
 int getZoomLevel()
          returns the current zoom level.
protected  void init()
          initialize the model
 boolean isStateAdjusting()
          returns true if the change in state is part of a series of changes.
 boolean isUpdatesContinuous()
          returns true if continuous updates or made, false otherwise
protected  boolean isValidRange(Range range)
          returns true if the range is valid, false otherwise
protected  boolean isWithinScope(Range range)
          returns true if the given range is within the current scope, false otherwise
 void removeRangeControllerListener(RangeControllerListener listener)
          removes a RangeControllerListener from the model's listener list.
protected  void resetToDisplayedRange()
          a helper method which resets the values of min, max, start and extent based on the current displayed range
 void setDisplayedRange(Range range)
          set the displayed time range, i.e.
 void setExtent(double extent)
          sets the extent of the model.
 void setExtent(double extent, boolean startFixed)
          sets the model's extent.
 void setMaximum(double max)
          sets the maximum of the model.
 void setMinimum(double min)
          sets the minimum of the model.
 void setMinimumExtent(double min)
          sets the minimum size of the extent
 void setRange(double min, double max, double start, double extent)
          this method sets all of the model's state in a single method call.
 void setRangeModel(RangeModel model)
          set the associated range model
 void setSettings(java.util.HashMap settings)
          Changes the settings of this object to match the settings in the specified hashmap.
 void setStart(double start)
          sets the current start of the model.
 void setStart(double start, boolean extentFixed)
          sets the model's start.
 void setStateAdjusting(boolean adjusting)
          if set to true, this method indicates that any upcoming changes to the state of the RangeModel are meant to be a series of changes.
 void setUpdatesContinuous(boolean continuous)
          indicates whether continuous updates should be made or not, i.e.
 void unzoom()
          unzoom to the previous level, i.e.
protected  void updateSelectedRange()
          a helper method which updates the selected range based on the current values
 void zoom()
          zoom in to the next level, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRangeControllerModel

public DefaultRangeControllerModel(RangeModel rangeModel)
constructor


DefaultRangeControllerModel

public DefaultRangeControllerModel()
constructor

Method Detail

init

protected void init()
initialize the model


getOverallRange

public Range getOverallRange()
Returns the overall time range, i.e. the maximum possible selected range

Specified by:
getOverallRange in interface RangeControllerModel

setDisplayedRange

public void setDisplayedRange(Range range)
set the displayed time range, i.e. the maximum possible selected range within the current display

Specified by:
setDisplayedRange in interface RangeControllerModel

getDisplayedRange

public Range getDisplayedRange()
returns the displayed time range, i.e. the maximum possible selected range within the current scope

Specified by:
getDisplayedRange in interface RangeControllerModel

getSelectedRange

public Range getSelectedRange()
returns the selected time range

Specified by:
getSelectedRange in interface RangeControllerModel

getStart

public double getStart()
returns the start value.

Specified by:
getStart in interface RangeControllerModel

getExtent

public double getExtent()
Return the model's extent.

Specified by:
getExtent in interface RangeControllerModel

getMinimumExtent

public double getMinimumExtent()
returns the minimum size of the extent

Specified by:
getMinimumExtent in interface RangeControllerModel

getMinimum

public double getMinimum()
returns the model's minimum.

Specified by:
getMinimum in interface RangeControllerModel

getMaximum

public double getMaximum()
returns the model's maximum.

Specified by:
getMaximum in interface RangeControllerModel

setStart

public void setStart(double start)
sets the current start of the model.

Specified by:
setStart in interface RangeControllerModel

setStart

public void setStart(double start,
                     boolean extentFixed)
sets the model's start.

Specified by:
setStart in interface RangeControllerModel
Parameters:
start - the new start position
extentFixed - if true the extent stays fixed. Otherwise, the extent is changed relative to the new start

setExtent

public void setExtent(double extent)
sets the extent of the model.

Specified by:
setExtent in interface RangeControllerModel

setExtent

public void setExtent(double extent,
                      boolean startFixed)
sets the model's extent.

Specified by:
setExtent in interface RangeControllerModel
Parameters:
extent - the new extent
startFixed - if true the start stays fixed. Otherwise, the start is changed when an edge condition is reached.

setMinimumExtent

public void setMinimumExtent(double min)
sets the minimum size of the extent

Specified by:
setMinimumExtent in interface RangeControllerModel

setMinimum

public void setMinimum(double min)
sets the minimum of the model.

Specified by:
setMinimum in interface RangeControllerModel

setMaximum

public void setMaximum(double max)
sets the maximum of the model.

Specified by:
setMaximum in interface RangeControllerModel

setRange

public void setRange(double min,
                     double max,
                     double start,
                     double extent)
this method sets all of the model's state in a single method call.

Specified by:
setRange in interface RangeControllerModel

setStateAdjusting

public void setStateAdjusting(boolean adjusting)
if set to true, this method indicates that any upcoming changes to the state of the RangeModel are meant to be a series of changes.

Specified by:
setStateAdjusting in interface RangeControllerModel

isStateAdjusting

public boolean isStateAdjusting()
returns true if the change in state is part of a series of changes. Listeners can check this flag when they receive events if, for performance reasons, they want to wait until the entire update is done before they reflect the changes.

Specified by:
isStateAdjusting in interface RangeControllerModel

setUpdatesContinuous

public void setUpdatesContinuous(boolean continuous)
indicates whether continuous updates should be made or not, i.e. if events should be fired while the user is manipulating the controller

Specified by:
setUpdatesContinuous in interface RangeControllerModel

isUpdatesContinuous

public boolean isUpdatesContinuous()
returns true if continuous updates or made, false otherwise

Specified by:
isUpdatesContinuous in interface RangeControllerModel

zoom

public void zoom()
zoom in to the next level, i.e. make the current scope and selected range equivalent to the current selected range

Specified by:
zoom in interface RangeControllerModel

unzoom

public void unzoom()
unzoom to the previous level, i.e. set the properties to the previous selected range contained within the zoom stack

Specified by:
unzoom in interface RangeControllerModel

canZoom

public boolean canZoom()
returns true if the the selected range can be zoomed, false otherwise

Specified by:
canZoom in interface RangeControllerModel

canUnzoom

public boolean canUnzoom()
returns true if the selected range can be unzoomed, false otherwise

Specified by:
canUnzoom in interface RangeControllerModel

getZoomLevel

public int getZoomLevel()
returns the current zoom level. Note: 0 means the user is not zoomed in

Specified by:
getZoomLevel in interface RangeControllerModel

isWithinScope

protected boolean isWithinScope(Range range)
returns true if the given range is within the current scope, false otherwise


isValidRange

protected boolean isValidRange(Range range)
returns true if the range is valid, false otherwise


updateSelectedRange

protected void updateSelectedRange()
a helper method which updates the selected range based on the current values


resetToDisplayedRange

protected void resetToDisplayedRange()
a helper method which resets the values of min, max, start and extent based on the current displayed range


fireRangeControllerEvent

protected void fireRangeControllerEvent(RangeControllerEvent evt)
this helper method fires RangeControllerEvents


setRangeModel

public void setRangeModel(RangeModel model)
set the associated range model

Specified by:
setRangeModel in interface RangeControllerModel

getRangeModel

public RangeModel getRangeModel()
returns the associated range model

Specified by:
getRangeModel in interface RangeControllerModel

addRangeControllerListener

public void addRangeControllerListener(RangeControllerListener listener)
adds a RangeControllerListener to the model's listener list.

Specified by:
addRangeControllerListener in interface RangeControllerModel

removeRangeControllerListener

public void removeRangeControllerListener(RangeControllerListener listener)
removes a RangeControllerListener from the model's listener list.

Specified by:
removeRangeControllerListener in interface RangeControllerModel

getSettings

public java.util.HashMap getSettings()
Returns a hashmap of settings (strings) which represent the current object state, and are keyed by string names.

Specified by:
getSettings in interface SettingsHolder

setSettings

public void setSettings(java.util.HashMap settings)
Changes the settings of this object to match the settings in the specified hashmap. HashMap may be empty, in which case no settings are delivered

Specified by:
setSettings in interface SettingsHolder

getHolderID

public java.lang.String getHolderID()
Returns a string which identifies this object uniquely. Any string is valid as long as it does not contain the underscore character.

Specified by:
getHolderID in interface SettingsHolder