Search in sources :

Example 51 with Color

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

the class AbstractGoogleTrendChart method action.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 11. 4.
	 */
private void action() {
    Line e = new Line();
    e.getStyleClass().add("google-chart-flow-line");
    e.setStyle("-fx-fill:gray");
    e.setOpacity(0.3d);
    //		getChildren().add(e);
    getPlotChildren().add(e);
    Text label = new Text("               \n\n\n\n\n\n\n\n\n\n     ");
    //		label.setStyle("-fx-fill:red");
    //		StackPane s = new StackPane(label);
    VBox s = new VBox(label);
    //		s.getStyleClass().add("google-chart-guide-box");
    //		s.setStyle("-fx-background-color : green;");
    s.setPrefSize(VBox.USE_COMPUTED_SIZE, VBox.USE_COMPUTED_SIZE);
    s.setPadding(new Insets(10));
    s.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.DASHED, CornerRadii.EMPTY, new BorderWidths(3d))));
    s.setBackground(new Background(new BackgroundFill(Color.GREEN, CornerRadii.EMPTY, new Insets(5))));
    getPlotChildren().add(s);
    this.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
        if (ev.getButton() == MouseButton.PRIMARY) {
            List<Node> collect = lookupAll(".chart-line-symbol").stream().filter(v -> v != null).filter(n -> {
                if (n instanceof StackPane) {
                    StackPane sp = (StackPane) n;
                    sp.setStyle(null);
                    if (e.intersects(n.getBoundsInParent())) {
                        sp.setStyle("-fx-background-color:green");
                        return true;
                    }
                }
                return false;
            }).filter(v -> v.getUserData() != null).collect(Collectors.toList());
            if (!collect.isEmpty()) {
                GoogleTrendChartEvent intersectNodeClickEvent = new GoogleTrendChartEvent(this, GoogleTrendChartEvent.NULL_SOURCE_TARGET, GoogleTrendChartEvent.GOOGLE_CHART_INTERSECT_NODE_CLICK, ev.getX(), ev.getY(), ev.getScreenX(), ev.getScreenY(), null, ev.getClickCount(), collect);
                Event.fireEvent(this, intersectNodeClickEvent);
            }
        }
    });
    this.addEventHandler(MouseEvent.MOUSE_MOVED, ev -> {
        double sceneX = Math.abs(getYAxis().getLayoutX() + getYAxis().getWidth() - ev.getX() - getYAxis().getPadding().getLeft() - getYAxis().getPadding().getRight() - getYAxis().getInsets().getLeft() - getYAxis().getInsets().getRight());
        e.setStartX(sceneX);
        e.setStartY(0d);
        e.setEndX(sceneX);
        e.setEndY(this.getHeight());
        Optional<String> reduce = lookupAll(".chart-line-symbol").stream().filter(v -> v != null).filter(n -> {
            if (n instanceof StackPane) {
                StackPane sp = (StackPane) n;
                sp.setStyle(null);
                if (e.intersects(n.getBoundsInParent())) {
                    sp.setStyle("-fx-background-color:green");
                    return true;
                }
            }
            return false;
        }).filter(v -> v.getUserData() != null).map(v -> v.getUserData().toString()).reduce((a, b) -> {
            return a + "\n" + b;
        });
        if (reduce.isPresent()) {
            label.setText(reduce.get());
            s.setOpacity(1d);
            if ((label.getBoundsInParent().getWidth() + label.getBoundsInParent().getMaxX() + sceneX) > this.getWidth()) {
                s.setLayoutX(sceneX - label.getBoundsInParent().getWidth() - label.getBoundsInParent().getMinX());
            } else {
                s.setLayoutX(sceneX);
            }
            if ((label.getBoundsInParent().getMaxY() + label.getBoundsInLocal().getHeight() + ev.getSceneY()) > getYAxis().getBoundsInParent().getMaxY()) {
                s.setLayoutY(getYAxis().getBoundsInParent().getMaxY() - label.getBoundsInLocal().getHeight() - label.getBoundsInParent().getMaxY());
            } else {
                s.setLayoutY(ev.getY());
            }
        } else
            s.setOpacity(0.3d);
    });
}
Also used : MouseButton(javafx.scene.input.MouseButton) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) IGargoyleChartAdapter(com.kyj.fx.voeditor.visual.framework.adapter.IGargoyleChartAdapter) FXCollections(javafx.collections.FXCollections) StackPane(javafx.scene.layout.StackPane) VBox(javafx.scene.layout.VBox) LineChart(javafx.scene.chart.LineChart) Line(javafx.scene.shape.Line) Insets(javafx.geometry.Insets) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) Color(javafx.scene.paint.Color) ObjectProperty(javafx.beans.property.ObjectProperty) Node(javafx.scene.Node) Border(javafx.scene.layout.Border) Event(javafx.event.Event) Rectangle(javafx.scene.shape.Rectangle) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) CategoryAxis(javafx.scene.chart.CategoryAxis) Collectors(java.util.stream.Collectors) Background(javafx.scene.layout.Background) BorderStrokeStyle(javafx.scene.layout.BorderStrokeStyle) BorderStroke(javafx.scene.layout.BorderStroke) Platform(javafx.application.Platform) Text(javafx.scene.text.Text) List(java.util.List) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) NumberAxis(javafx.scene.chart.NumberAxis) StringProperty(javafx.beans.property.StringProperty) CornerRadii(javafx.scene.layout.CornerRadii) Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Node(javafx.scene.Node) Text(javafx.scene.text.Text) Line(javafx.scene.shape.Line) BorderWidths(javafx.scene.layout.BorderWidths) BorderStroke(javafx.scene.layout.BorderStroke) VBox(javafx.scene.layout.VBox) Border(javafx.scene.layout.Border) StackPane(javafx.scene.layout.StackPane)

