Search in sources :

Example 11 with BorderStroke

use of javafx.scene.layout.BorderStroke in project TestFX by TestFX.

the class BoundsQueryUtilsTest method setupRegion.

private static void setupRegion() {
    region = new Region();
    region.setMaxSize(0, 0);
    region.setBackground(new Background(new BackgroundFill(Color.RED, null, null)));
    // nodeBounds(), nodeBoundsInLocal()
    region.setPadding(new Insets(0, 0, 0, PADDING_LEFT));
    region.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, // nodeBounds(), nodeBoundsInLocal()
    new BorderWidths(0, 0, 0, BORDER_LEFT))));
    // nodeBoundsInParent()
    StackPane.setMargin(region, new Insets(0, 0, 0, MARGIN_LEFT));
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 12 with BorderStroke

use of javafx.scene.layout.BorderStroke in project financial by greatkendy123.

the class LMController method viewAllClubAction.

/**
 * 查看所有俱乐部总帐单
 *
 * @time 2017年11月22日
 * @param event
 */
public void viewAllClubAction(ActionEvent event) {
    // 无数据就返回
    int size = allClubMap.size();
    if (allClubMap == null || allClubMap.size() == 0) {
        ShowUtil.show("无数据可以导出");
        return;
    }
    Map<String, List<Record>> current_LM_Map = LMTotalList.get(getCurrentLMType() - 1);
    if (MapUtil.isNullOrEmpty(current_LM_Map)) {
        ShowUtil.show("该联盟无数据可以导出");
        return;
    }
    // 组装当前要展示的联盟的相应俱乐部
    Map<String, Club> lmClubMap = getLMClub(current_LM_Map);
    // 设置合计桌费(这个没多大影响)
    setNewSumOfZF();
    // 隐藏单个所有信息
    showAllView();
    // 点击所有俱乐部总帐按钮后的单个聪明数据统计 {俱乐部ID  : 表内容}
    Map<String, List<LMSumInfo>> allClubSumMap = getAllClubSumMap(current_LM_Map);
    FlowPane flow = new FlowPane();
    flow.setId(FLOW_PANE_ID);
    flow.setMinWidth(668);
    flow.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, new BorderWidths(3))));
    flow.setVgap(20);
    flow.setHgap(20);
    flow.setPadding(new Insets(10, 10, 10, 30));
    // int size = allClubMap.size();
    // if(allClubMap == null || allClubMap.size() ==0) {
    // ShowUtil.show("无数据可以导出");
    // return;
    // }
    // 表示第一列的宽度
    final int talbeWidth = 300;
    // 表示第一列的宽度
    final int With1 = 80;
    // 表示第二列的宽度
    final int With2 = 70;
    final int With3 = 70;
    final int With4 = 60;
    final int height = 115;
    final String style = "-fx-alignment: CENTER;";
    final String clubNameStyle = "-fx-background-color: #FFFFE0;";
    // for(Map.Entry<String, Club> entry : allClubMap.entrySet()) {
    for (Map.Entry<String, Club> entry : lmClubMap.entrySet()) {
        Club club = entry.getValue();
        String clubId = entry.getKey();
        TableView table = new TableView();
        table.setPrefHeight(height);
        table.setPrefWidth(talbeWidth);
        // 设置列
        TableColumn col1 = new TableColumn(club.getName());
        col1.setPrefWidth(With1);
        col1.setStyle(style);
        col1.setSortable(false);
        col1.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumName"));
        TableColumn col2 = new TableColumn("总战绩");
        col2.setSortable(false);
        col2.setStyle(style);
        col2.setPrefWidth(With2);
        col2.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumZJ"));
        // 红色注释
        col2.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
        TableColumn col3 = new TableColumn("总保险");
        col3.setSortable(false);
        col3.setStyle(style);
        col3.setPrefWidth(With3);
        col3.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumInsure"));
        // 红色注释
        col3.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
        TableColumn col4 = new TableColumn("总人数");
        col4.setSortable(false);
        col4.setStyle(style);
        col4.setPrefWidth(With4);
        col4.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumPersonCount"));
        table.getColumns().addAll(col1, col2, col3, col4);
        // 设置数据
        setDynamicTableData(table, clubId, allClubSumMap);
        flow.getChildren().add(table);
    }
    ;
    bigAnchorPane.getChildren().add(0, flow);
}
Also used : LMSumInfo(com.kendy.entity.LMSumInfo) Insets(javafx.geometry.Insets) TableColumn(javafx.scene.control.TableColumn) Club(com.kendy.entity.Club) BorderWidths(javafx.scene.layout.BorderWidths) FlowPane(javafx.scene.layout.FlowPane) BorderStroke(javafx.scene.layout.BorderStroke) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) Border(javafx.scene.layout.Border) Map(java.util.Map) HashMap(java.util.HashMap) TableView(javafx.scene.control.TableView)

