Search in sources :

Example 21 with Color

use of javafx.scene.paint.Color in project Gargoyle by callakrsos.

the class SkinPreviewViewComposite method previewTabInit.

@FxPostInitialize
public void previewTabInit() {
    Task<Void> task = new Task<Void>() {

        @Override
        protected Void call() throws Exception {
            Thread.sleep(5000L);
            Platform.runLater(() -> {
                //메뉴바 배경.
                {
                    Background background = mbSample.getBackground();
                    Color fill = (Color) background.getFills().get(0).getFill();
                    colorMbSample.setValue(fill);
                    //메뉴바 텍스트
                    {
                        Label lookup = (Label) mbSample.lookup(".label");
                        Color textFill = (Color) lookup.getTextFill();
                        colorMbLabelSample.setValue(textFill);
                    }
                }
                //Hbox 배경.
                {
                    Background background = hboxSample.getBackground();
                    Color fill = (Color) background.getFills().get(0).getFill();
                    colorHboxSample.setValue(fill);
                }
                {
                    //선택디지않는 탭 색상 처리.
                    Set<Node> lookupAll = tabpaneSample.lookupAll(".tab:top");
                    lookupAll.forEach(lookup -> {
                        Optional<PseudoClass> findFirst = lookup.getPseudoClassStates().stream().filter(v -> {
                            return "selected".equals(v.getPseudoClassName());
                        }).findFirst();
                        if (findFirst.isPresent()) {
                            Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
                            Color textFill = (Color) selectedTabLabel.getTextFill();
                            colorSelectedTabText.setValue(textFill);
                        } else {
                            Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
                            Color textFill = (Color) selectedTabLabel.getTextFill();
                            colorUnSelectedTabText.setValue(textFill);
                        }
                    });
                    {
                        lookupAll.stream().findFirst().ifPresent(n -> {
                            Pane p = (Pane) n;
                            Background background = p.getBackground();
                            Color fill = (Color) background.getFills().get(0).getFill();
                            colorTabSample1Selected.setValue(fill);
                        });
                    }
                }
            });
            return null;
        }
    };
    Window window = this.getScene().getWindow();
    if (window != null) {
        FxUtil.showLoading(window, task);
    } else
        FxUtil.showLoading(task);
}
Also used : Button(javafx.scene.control.Button) TextArea(javafx.scene.control.TextArea) PseudoClass(javafx.css.PseudoClass) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) TableColumn(javafx.scene.control.TableColumn) Task(javafx.concurrent.Task) TabPane(javafx.scene.control.TabPane) Map(java.util.Map) FileUtil(com.kyj.fx.voeditor.visual.util.FileUtil) TableView(javafx.scene.control.TableView) Pane(javafx.scene.layout.Pane) ColorPicker(javafx.scene.control.ColorPicker) HBox(javafx.scene.layout.HBox) Color(javafx.scene.paint.Color) Pair(javafx.util.Pair) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuBar(javafx.scene.control.MenuBar) Node(javafx.scene.Node) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Set(java.util.Set) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) JFXToggleButton(com.jfoenix.controls.JFXToggleButton) Background(javafx.scene.layout.Background) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) Stage(javafx.stage.Stage) Optional(java.util.Optional) Window(javafx.stage.Window) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) StringProperty(javafx.beans.property.StringProperty) Window(javafx.stage.Window) Task(javafx.concurrent.Task) Set(java.util.Set) Background(javafx.scene.layout.Background) Optional(java.util.Optional) Color(javafx.scene.paint.Color) Label(javafx.scene.control.Label) TabPane(javafx.scene.control.TabPane) Pane(javafx.scene.layout.Pane) BorderPane(javafx.scene.layout.BorderPane) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Example 22 with Color

use of javafx.scene.paint.Color in project Gargoyle by callakrsos.

the class ScmCommitComposite method load.

