use of org.apache.pivot.wtk.effects.TransitionListener 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;
}
use of org.apache.pivot.wtk.effects.TransitionListener 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;
}
use of org.apache.pivot.wtk.effects.TransitionListener 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;
}
Aggregations