use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.
the class Transitions method initialize.
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
button1 = (PushButton) namespace.get("button1");
button2 = (PushButton) namespace.get("button2");
button3 = (PushButton) namespace.get("button3");
button4 = (PushButton) namespace.get("button4");
ButtonPressListener buttonPressListener = new ButtonPressListener() {
@Override
public void buttonPressed(final Button button) {
if (collapseTransition == null) {
collapseTransition = new CollapseTransition(button, TRANSITION_DURATION, TRANSITION_RATE);
TransitionListener transitionListener = new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
CollapseTransition collapseTransitionLocal = (CollapseTransition) transition;
if (!transition.isReversed()) {
Component component = collapseTransitionLocal.getComponent();
component.getParent().remove(component);
}
Transitions.this.collapseTransition = null;
}
};
collapseTransition.start(transitionListener);
} else {
collapseTransition.reverse();
if (collapseTransition.getComponent() != button) {
collapseTransition.end();
}
}
}
};
button1.getButtonPressListeners().add(buttonPressListener);
button2.getButtonPressListeners().add(buttonPressListener);
button3.getButtonPressListeners().add(buttonPressListener);
button4.getButtonPressListeners().add(buttonPressListener);
}
use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.
the class TerraTooltipSkin method previewWindowClose.
@Override
public Vote previewWindowClose(final Window window) {
Vote vote = Vote.APPROVE;
if (fade) {
if (closeTransition == null) {
closeTransition = new FadeWindowTransition(window, closeTransitionDuration, closeTransitionRate, dropShadowDecorator);
closeTransition.start(new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
window.close();
}
});
vote = Vote.DEFER;
} else {
vote = (closeTransition.isRunning()) ? Vote.DEFER : Vote.APPROVE;
}
}
return vote;
}
use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.
the class TerraExpanderSkin method previewExpandedChange.
/**
* {@inheritDoc}
*/
@Override
public Vote previewExpandedChange(final Expander expander) {
Vote vote;
if (expander.isShowing() && expandTransition == null && expander.getContent() != null) {
final boolean expanded = expander.isExpanded();
shadeButton.setButtonData(expanded ? collapseImage : expandImage);
expandTransition = new ExpandTransition(expanded);
expandTransition.start(new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
expander.setExpanded(!expanded);
expandTransition = null;
}
});
}
if (expandTransition == null || !expandTransition.isRunning()) {
vote = Vote.APPROVE;
} else {
vote = Vote.DEFER;
}
return vote;
}
use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.
the class TerraSheetSkin method windowOpened.
@Override
public void windowOpened(Window window) {
super.windowOpened(window);
Display display = window.getDisplay();
display.getContainerMouseListeners().add(displayMouseListener);
display.reenterMouse();
if (dropShadowDecorator != null) {
dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);
}
alignToOwner();
Window owner = window.getOwner();
owner.getComponentListeners().add(ownerListener);
openTransition = new OpenTransition(false);
openTransition.start(new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
openTransition = null;
}
});
if (!window.requestFocus()) {
Component.clearFocus();
}
}
use of org.apache.pivot.wtk.effects.Transition in project pivot by apache.
the class TerraRollupSkin method previewExpandedChange.
// Rollup state events
@Override
public Vote previewExpandedChange(final Rollup rollup) {
Vote vote;
if (rollup.isShowing() && expandTransition == null && rollup.getContent() != null) {
final boolean expanded = rollup.isExpanded();
expandTransition = new ExpandTransition(expanded);
expandTransition.start(new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
rollup.setExpanded(!expanded);
expandTransition = null;
}
});
}
if (expandTransition == null || !expandTransition.isRunning()) {
vote = Vote.APPROVE;
} else {
vote = Vote.DEFER;
}
return vote;
}
Aggregations