예제 #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);
     }
   }
 }
예제 #3
0
 @Override
 public void setEnabled(boolean enabled) {
   if (model != null) {
     if (enabled != model.isEnabled() && model.hasValidBounds()) {
       model.setEnabled(enabled);
       fireTimelineModelEvent(
           new TimelineModelEvent(TimelineModelEvent.EventType.ENABLED, model, enabled));
     }
     if (!enabled) {
       // Disable filtering
       dynamicController.setVisibleInterval(new TimeInterval());
     }
   }
 }