Search in sources :

Example 26 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class CandleStickChart method seriesRemoved.

@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    // remove all candle nodes
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node candle = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(candle);
            });
            ft.play();
        } else {
            getPlotChildren().remove(candle);
        }
    }
    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), seriesPath);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(seriesPath);
                seriesPath.getElements().clear();
            });
            ft.play();
        } else {
            getPlotChildren().remove(seriesPath);
            seriesPath.getElements().clear();
        }
    }
}
Also used : Path(javafx.scene.shape.Path) FadeTransition(javafx.animation.FadeTransition) ActionEvent(javafx.event.ActionEvent) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Example 27 with Node

use of javafx.scene.Node in project bitsquare by bitsquare.

the class VolumeChart method seriesAdded.

@Override
protected void seriesAdded(XYChart.Series<Number, Number> series, int seriesIndex) {
    for (int j = 0; j < series.getData().size(); j++) {
        XYChart.Data item = series.getData().get(j);
        Node volumeBar = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            volumeBar.setOpacity(0);
            getPlotChildren().add(volumeBar);
            FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(volumeBar);
        }
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Example 28 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class FileTreeItem method updateGraphics.

/********************************
	 * 작성일 : 2016. 7. 10. 작성자 : KYJ
	 *
	 * UI에 보여질 Dispay 처리.
	 *
	 * @param fileWrapper
	 ********************************/
private void updateGraphics(FileWrapper fileWrapper) {
    Node value = createGraphcis(fileWrapper);
    value.getStyleClass().add(graphicsCssId());
    setGraphic(value);
}
Also used : Node(javafx.scene.Node)

Example 29 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class FxControlsTreeItem method createNode.

/**
	 * 파일 트리를 생성하기 위한 노드를 반환한다.
	 *
	 * @Date 2015. 10. 14.
	 * @param f
	 * @return
	 * @User KYJ
	 */
public TreeItem<Node> createNode(final Node f) {
    TreeItem<Node> treeItem = new TreeItem<Node>(f) {

        private boolean isLeaf;

        private boolean isFirstTimeChildren = true;

        private boolean isFirstTimeLeaf = true;

        @Override
        public ObservableList<TreeItem<Node>> getChildren() {
            if (isFirstTimeChildren) {
                isFirstTimeChildren = false;
                super.getChildren().setAll(buildChildren(this));
            }
            return super.getChildren();
        }

        @Override
        public boolean isLeaf() {
            if (isFirstTimeLeaf) {
                isFirstTimeLeaf = false;
                Node f = getValue();
                if (f == null) {
                    isLeaf = true;
                } else if (f instanceof Control) {
                    isLeaf = ((Control) f).getChildrenUnmodifiable().isEmpty();
                } else if (f instanceof Parent) {
                    isLeaf = ((Parent) f).getChildrenUnmodifiable().isEmpty();
                } else if (f instanceof Shape)
                    isLeaf = true;
                else
                    isLeaf = false;
            }
            return isLeaf;
        }

        private ObservableList<TreeItem<Node>> buildChildren(TreeItem<Node> treeItem) {
            Node f = treeItem.getValue();
            if (f == null) {
                return FXCollections.emptyObservableList();
            }
            treeItem.setGraphic(new HBox(/* new CheckBox(), */
            getImage(getName(f))));
            List<Node> childrens = getChildrens(f);
            if (childrens == null || childrens.isEmpty()) {
                return FXCollections.emptyObservableList();
            } else {
                ObservableList<TreeItem<Node>> children = FXCollections.observableArrayList();
                for (Node child : childrens) {
                    children.add(createNode(child));
                }
                return children;
            }
        }
    };
    treeItem.setGraphic(new HBox(/* new CheckBox(), */
    getImage(getName(f))));
    return treeItem;
}
Also used : Control(javafx.scene.control.Control) HBox(javafx.scene.layout.HBox) Shape(javafx.scene.shape.Shape) TreeItem(javafx.scene.control.TreeItem) Parent(javafx.scene.Parent) Node(javafx.scene.Node)

Example 30 with Node

use of javafx.scene.Node in project Gargoyle by callakrsos.

the class CheckBoxFxControlsTreeItem method getChildrens.

/**
	 * node로부터 구성된 하위 노드들을 반환받음.
	 * 
	 * @param node
	 * @return
	 */
public List<Node> getChildrens(Node node) {
    List<Node> controls = new ArrayList<>();
    if (node instanceof Control) {
        Control c = (Control) node;
        controls.add(c);
        controls = c.getChildrenUnmodifiable();
    } else if (node instanceof Parent) {
        Parent p = (Parent) node;
        controls = p.getChildrenUnmodifiable();
    } else {
        controls.add(node);
    }
    return controls;
}
Also used : Control(javafx.scene.control.Control) Parent(javafx.scene.Parent) Node(javafx.scene.Node) ArrayList(java.util.ArrayList)

Aggregations

Node (javafx.scene.Node)118 Label (javafx.scene.control.Label)18 Stage (javafx.stage.Stage)17 Parent (javafx.scene.Parent)16 Button (javafx.scene.control.Button)16 ArrayList (java.util.ArrayList)15 ObservableList (javafx.collections.ObservableList)14 FXML (javafx.fxml.FXML)14 List (java.util.List)12 BorderPane (javafx.scene.layout.BorderPane)12 HBox (javafx.scene.layout.HBox)11 IOException (java.io.IOException)10 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 Color (javafx.scene.paint.Color)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8 MenuItem (javafx.scene.control.MenuItem)8