Пример #1
0
  @Override
  public void setCustomBounds(double min, double max) {
    if (model != null) {
      if (model.getCustomMin() != min || model.getCustomMax() != max) {
        if (min >= max) {
          throw new IllegalArgumentException("min should be less than max");
        }
        if (min < model.getMin() || max > model.getMax()) {
          throw new IllegalArgumentException("Min and max should be in the bounds");
        }

        // Interval
        if (model.getIntervalStart() < min || model.getIntervalEnd() > max) {
          dynamicController.setVisibleInterval(min, max);
        }

        // Custom bounds
        double[] val = new double[] {min, max};
        model.setCustomMin(min);
        model.setCustomMax(max);
        fireTimelineModelEvent(
            new TimelineModelEvent(TimelineModelEvent.EventType.CUSTOM_BOUNDS, model, val));
      }
    }
  }
Пример #2
0
 @Override
 public void setInterval(double from, double to) {
   if (model != null) {
     if (model.getIntervalStart() != from || model.getIntervalEnd() != to) {
       if (from >= to) {
         throw new IllegalArgumentException("from should be less than to");
       }
       if (from < model.getCustomMin() || to > model.getCustomMax()) {
         throw new IllegalArgumentException("From and to should be in the bounds");
       }
       dynamicController.setVisibleInterval(from, to);
     }
   }
 }