use of javafx.animation.Timeline in project Gargoyle by callakrsos.
the class CrudBaseGridView method saveBtnClickHandler.
/**
* 저장버튼 클릭 핸들러
*
* @param saveClickCallbackProperty2
*
* @Date 2015. 10. 10.
* @return
* @User KYJ
*/
private EventHandler<MouseEvent> saveBtnClickHandler(ObjectProperty<Consumer<List<T>>> saveClickCallbackProperty) {
return new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
try {
Consumer<List<T>> callback = saveClickCallbackProperty.get();
if (callback == null) {
errorMsgCallback.accept("saveClickCallback 함수에 에러메세지 콜백을 등록하세요.");
return;
}
gridview.fireEvent(event);
List<T> items = getItems();
//필수값 검증로직 추가. 2016.12.08
AbstractVoNullChecker<T> nullCheckHandler = new DefaultVoNullChecker<>(CrudBaseGridView.this);
nullCheckHandler.setList(items);
Optional<Field> findFirst = nullCheckHandler.findFirst();
boolean present = findFirst.isPresent();
if (present) {
String msgFieldName = nullCheckHandler.getMsgNameByfield();
// String message = ValueUtil.getMessage("MSG_W_000001", msgFieldName);
int emptyIndex = nullCheckHandler.getEmptyIndex();
Set<Node> findAllByNodes = CrudBaseGridView.this.lookupAll("TableRow");
findAllByNodes.stream().map(n -> (TableRow) n).filter(r -> {
return emptyIndex == r.getIndex();
}).findFirst().ifPresent(n -> {
Timeline timeline = new Timeline();
timeline.setCycleCount(10);
timeline.setAutoReverse(true);
KeyFrame keyFrame = new KeyFrame(Duration.millis(500), new KeyValue(n.styleProperty(), "-fx-border-color : red ; -fx-border-width : 1px"));
KeyFrame keyFrame2 = new KeyFrame(Duration.millis(500), new KeyValue(n.styleProperty(), ""));
KeyValue keyValueX = new KeyValue(n.styleProperty(), "-fx-border-color : red ; -fx-border-width : 1px");
KeyValue keyValueY = new KeyValue(n.styleProperty(), "");
KeyFrame keyFrame3 = new KeyFrame(Duration.seconds(2), "", keyValueX, keyValueY);
timeline.getKeyFrames().add(keyFrame3);
timeline.play();
});
getSelectionModel().select(emptyIndex);
// DialogUtil.showMessageDialog(SharedMemory.getPrimaryStage(), msgFieldName + " Field is empty.");
return;
}
List<T> arrayList = new ArrayList<T>(items);
arrayList.addAll(deleteItems);
callback.accept(arrayList);
// 사용자 정의 로직이 이상없으면 deleteItems 항목도 비운다.
deleteItems.clear();
} catch (Exception e) {
throw e;
}
}
};
}
use of javafx.animation.Timeline in project bitsquare by bitsquare.
the class Notification method animateDisplay.
@Override
protected void animateDisplay() {
if (NotificationCenter.useAnimations) {
double startX = 320;
double duration = getDuration(600);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateXProperty(), startX, interpolator)));
//bouncing
/* keyFrames.add(new KeyFrame(Duration.millis(duration * 0.6),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateXProperty(), -12, interpolator)
));
keyFrames.add(new KeyFrame(Duration.millis(duration * 0.8),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateXProperty(), 4, interpolator)
));*/
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateXProperty(), 0, interpolator)));
timeline.play();
}
}
use of javafx.animation.Timeline in project bitsquare by bitsquare.
the class Notification method animateHide.
@Override
protected void animateHide(Runnable onFinishedHandler) {
if (autoCloseTimer != null) {
autoCloseTimer.stop();
autoCloseTimer = null;
}
if (NotificationCenter.useAnimations) {
double duration = getDuration(400);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
gridPane.setRotationAxis(Rotate.X_AXIS);
Camera camera = gridPane.getScene().getCamera();
gridPane.getScene().setCamera(new PerspectiveCamera());
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.rotateProperty(), -90, interpolator), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
timeline.setOnFinished(event -> {
gridPane.setRotate(0);
gridPane.setRotationAxis(Rotate.Z_AXIS);
gridPane.getScene().setCamera(camera);
onFinishedHandler.run();
});
timeline.play();
} else {
onFinishedHandler.run();
}
}
use of javafx.animation.Timeline in project bitsquare by bitsquare.
the class PeerInfoWithTagEditor method animateDisplay.
@Override
protected void animateDisplay() {
if (Preferences.INSTANCE.getUseAnimations()) {
double startY = -160;
double duration = getDuration(400);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
double height = gridPane.getPrefHeight();
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateYProperty(), startY, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateYProperty(), 0, interpolator)));
timeline.play();
}
}
use of javafx.animation.Timeline in project bitsquare by bitsquare.
the class Overlay method animateDisplay.
protected void animateDisplay() {
gridPane.setOpacity(0);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
double duration = getDuration(400);
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
if (type.animationType == AnimationType.SlideDownFromCenterTop) {
double startY = -gridPane.getHeight();
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateYProperty(), startY, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
} else if (type.animationType == AnimationType.ScaleFromCenter) {
double startScale = 0.25;
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), startScale, interpolator), new KeyValue(gridPane.scaleYProperty(), startScale, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
} else if (type.animationType == AnimationType.ScaleYFromCenter) {
double startYScale = 0.25;
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleYProperty(), startYScale, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
} else if (type.animationType == AnimationType.ScaleDownToCenter) {
double startScale = 1.1;
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), startScale, interpolator), new KeyValue(gridPane.scaleYProperty(), startScale, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
} else if (type.animationType == AnimationType.FadeInAtCenter) {
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
}
timeline.play();
}
Aggregations