public void load() {
    try {
        scmHistoryWalk();
        getBarChartDayOfMonthCategory().setLabel("기간별 커밋 통계");
        getLineChartDayOfWeekCategory().setLabel("요일별 커밋 통계");
        getBarChartDayOfMonthCategory().getCategories().add(SERIES_LABEL);
        getLineChartDayOfWeekCategory().getCategories().add(SERIES_LABEL);
        Color lineColor = Color.GREEN;
        double strokeWidth = 1;
        String cssStyleClassName = ".chart-series-line";
        {
            /*start Desing css.*/
            BarChart<String, Long> barChartDayOfMonth = getBarChartDayOfMonth();
            String style = "-fx-bar-fill: ".concat(FxUtil.toWebString(lineColor)).concat(";");
            for (Node n : barChartDayOfMonth.lookupAll(".default-color0.chart-bar")) {
                n.setStyle(style);
            }
            //				barChartDayOfMonth.setStyle(
            //						".chart-legend-item-syCmbol chart-bar series0 bar-legend-symbol default-color0{- fx-background-color:green;}");
            /*end Desing css.*/
            /*start Popover*/
            //무조건 1개의 시리즈만 처리하므로 인덱스에서 바로 가져옴.
            ObservableList<Data<String, Long>> dataArr = getBarChartDayOfMonth().getData().get(0).getData();
            for (Data<String, Long> d : dataArr) {
                d.getNode().setOnMouseClicked(ev -> {
                    if (ev.getClickCount() == 1 && ev.getButton() == MouseButton.PRIMARY)
                        createPopOver(d);
                });
            }
            barChartDayOfMonth.setMinWidth(BarChart.USE_COMPUTED_SIZE);
            barChartDayOfMonth.requestLayout();
        /*end Popover*/
        }
        {
            LineChart<String, Long> lineChartDayOfWeek = getLineChartDayOfWeek();
            lineChartDayOfWeek.setStyle(".chart-series-line .series0 .default-color0{- fx-background-color:green;}");
            Set<Node> lookupAll = lineChartDayOfWeek.lookupAll(".chart-line-symbol");
            StringBuffer sb = new StringBuffer();
            sb.append("-fx-background-color: " + FxUtil.toRgbString(lineColor) + ", white;");
            sb.append(" -fx-background-insets: 0, 2;");
            sb.append("-fx-background-radius: 5px;");
            sb.append("-fx-padding: 5px;");
            for (Node n : lookupAll) {
                n.setStyle(sb.toString());
            }
            String style = "-fx-stroke: " + FxUtil.toRgbString(lineColor) + "; -fx-stroke-width: " + strokeWidth + ";";
            for (Node seriesLine : lineChartDayOfWeek.lookupAll(cssStyleClassName)) {
                seriesLine.setStyle(style);
            }
        }
    } catch (SVNException e) {
        LOGGER.error(ValueUtil.toString(e));
    }
}
Also used : MouseButton(javafx.scene.input.MouseButton) ListView(javafx.scene.control.ListView) GagoyleDate(com.kyj.fx.voeditor.visual.framework.model.GagoyleDate) MouseEvent(javafx.scene.input.MouseEvent) LoggerFactory(org.slf4j.LoggerFactory) Series(javafx.scene.chart.XYChart.Series) SimpleDateFormat(java.text.SimpleDateFormat) XYChart(javafx.scene.chart.XYChart) LinkedHashMap(java.util.LinkedHashMap) LineChart(javafx.scene.chart.LineChart) ContextMenu(javafx.scene.control.ContextMenu) Map(java.util.Map) FxCollectors(com.kyj.fx.voeditor.visual.util.FxCollectors) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuItem(javafx.scene.control.MenuItem) SVNException(org.tmatesoft.svn.core.SVNException) Data(javafx.scene.chart.XYChart.Data) Collection(java.util.Collection) Node(javafx.scene.Node) Set(java.util.Set) MasterSlaveChartComposite(com.kyj.fx.voeditor.visual.component.MasterSlaveChartComposite) BarChart(javafx.scene.chart.BarChart) Collectors(java.util.stream.Collectors) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) TreeMap(java.util.TreeMap) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) ValueUtil(kyj.Fx.dao.wizard.core.util.ValueUtil) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Set(java.util.Set) Color(javafx.scene.paint.Color) Node(javafx.scene.Node) Data(javafx.scene.chart.XYChart.Data) SVNException(org.tmatesoft.svn.core.SVNException) ObservableList(javafx.collections.ObservableList) BarChart(javafx.scene.chart.BarChart) LineChart(javafx.scene.chart.LineChart)