Example 52 with Color

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

the class DatabaseUrlManagementView method initialize.

@SuppressWarnings({ "rawtypes", "unchecked" })
@FXML
public void initialize() {
    // /tbDatabase.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    colKey.setCellValueFactory(param -> {
        Object object = param.getValue().get("seqNum");
        return new SimpleObjectProperty<>(object);
    });
    String property = ResourceLoader.getInstance().get(ResourceLoader.DBMS_SUPPORT);
    // 사용되지않은 코드
    // String colOrder =
    // ResourceLoader.getInstance().get(ResourceLoader.DATABASE_COLUMN_ORDER);
    // 2015.11.30 데이터에 []코드를 삭제하면서 아래 코드존재가 불필요해서 주석
    // 오류가 발생하여 임시 처리.
    // if (colOrder != null) {
    // colOrder = colOrder.replace("[", "");
    // colOrder = colOrder.replace("]", "");
    // }
    List<Code> dbms = Stream.of(StringUtils.tokenizeToStringArray(property, ",")).map(t -> new Code(t, t)).collect(Collectors.toList());
    colDbms = new ComboBoxTableColumn<>("dbms", FXCollections.observableArrayList(dbms), "code", "codeNm");
    tbDatabase.getColumns().add(1, colDbms);
    tbDatabase.getColumns().get(1).setText("DBMS");
    tbDatabase.getColumns().get(1).setId("colDbms");
    colColor = new ColorPickerTableColumn<Map<String, Object>>(colColor, "color");
    colColor.setMaxWidth(50);
    tbDatabase.getColumns().add(1, colColor);
    tbDatabase.getColumns().get(1).setText("Color");
    tbDatabase.getColumns().get(1).setId("colColor");
    /*********************************************************/
    // 파일 DagDrop 이벤트. URL에 새 데이터 add.
    tbDatabase.setOnDragDropped(ev -> {
        if (ev.getDragboard().hasFiles()) {
            List<File> files = ev.getDragboard().getFiles();
            files.stream().map(v -> {
                return v.getAbsolutePath();
            }).forEach(str -> {
                Map<String, Object> map = new HashMap<String, Object>();
                map.put(ResourceLoader.BASE_KEY_JDBC_URL, str);
                tbDatabase.getItems().add(map);
            });
            ev.setDropCompleted(true);
            ev.consume();
        }
    });
    tbDatabase.setOnDragOver(ev -> {
        if (ev.getDragboard().hasFiles()) {
            ev.acceptTransferModes(TransferMode.LINK);
            ev.consume();
        }
    });
    /*********************************************************/
    colPopup = new ButtonTableColumn() {

        @Override
        public void clickHandle(int nRow) {
            try {
                showSqlPane(nRow);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e);
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    };
    colPing = new ButtonTableColumn("Ping") {

        @Override
        public void clickHandle(int nRow) {
            try {
                ping(nRow);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e);
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    };
    colPopup.setMaxWidth(50);
    tbDatabase.getColumns().add(1, colPopup);
    tbDatabase.getColumns().get(1).setText("Popup");
    tbDatabase.getColumns().get(1).setId("colPopup");
    tbDatabase.getColumns().add(colPing);
    setColumnText(colAlias, "alias");
    colUrl.setPrefWidth(300);
    setColumnText(colUrl, ResourceLoader.BASE_KEY_JDBC_URL);
    setColumnText(colUserName, ResourceLoader.BASE_KEY_JDBC_ID);
    setColumnText(colUserPassword, ResourceLoader.BASE_KEY_JDBC_PASS, param -> new PasswordTextFieldTableCell());
    // colUserPassword.setCellValueFactory(param -> {
    // Object initialValue =
    // param.getValue().get(ResourceLoader.BASE_KEY_JDBC_PASS);
    // SimpleObjectProperty<Object> simpleObjectProperty = new
    // SimpleObjectProperty<>(initialValue);
    // simpleObjectProperty.addListener((oba, oldval, newval) ->
    // param.getValue().put(ResourceLoader.BASE_KEY_JDBC_PASS, newval));
    // return simpleObjectProperty;
    // });
    // colUserPassword.setCellFactory(param -> new
    // PasswordTextFieldTableCell());
    observableArrayList = loadResource();
    tbDatabase.getItems().addAll(observableArrayList);
}
Also used : Button(javafx.scene.control.Button) DbUtil(com.kyj.fx.voeditor.visual.util.DbUtil) Enumeration(java.util.Enumeration) LoggerFactory(org.slf4j.LoggerFactory) PoolProperties(org.apache.tomcat.jdbc.pool.PoolProperties) EncrypUtil(com.kyj.fx.voeditor.visual.util.EncrypUtil) Map(java.util.Map) CommonsSqllPan(com.kyj.fx.voeditor.visual.component.sql.view.CommonsSqllPan) ColorPickerTableColumn(com.kyj.fx.voeditor.visual.component.ColorPickerTableColumn) TableView(javafx.scene.control.TableView) ButtonTableColumn(com.kyj.fx.voeditor.visual.component.ButtonTableColumn) RuntimeException(com.sun.star.uno.RuntimeException) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) Stream(java.util.stream.Stream) JSONObject(org.json.simple.JSONObject) ComboBoxTableColumn(com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Code(com.kyj.fx.voeditor.visual.main.model.vo.Code) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) TransferMode(javafx.scene.input.TransferMode) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) Callback(javafx.util.Callback) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) StringConverter(javafx.util.StringConverter) File(java.io.File) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) NotYetSupportException(com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException) PasswordTextFieldTableCell(com.kyj.fx.voeditor.visual.component.PasswordTextFieldTableCell) ChangeListener(javafx.beans.value.ChangeListener) StringUtils(org.springframework.util.StringUtils) HashMap(java.util.HashMap) Code(com.kyj.fx.voeditor.visual.main.model.vo.Code) RuntimeException(com.sun.star.uno.RuntimeException) IOException(java.io.IOException) NotYetSupportException(com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) JSONObject(org.json.simple.JSONObject) PasswordTextFieldTableCell(com.kyj.fx.voeditor.visual.component.PasswordTextFieldTableCell) Map(java.util.Map) HashMap(java.util.HashMap) File(java.io.File) ButtonTableColumn(com.kyj.fx.voeditor.visual.component.ButtonTableColumn) FXML(javafx.fxml.FXML)

Aggregations

Color (javafx.scene.paint.Color)52 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