Search in sources :

Example 6 with Transition

use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.

the class TerraMenuPopupSkin method previewMenuPopupClose.

@Override
public Vote previewMenuPopupClose(final MenuPopup menuPopup, boolean immediate) {
    if (!immediate && closeTransition == null) {
        border.setEnabled(false);
        closeTransition = new FadeWindowTransition(menuPopup, closeTransitionDuration, closeTransitionRate, dropShadowDecorator);
        closeTransition.start(new TransitionListener() {

            @Override
            public void transitionCompleted(Transition transition) {
                menuPopup.close();
            }
        });
    }
    return (closeTransition != null && closeTransition.isRunning()) ? Vote.DEFER : Vote.APPROVE;
}
Also used : Transition(org.apache.pivot.wtk.effects.Transition) TransitionListener(org.apache.pivot.wtk.effects.TransitionListener)

Example 7 with Transition

use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.

the class TerraSuggestionPopupSkin method previewSuggestionPopupClose.

@Override
public Vote previewSuggestionPopupClose(final SuggestionPopup suggestionPopup, final boolean result) {
    if (closeTransition == null) {
        listViewBorder.setEnabled(false);
        closeTransition = new FadeWindowTransition(suggestionPopup, closeTransitionDuration, closeTransitionRate, dropShadowDecorator);
        closeTransition.start(new TransitionListener() {

            @Override
            public void transitionCompleted(Transition transition) {
                suggestionPopup.close(result);
            }
        });
    }
    return (closeTransition != null && closeTransition.isRunning()) ? Vote.DEFER : Vote.APPROVE;
}
Also used : Transition(org.apache.pivot.wtk.effects.Transition) TransitionListener(org.apache.pivot.wtk.effects.TransitionListener)

Example 8 with Transition

use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.

the class TerraAccordionSkin method previewSelectedIndexChange.

// Accordion selection events
@Override
public Vote previewSelectedIndexChange(final Accordion accordion, final int selectedIndex) {
    Vote vote = Vote.APPROVE;
    if (accordion.isShowing() && accordion.isValid()) {
        if (selectionChangeTransition == null) {
            int previousSelectedIndex = accordion.getSelectedIndex();
            if (selectedIndex != -1 && previousSelectedIndex != -1) {
                Component fromPanel = accordion.getPanels().get(previousSelectedIndex);
                Component toPanel = accordion.getPanels().get(selectedIndex);
                selectionChangeTransition = new SelectionChangeTransition(fromPanel, toPanel);
                layout();
                selectionChangeTransition.start(new TransitionListener() {

                    @Override
                    public void transitionCompleted(Transition transition) {
                        accordion.setSelectedIndex(selectedIndex);
                        selectionChangeTransition = null;
                        invalidateComponent();
                    }
                });
                vote = Vote.DEFER;
            }
        } else {
            if (selectionChangeTransition.isRunning()) {
                vote = Vote.DEFER;
            }
        }
    }
    return vote;
}
Also used : Vote(org.apache.pivot.util.Vote) Transition(org.apache.pivot.wtk.effects.Transition) TransitionListener(org.apache.pivot.wtk.effects.TransitionListener) Component(org.apache.pivot.wtk.Component) GradientPaint(java.awt.GradientPaint)

Aggregations

Transition (org.apache.pivot.wtk.effects.Transition)8 TransitionListener (org.apache.pivot.wtk.effects.TransitionListener)8 Vote (org.apache.pivot.util.Vote)4 Component (org.apache.pivot.wtk.Component)2 GradientPaint (java.awt.GradientPaint)1 Button (org.apache.pivot.wtk.Button)1 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)1 Display (org.apache.pivot.wtk.Display)1 PushButton (org.apache.pivot.wtk.PushButton)1 Window (org.apache.pivot.wtk.Window)1