Esempio n. 1
0
  /////////////////////////////////////////////////////////////
  // constructor
  ////////////////////////////////////////////////////////////
  public StepControl(final ToolParent parent) {

    // sort out the small & large time steps
    initialiseTimeStepSizes();

    _listeners = new Vector<StepperListener>(0, 1);
    _participants = new Hashtable<Object, somePeriod>();

    /** the timer-related settings */
    _theTimer = new MWC.Utilities.Timer.Timer();
    _theTimer.stop();
    setAutoStep(1000);
    _theTimer.addTimerListener(this);

    _goingForward = true;
    _largeSteps = true;

    // create our default highlighter
    _defaultHighlighter =
        new Debrief.GUI.Tote.Painters.Highlighters.PlotHighlighter.RectangleHighlight();

    if (_myHighlighters == null) {
      _myHighlighters = new Vector<PlotHighlighter>(0, 1);
      _myHighlighters.add(_defaultHighlighter);
      _myHighlighters.add(new Debrief.GUI.Tote.Painters.Highlighters.RangeHighlighter());
      _myHighlighters.add(new Debrief.GUI.Tote.Painters.Highlighters.SymbolHighlighter());
    }

    _currentHighlighter = _myHighlighters.elementAt(0);

    // initialise the date format
    _dateFormatter =
        new java.text.SimpleDateFormat(MWC.Utilities.TextFormatting.FormatRNDateTime.getExample());
    _dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
  }
Esempio n. 2
0
  // timer listener event
  public final void onTime(final java.awt.event.ActionEvent event) {
    // temporarily remove ourselves, to prevent being called twice
    _theTimer.removeTimerListener(this);

    // catch any exceptions raised here, it doesn't really
    // matter if we miss a time step
    try {

      // pass the step operation on to our parent
      doStep(_goingForward, _largeSteps);

    } catch (final Exception e) {
      MWC.Utilities.Errors.Trace.trace(e);
    }

    // register ourselves as a time again
    _theTimer.addTimerListener(this);
  }
Esempio n. 3
0
 protected final void stopTimer() {
   _theTimer.stop();
 }
Esempio n. 4
0
 protected final void startTimer() {
   _theTimer.start();
 }
Esempio n. 5
0
 /**
  * get the real-time interval on the timer, the value is in millis
  *
  * @return time interval in milliseconds
  */
 public final int getAutoStep() {
   return (int) _theTimer.getDelay();
 }
Esempio n. 6
0
 /**
  * set the real-time interval on the timer, the value is in millis
  *
  * @param val time interval in milliseconds
  */
 public final void setAutoStep(final int val) {
   _theTimer.setDelay(val);
 }