Package org.pushingpixels.trident

Examples of org.pushingpixels.trident.Timeline$Chain


            if (!selectedIndices.containsKey(i)) {
              // start fading in
              // System.out.println("Fade in on index " + i);

              if (!fadeCanceled) {
                Timeline selectionTimeline = selectionTimelineTracker
                    .getTimeline(
                        i,
                        new TimelineTracker.TimelineCreator() {
                          @Override
                          public Timeline create() {
                            Timeline result = createSingleRowSelectionTimeline(rowIndex);
                            return result;
                          }
                        });
                selectionTimeline.play();
                initiatedTimelines.put(selectionTimeline,
                    rowIndex);
                if (initiatedTimelines.size() > 25) {
                  for (Map.Entry<Timeline, Integer> entry : initiatedTimelines
                      .entrySet()) {
                    entry.getKey().cancel();
                    int rIndex = entry.getValue();
                    selectedIndices.put(rIndex, list
                        .getModel()
                        .getElementAt(rIndex));
                  }
                  initiatedTimelines.clear();
                  fadeCanceled = true;
                }
              } else {
                selectedIndices.put(i, list.getModel()
                    .getElementAt(i));
              }
            }
          } else {
            // check if was selected before and still points to the
            // same element
            Timeline existing = selectionTimelineTracker
                .getTimeline(i, null);
            if (existing != null) {
              if (!fadeCanceled) {
                existing.playReverse();
                initiatedTimelines.put(existing, rowIndex);
                if (initiatedTimelines.size() > 25) {
                  for (Map.Entry<Timeline, Integer> entry : initiatedTimelines
                      .entrySet()) {
                    entry.getKey().cancel();
                    int rIndex = entry.getValue();
                    selectedIndices.remove(rIndex);
                  }
                  initiatedTimelines.clear();
                  fadeCanceled = true;
                }
              } else {
                selectedIndices.remove(i);
              }
            } else {
              if (selectedIndices.containsKey(i)) {
                if (selectedIndices.get(i) == list.getModel()
                    .getElementAt(i)) {
                  // start fading out
                  // System.out
                  // .println("Fade out on index " + i);

                  if (!fadeCanceled) {
                    Timeline selectionTimeline = selectionTimelineTracker
                        .getTimeline(
                            i,
                            new TimelineTracker.TimelineCreator() {
                              @Override
                              public Timeline create() {
                                Timeline result = createSingleRowSelectionTimeline(rowIndex);
                                return result;
                              }
                            });
                    selectionTimeline.playReverse();
View Full Code Here


    // if the renderer is disabled, do not show any highlights
    float totalAlpha = endAlpha;
    float fadeCoef = 0.0f;
    if (rendererComponent.isEnabled()) {
      Timeline runningRowTimeline = getRunningTimeline(row);
      if (runningRowTimeline != null) {
        fadeCoef = runningRowTimeline.getTimelinePosition();

        // compute the total alpha of the overlays.
        if (runningRowTimeline.getState() == TimelineState.PLAYING_FORWARD) {
          totalAlpha = startAlpha + (endAlpha - startAlpha)
              * fadeCoef;
          fadeCoef = 1.0f - fadeCoef;
        } else {
          totalAlpha = startAlpha + (endAlpha - startAlpha)
View Full Code Here

        ch, true);
    g2d.dispose();
  }

  public Timeline getRunningTimeline(int row) {
    Timeline runningRowTimeline = selectionTimelineTracker
        .getPlayingTimeline(row);
    if (runningRowTimeline == null) {
      runningRowTimeline = rolloverTimelineTracker
          .getPlayingTimeline(row);
    }
View Full Code Here

   *            Cell index.
   * @return The previous state for the specified cell.
   */
  public ComponentState getPrevCellState(int cellIndex,
      Component rendererComponent) {
    Timeline rolloverTimeline = rolloverTimelineTracker
        .getPlayingTimeline(cellIndex);
    Timeline selectionTimeline = selectionTimelineTracker
        .getPlayingTimeline(cellIndex);

    boolean wasRollover = false;
    if (rolloverTimeline != null) {
      wasRollover = (rolloverTimeline.getState() == TimelineState.PLAYING_REVERSE);
    } else {
      wasRollover = (rolledOverIndex >= 0)
          && (rolledOverIndex == cellIndex);
    }
    boolean wasSelected = this.selectedIndices.containsKey(cellIndex);
    if (selectionTimeline != null) {
      wasSelected = (selectionTimeline.getState() == TimelineState.PLAYING_REVERSE);
    }

    boolean isEnabled = this.list.isEnabled();
    if (rendererComponent != null) {
      isEnabled = isEnabled && rendererComponent.isEnabled();
View Full Code Here

  private void fadeOutRolloverIndication() {
    if (rolledOverIndex < 0)
      return;

    final int toFadeOut = rolledOverIndex;
    Timeline rolloverTimeline = rolloverTimelineTracker.getTimeline(
        toFadeOut, new TimelineTracker.TimelineCreator() {
          @Override
          public Timeline create() {
            Timeline result = createSingleRowRolloverTimeline(toFadeOut);
            return result;
          }
        });
    rolloverTimeline.playReverse();
  }
View Full Code Here

      return updateInfo.getHighlightColorScheme(state);
    return null;
  }

  private Timeline createSingleRowSelectionTimeline(final int rowIndex) {
    Timeline result = new Timeline(list);
    result.addCallback(new TridentCellRepaintCallback(list, rowIndex));
    AnimationConfigurationManager.getInstance().configureTimeline(result);

    result.addCallback(new TimelineCallbackAdapter() {
      @Override
      public void onTimelineStateChanged(TimelineState oldState,
          TimelineState newState, float durationFraction,
          float timelinePosition) {
        if (newState == TimelineState.PLAYING_FORWARD) {
View Full Code Here

    return result;
  }

  private Timeline createSingleRowRolloverTimeline(final int rowIndex) {
    Timeline result = new Timeline(list);
    result.addCallback(new TridentCellRepaintCallback(list, rowIndex));
    AnimationConfigurationManager.getInstance().configureTimeline(result);

    result.addCallback(new TimelineCallbackAdapter() {
      @Override
      public void onTimelineStateChanged(TimelineState oldState,
          TimelineState newState, float durationFraction,
          float timelinePosition) {
        if (newState == TimelineState.PLAYING_FORWARD) {
View Full Code Here

          return;

        fadeOutRolloverIndication();

        final int newRolloverIndex = roIndex;
        Timeline rolloverTimeline = rolloverTimelineTracker
            .getTimeline(newRolloverIndex,
                new TimelineTracker.TimelineCreator() {
                  @Override
                  public Timeline create() {
                    Timeline result = createSingleRowRolloverTimeline(newRolloverIndex);
                    return result;
                  }
                });
        rolloverTimeline.play();
        // System.out.println("Setting RO index to " + roIndex);
View Full Code Here

              : (currValue - displayedValue) * totalPixels / span;

          if (displayTimeline != null) {
            displayTimeline.abort();
          }
          displayTimeline = new Timeline(progressBar);
          displayTimeline.addPropertyToInterpolate(Timeline
              .<Integer> property("displayedValue").from(
                  displayedValue).to(currValue).setWith(
                  new PropertySetter<Integer>() {
                    @Override
View Full Code Here

        // PENDING JW: how-to find the resource of this action for injection?
        @Action
        public void race() {
            if (raceTimeline == null) {
                raceTimeline = new Timeline(this);
                raceTimeline.addPropertyToInterpolate("currentMerit", 0, 100);
            }
            raceTimeline.replay();
        }
View Full Code Here

TOP

Related Classes of org.pushingpixels.trident.Timeline$Chain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.