1 /*
2 * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
66 import javafx.css.converter.BooleanConverter;
67 import javafx.css.converter.InsetsConverter;
68 import javafx.css.converter.ShapeConverter;
69 import javafx.css.converter.SizeConverter;
70 import com.sun.javafx.geom.BaseBounds;
71 import com.sun.javafx.geom.PickRay;
72 import com.sun.javafx.geom.RectBounds;
73 import com.sun.javafx.geom.Vec2d;
74 import com.sun.javafx.geom.transform.BaseTransform;
75 import com.sun.javafx.scene.DirtyBits;
76 import com.sun.javafx.scene.NodeHelper;
77 import com.sun.javafx.scene.ParentHelper;
78 import com.sun.javafx.scene.input.PickResultChooser;
79 import com.sun.javafx.scene.layout.RegionHelper;
80 import com.sun.javafx.scene.shape.ShapeHelper;
81 import com.sun.javafx.sg.prism.NGNode;
82 import com.sun.javafx.sg.prism.NGRegion;
83 import com.sun.javafx.tk.Toolkit;
84 import javafx.scene.Scene;
85 import javafx.stage.Window;
86 import sun.util.logging.PlatformLogger;
87 import sun.util.logging.PlatformLogger.Level;
88
89 /**
90 * Region is the base class for all JavaFX Node-based UI Controls, and all layout containers.
91 * It is a resizable Parent node which can be styled from CSS. It can have multiple backgrounds
92 * and borders. It is designed to support as much of the CSS3 specification for backgrounds
93 * and borders as is relevant to JavaFX.
94 * The full specification is available at <a href="http://www.w3.org/TR/2012/CR-css3-background-20120724/">the W3C</a>.
95 * <p>
96 * Every Region has its layout bounds, which are specified to be (0, 0, width, height). A Region might draw outside
97 * these bounds. The content area of a Region is the area which is occupied for the layout of its children.
98 * This area is, by default, the same as the layout bounds of the Region, but can be modified by either the
99 * properties of a border (either with BorderStrokes or BorderImages), and by padding. The padding can
100 * be negative, such that the content area of a Region might extend beyond the layout bounds of the Region,
101 * but does not affect the layout bounds.
102 * <p>
103 * A Region has a Background, and a Border, although either or both of these might be empty. The Background
104 * of a Region is made up of zero or more BackgroundFills, and zero or more BackgroundImages. Likewise, the
105 * border of a Region is defined by its Border, which is made up of zero or more BorderStrokes and
106 * zero or more BorderImages. All BackgroundFills are drawn first, followed by BackgroundImages, BorderStrokes,
107 * and finally BorderImages. The content is drawn above all backgrounds and borders. If a BorderImage is
|
1 /*
2 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
66 import javafx.css.converter.BooleanConverter;
67 import javafx.css.converter.InsetsConverter;
68 import javafx.css.converter.ShapeConverter;
69 import javafx.css.converter.SizeConverter;
70 import com.sun.javafx.geom.BaseBounds;
71 import com.sun.javafx.geom.PickRay;
72 import com.sun.javafx.geom.RectBounds;
73 import com.sun.javafx.geom.Vec2d;
74 import com.sun.javafx.geom.transform.BaseTransform;
75 import com.sun.javafx.scene.DirtyBits;
76 import com.sun.javafx.scene.NodeHelper;
77 import com.sun.javafx.scene.ParentHelper;
78 import com.sun.javafx.scene.input.PickResultChooser;
79 import com.sun.javafx.scene.layout.RegionHelper;
80 import com.sun.javafx.scene.shape.ShapeHelper;
81 import com.sun.javafx.sg.prism.NGNode;
82 import com.sun.javafx.sg.prism.NGRegion;
83 import com.sun.javafx.tk.Toolkit;
84 import javafx.scene.Scene;
85 import javafx.stage.Window;
86 import com.sun.javafx.logging.PlatformLogger;
87 import com.sun.javafx.logging.PlatformLogger.Level;
88
89 /**
90 * Region is the base class for all JavaFX Node-based UI Controls, and all layout containers.
91 * It is a resizable Parent node which can be styled from CSS. It can have multiple backgrounds
92 * and borders. It is designed to support as much of the CSS3 specification for backgrounds
93 * and borders as is relevant to JavaFX.
94 * The full specification is available at <a href="http://www.w3.org/TR/2012/CR-css3-background-20120724/">the W3C</a>.
95 * <p>
96 * Every Region has its layout bounds, which are specified to be (0, 0, width, height). A Region might draw outside
97 * these bounds. The content area of a Region is the area which is occupied for the layout of its children.
98 * This area is, by default, the same as the layout bounds of the Region, but can be modified by either the
99 * properties of a border (either with BorderStrokes or BorderImages), and by padding. The padding can
100 * be negative, such that the content area of a Region might extend beyond the layout bounds of the Region,
101 * but does not affect the layout bounds.
102 * <p>
103 * A Region has a Background, and a Border, although either or both of these might be empty. The Background
104 * of a Region is made up of zero or more BackgroundFills, and zero or more BackgroundImages. Likewise, the
105 * border of a Region is defined by its Border, which is made up of zero or more BorderStrokes and
106 * zero or more BorderImages. All BackgroundFills are drawn first, followed by BackgroundImages, BorderStrokes,
107 * and finally BorderImages. The content is drawn above all backgrounds and borders. If a BorderImage is
|