Example 23 with Color

use of javafx.scene.paint.Color in project Gargoyle by callakrsos.

the class PMDViolationbyBarChartComposite method style.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 10. 24.
	 * @param barChart2
	 */
private void style(BarChart<String, Number> chart) {
    Color lineColor = Color.web("#58AD58");
    //		chart-bar series0 data2 default-color0
    String style = "-fx-bar-fill: ".concat(FxUtil.toWebString(lineColor)).concat(";");
    Set<Node> lookupAll = chart.lookupAll(".default-color0");
    for (Node n : lookupAll) {
        //				anotherStyleAction.accept(style);
        n.setStyle(style);
    }
}
Also used : Color(javafx.scene.paint.Color) Node(javafx.scene.Node)

Example 24 with Color

use of javafx.scene.paint.Color in project JFoenix by jfoenixadmin.

the class JFXRadioButtonSkin method handleControlPropertyChanged.

@Override
protected void handleControlPropertyChanged(String p) {
    super.handleControlPropertyChanged(p);
    if ("SELECTED_COLOR".equals(p)) {
        // update animation
        updateAnimation();
        // update current colors
        boolean isSelected = getSkinnable().isSelected();
        Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
        Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
        rippler.setRipplerFill(isSelected ? selectedColor : unSelectedColor);
        if (isSelected)
            radio.strokeProperty().set(selectedColor);
    } else if ("UNSELECTED_COLOR".equals(p)) {
        // update animation
        updateAnimation();
        // update current colors
        boolean isSelected = getSkinnable().isSelected();
        Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
        Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
        rippler.setRipplerFill(isSelected ? selectedColor : unSelectedColor);
        if (!isSelected)
            radio.strokeProperty().set(unSelectedColor);
    } else if ("SELECTED".equals(p)) {
        // update ripple color
        boolean isSelected = getSkinnable().isSelected();
        Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
        Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
        rippler.setRipplerFill(isSelected ? selectedColor : unSelectedColor);
        // play selection animation			
        playAnimation();
    }
}
Also used : JFXRadioButton(com.jfoenix.controls.JFXRadioButton) Color(javafx.scene.paint.Color)

Example 25 with Color

use of javafx.scene.paint.Color in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method createFillTransition.

private void createFillTransition() {
    select = new JFXFillTransition(Duration.millis(120), box, Color.TRANSPARENT, (Color) ((JFXCheckBox) getSkinnable()).getCheckedColor());
    select.setInterpolator(Interpolator.EASE_OUT);
}
Also used : JFXFillTransition(com.jfoenix.transitions.JFXFillTransition) Color(javafx.scene.paint.Color)

Aggregations

Color (javafx.scene.paint.Color)53 Rotate (javafx.scene.transform.Rotate)12 Random (java.util.Random)10 Group (javafx.scene.Group)10 Translate (javafx.scene.transform.Translate)10 Scene (javafx.scene.Scene)9 MouseEvent (javafx.scene.input.MouseEvent)7 FXML (javafx.fxml.FXML)6 IOException (java.io.IOException)5 List (java.util.List)5 ObservableList (javafx.collections.ObservableList)5 PerspectiveCamera (javafx.scene.PerspectiveCamera)5 KeyCode (javafx.scene.input.KeyCode)5 StackPane (javafx.scene.layout.StackPane)5 Node (javafx.scene.Node)4 TextField (javafx.scene.control.TextField)4 Background (javafx.scene.layout.Background)4 JFXRadioButton (com.jfoenix.controls.JFXRadioButton)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3