Package org.pushingpixels.substance.internal.animation

Examples of org.pushingpixels.substance.internal.animation.StateTransitionTracker$StateContributionInfo


            if ((currSelectedIndex >= 0)
                && (currSelectedIndex < SubstanceTabbedPaneUI.this.tabPane
                    .getTabCount())
                && SubstanceTabbedPaneUI.this.tabPane
                    .isEnabledAt(currSelectedIndex)) {
              StateTransitionTracker tracker = getTracker(
                  currSelectedIndex,
                  getRolloverTabIndex() == currSelectedIndex,
                  true);
              tracker.getModel().setSelected(false);
            }
            currSelectedIndex = selected;
            if ((selected >= 0)
                && (selected < SubstanceTabbedPaneUI.this.tabPane
                    .getTabCount())
                && SubstanceTabbedPaneUI.this.tabPane
                    .isEnabledAt(selected)) {
              StateTransitionTracker tracker = getTracker(
                  selected,
                  getRolloverTabIndex() == selected, false);
              tracker.getModel().setSelected(true);
            }
          }
        });
      }
    };
View Full Code Here


    graphics.clip(new Rectangle(x, y, w, h));

    boolean isRollover = (this.getRolloverTab() == tabIndex);

    float finalAlpha = 0.5f;
    StateTransitionTracker tabTracker = this.stateTransitionMultiTracker
        .getTracker(tabIndex);
    if (modelStateInfo != null) {
      finalAlpha += 0.5f * tabTracker
          .getFacetStrength(ComponentStateFacet.ROLLOVER);
    } else {
      ComponentState tabState = getTabState(tabIndex);
      if (tabState.isFacetActive(ComponentStateFacet.ROLLOVER)
          || tabState.isFacetActive(ComponentStateFacet.SELECTION)) {
        finalAlpha = 1.0f;
      }
    }

    finalAlpha *= SubstanceColorSchemeUtilities.getAlpha(this.tabPane
        .getComponentAt(tabIndex), currState);

    graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
        this.tabPane, finalAlpha, g));
    graphics.drawImage(fullOpacity, x, y, null);

    // Check if requested to paint close buttons.
    if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex)
        && isEnabled) {

      float alpha = (isSelected || isRollover) ? 1.0f : 0.0f;
      if (!isSelected) {
        if (tabTracker != null) {
          alpha = tabTracker
              .getFacetStrength(ComponentStateFacet.ROLLOVER);
        }
      }
      if (alpha > 0.0) {
        graphics.setComposite(LafWidgetUtilities.getAlphaComposite(
View Full Code Here

  protected StateTransitionTracker.ModelStateInfo getModelStateInfo(
      int tabIndex) {
    if (this.stateTransitionMultiTracker.size() == 0)
      return null;
    StateTransitionTracker tracker = this.stateTransitionMultiTracker
        .getTracker(tabIndex);
    if (tracker == null) {
      return null;
    } else {
      return tracker.getModelStateInfo();
    }
  }
View Full Code Here

   *            Tab index.
   * @return The current state for the specified tab.
   */
  protected ComponentState getTabState(int tabIndex) {
    boolean isEnabled = this.tabPane.isEnabledAt(tabIndex);
    StateTransitionTracker tracker = this.stateTransitionMultiTracker
        .getTracker(tabIndex);
    if (tracker == null) {
      boolean isRollover = this.getRolloverTabIndex() == tabIndex;
      boolean isSelected = this.tabPane.getSelectedIndex() == tabIndex;
      return ComponentState.getState(isEnabled, isRollover, isSelected);
    } else {
      ComponentState fromTracker = tracker.getModelStateInfo()
          .getCurrModelState();
      return ComponentState.getState(isEnabled, fromTracker
          .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker
          .isFacetActive(ComponentStateFacet.SELECTION));
    }
View Full Code Here

    if (icon == null)
      return;

    if (SubstanceCoreUtilities.useThemedDefaultIcon(this.tabPane)) {
      ComponentState currState = this.getTabState(tabIndex);
      StateTransitionTracker tabTracker = stateTransitionMultiTracker
          .getTracker(tabIndex);

      if (tabTracker == null) {
        if (currState.isFacetActive(ComponentStateFacet.ROLLOVER)
            || currState
                .isFacetActive(ComponentStateFacet.SELECTION)
            || currState.isDisabled()) {
          // use the original (full color or disabled) icon
          super.paintIcon(g, tabPlacement, tabIndex, icon, iconRect,
              isSelected);
          return;
        }
      }

      Icon themed = SubstanceCoreUtilities.getThemedIcon(this.tabPane,
          tabIndex, icon);
      if (tabTracker == null) {
        super.paintIcon(g, tabPlacement, tabIndex, themed, iconRect,
            isSelected);
      } else {
        Graphics2D g2d = (Graphics2D) g.create();
        super.paintIcon(g2d, tabPlacement, tabIndex, icon, iconRect,
            isSelected);
        g2d
            .setComposite(LafWidgetUtilities
                .getAlphaComposite(
                    this.tabPane,
                    1.0f - tabTracker
                        .getFacetStrength(ComponentStateFacet.ROLLOVER),
                    g2d));
        super.paintIcon(g2d, tabPlacement, tabIndex, themed, iconRect,
            isSelected);
        g2d.dispose();
View Full Code Here

    SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
    return new SubstanceMenuUI((JMenu) comp);
  }

  public SubstanceMenuUI(JMenu menuItem) {
    this.stateTransitionTracker = new StateTransitionTracker(menuItem,
        menuItem.getModel());
  }
View Full Code Here

    SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
    return new SubstanceMenuItemUI((JMenuItem) comp);
  }

  public SubstanceMenuItemUI(JMenuItem menuItem) {
    this.stateTransitionTracker = new StateTransitionTracker(menuItem,
        menuItem.getModel());
  }
View Full Code Here

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

              if (!fadeCanceled) {
                StateTransitionTracker tracker = getTracker(i,
                    getColumnState(i).isFacetActive(
                        ComponentStateFacet.ROLLOVER),
                    false);
                tracker.getModel().setSelected(true);
                initiatedTrackers.add(tracker);
                if (initiatedTrackers.size() > 15) {
                  stateTransitionMultiTracker.clear();
                  initiatedTrackers.clear();
                  fadeCanceled = true;
                }
              }

              selectedIndices.put(i, columnModel.getColumn(i));
            }
          } else {
            // check if was selected before and still points to the
            // same element
            if (selectedIndices.containsKey(i)) {
              if (selectedIndices.get(i) == columnModel
                  .getColumn(i)) {
                // start fading out
                // System.out.println("Fade out on index " + i);

                if (!fadeCanceled) {
                  StateTransitionTracker tracker = getTracker(
                      i,
                      getColumnState(i)
                          .isFacetActive(
                              ComponentStateFacet.ROLLOVER),
                      true);
                  tracker.getModel().setSelected(false);
                  initiatedTrackers.add(tracker);
                  if (initiatedTrackers.size() > 15) {
                    stateTransitionMultiTracker.clear();
                    initiatedTrackers.clear();
                    fadeCanceled = true;
View Full Code Here

    JTable table = this.header.getTable();
    if (table != null) {
      toEnable = toEnable && table.isEnabled();
    }

    StateTransitionTracker tracker = this.stateTransitionMultiTracker
        .getTracker(columnIndex);
    if (tracker == null) {
      boolean isRollover = false;
      TableColumnModel columnModel = header.getColumnModel();
      boolean isSelected = false;
      if (columnModel.getColumnSelectionAllowed()) {
        isSelected = columnModel.getSelectionModel().isSelectedIndex(
            columnIndex);
        if ((table != null)
            && (table.getUI() instanceof SubstanceTableUI)) {
          SubstanceTableUI tableUI = (SubstanceTableUI) table.getUI();
          int rolledOverIndex = tableUI.getRolloverColumnIndex();
          isRollover = (rolledOverIndex >= 0)
              && (rolledOverIndex == columnIndex);
          boolean hasSelectionAnimations = tableUI
              .hasSelectionAnimations();
          if (hasSelectionAnimations
              && AnimationConfigurationManager.getInstance()
                  .isAnimationAllowed(
                      AnimationFacet.SELECTION, table))
            isSelected = this.selectedIndices
                .containsKey(columnIndex);
        }
      }
      return ComponentState.getState(toEnable, isRollover, isSelected);
    } else {
      ComponentState fromTracker = tracker.getModelStateInfo()
          .getCurrModelState();
      return ComponentState.getState(toEnable, fromTracker
          .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker
          .isFacetActive(ComponentStateFacet.SELECTION));
    }
View Full Code Here

  public StateTransitionTracker.ModelStateInfo getModelStateInfo(
      int columnIndex) {
    if (this.stateTransitionMultiTracker.size() == 0)
      return null;
    StateTransitionTracker tracker = this.stateTransitionMultiTracker
        .getTracker(columnIndex);
    if (tracker == null) {
      return null;
    } else {
      return tracker.getModelStateInfo();
    }
  }
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.internal.animation.StateTransitionTracker$StateContributionInfo

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.