Example 13 with BorderStroke

use of javafx.scene.layout.BorderStroke in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method playSelectAnimation.

private void playSelectAnimation(Boolean selection, boolean playAnimation) {
    if (selection == null) {
        selection = false;
    }
    transition.setRate(selection ? 1 : -1);
    select.setRate(selection ? 1 : -1);
    if (playAnimation) {
        transition.play();
        select.play();
    } else {
        CornerRadii radii = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getRadii();
        Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets();
        if (selection) {
            mark.setScaleY(1);
            mark.setScaleX(1);
            mark.setOpacity(1);
            box.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
            select.playFrom(select.getCycleDuration());
            transition.playFrom(transition.getCycleDuration());
        } else {
            mark.setScaleY(0);
            mark.setScaleX(0);
            mark.setOpacity(0);
            box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets)));
            select.playFrom(Duration.ZERO);
            transition.playFrom(Duration.ZERO);
        }
    }
    box.setBorder(new Border(new BorderStroke(selection ? getSkinnable().getCheckedColor() : getSkinnable().getUnCheckedColor(), BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(2))));
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Example 14 with BorderStroke

use of javafx.scene.layout.BorderStroke in project Gargoyle by callakrsos.

the class TransparentWindow method start.

@Override
public void start(Stage stage) throws Exception {
    try {
        Label lbl = new Label("LABEL");
        VBox p = new VBox(lbl);
        // make the background of the label white and opaque
        lbl.setStyle("-fx-background-color: rgba(255, 255, 255, 1);");
        // add some borders to visualise the element' locations
        lbl.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, null)));
        p.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, null, null)));
        Scene scene = new Scene(p);
        stage.setScene(scene);
        // this is where the transparency is achieved:
        // the three layers must be made transparent
        // (i) make the VBox transparent (the 4th parameter is the alpha)
        p.setStyle("-fx-background-color: rgba(0, 0, 0, 0);");
        // (ii) set the scene fill to transparent
        scene.setFill(null);
        // (iii) set the stage background to transparent
        stage.initStyle(StageStyle.TRANSPARENT);
        stage.setWidth(200);
        stage.setHeight(100);
        stage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Label(javafx.scene.control.Label) BorderStroke(javafx.scene.layout.BorderStroke) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) Border(javafx.scene.layout.Border)

Example 15 with BorderStroke

use of javafx.scene.layout.BorderStroke 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)

Aggregations

Border (javafx.scene.layout.Border)23 BorderStroke (javafx.scene.layout.BorderStroke)23 BorderWidths (javafx.scene.layout.BorderWidths)18 Background (javafx.scene.layout.Background)13 BackgroundFill (javafx.scene.layout.BackgroundFill)13 CornerRadii (javafx.scene.layout.CornerRadii)10 Insets (javafx.geometry.Insets)9 Text (javafx.scene.text.Text)5 ArrayList (java.util.ArrayList)4 Label (javafx.scene.control.Label)4 List (java.util.List)3 BorderStrokeStyle (javafx.scene.layout.BorderStrokeStyle)3 Color (javafx.scene.paint.Color)3 ZonedDateTime (java.time.ZonedDateTime)2 Optional (java.util.Optional)2 ObservableList (javafx.collections.ObservableList)2 MouseEvent (javafx.scene.input.MouseEvent)2 StackPane (javafx.scene.layout.StackPane)2 VBox (javafx.scene.layout.VBox)2 Rectangle (javafx.scene.shape.Rectangle)2