use of com.jfoenix.transitions.JFXDrawerKeyValue in project JFoenix by jfoenixadmin.
the class JFXDrawer method addAnimatedKeyValue.
public void addAnimatedKeyValue(Node node, List<JFXDrawerKeyValue<?>> values) {
Collection<JFXKeyValue<?>> modifiedValues = new ArrayList<>();
for (JFXDrawerKeyValue value : values) {
JFXKeyValue modifiedValue = JFXKeyValue.builder().setEndValueSupplier(() -> currentValue.get(value.getTarget()).get()).setAnimateCondition(() -> node.getScene() != null && value.isValid()).setTargetSupplier(() -> value.getTarget()).setInterpolator(value.getInterpolator()).build();
modifiedValues.add(modifiedValue);
currentValue.put(value.getTarget(), isClosed() ? value.getCloseValueSupplier() : value.getOpenValueSupplier());
initValues.put(value.getTarget(), value);
}
animatedValues.addAll(modifiedValues);
final JFXKeyFrame keyFrame = new JFXKeyFrame(duration, modifiedValues.toArray(new JFXKeyValue[0]));
try {
translateTimer.addKeyFrame(keyFrame);
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.jfoenix.transitions.JFXDrawerKeyValue in project JFoenix by jfoenixadmin.
the class JFXDrawer method close.
/**
* Starts the animation to transition this drawer to closed.
*/
public void close() {
translateTimer.setOnFinished(() -> {
overlayPane.setMouseTransparent(true);
fireEvent(new JFXDrawerEvent(JFXDrawerEvent.CLOSED));
});
if (hasMiniSize()) {
if (resizeTo != getMiniDrawerSize()) {
resizeTo = getMiniDrawerSize();
for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
currentValue.put(entry.getKey(), entry.getValue().getCloseValueSupplier());
}
}
} else {
updateTempDrawerSize();
if (translateTo != initTranslate.get()) {
translateTo = initTranslate.get();
for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
currentValue.put(entry.getKey(), entry.getValue().getCloseValueSupplier());
}
}
}
getCachePolicy().cache(contentHolder);
translateTimer.reverseAndContinue();
}
use of com.jfoenix.transitions.JFXDrawerKeyValue in project JFoenix by jfoenixadmin.
the class JFXDrawer method partialClose.
private void partialClose() {
for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
currentValue.put(entry.getKey(), entry.getValue().getCloseValueSupplier());
}
translateTo = initTranslate.get();
resizeTo = getMiniDrawerSize();
translateTimer.setOnFinished(() -> {
overlayPane.setMouseTransparent(true);
fireEvent(new JFXDrawerEvent(JFXDrawerEvent.CLOSED));
});
getCachePolicy().cache(contentHolder);
translateTimer.start();
}
Aggregations