33 import javafx.geometry.Bounds;
34 import java.util.Collection;
35
36
37
38 /**
39 * A {@code Group} node contains an ObservableList of children that
40 * are rendered in order whenever this node is rendered.
41 * <p>
42 * A {@code Group} will take on the collective bounds of its children and is
43 * not directly resizable.
44 * <p>
45 * Any transform, effect, or state applied to a {@code Group} will be applied
46 * to all children of that group. Such transforms and effects will NOT be included
47 * in this Group's layout bounds, however if transforms and effects are set
48 * directly on children of this Group, those will be included in this Group's layout bounds.
49 * <p>
50 * By default, a {@code Group} will "auto-size" its managed resizable
51 * children to their preferred sizes during the layout pass to ensure that Regions
52 * and Controls are sized properly as their state changes. If an application
53 * needs to disable this auto-sizing behavior, then it should set {@link #autoSizeChildren}
54 * to {@code false} and understand that if the preferred size of the children
55 * change, they will not automatically resize (so buyer beware!).
56 *
57 * <p>Group Example:</p>
58 *
59 <PRE>
60 import javafx.scene.*;
61 import javafx.scene.paint.*;
62 import javafx.scene.shape.*;
63 import java.lang.Math;
64
65 Group g = new Group();
66 for (int i = 0; i < 5; i++) {
67 Rectangle r = new Rectangle();
68 r.setY(i * 20);
69 r.setWidth(100);
70 r.setHeight(10);
71 r.setFill(Color.RED);
72 g.getChildren().add(r);
73 }
74 </PRE>
75 * @since JavaFX 2.0
214 layout();
215 }
216 final double result = getLayoutBounds().getHeight();
217 return Double.isNaN(result) || result < 0 ? 0 : result;
218 }
219
220
221 @Override
222 public double minHeight(double width) {
223 return prefHeight(width);
224 }
225
226 @Override
227 public double minWidth(double height) {
228 return prefWidth(height);
229 }
230
231 /**
232 * Group implements layoutChildren such that each child is resized to its preferred
233 * size, if the child is resizable. Non-resizable children are simply left alone.
234 * If {@link #autoSizeChildren} is false, then Group does nothing in this method.
235 */
236 @Override protected void layoutChildren() {
237 if (isAutoSizeChildren()) {
238 super.layoutChildren();
239 }
240 }
241 }
|
33 import javafx.geometry.Bounds;
34 import java.util.Collection;
35
36
37
38 /**
39 * A {@code Group} node contains an ObservableList of children that
40 * are rendered in order whenever this node is rendered.
41 * <p>
42 * A {@code Group} will take on the collective bounds of its children and is
43 * not directly resizable.
44 * <p>
45 * Any transform, effect, or state applied to a {@code Group} will be applied
46 * to all children of that group. Such transforms and effects will NOT be included
47 * in this Group's layout bounds, however if transforms and effects are set
48 * directly on children of this Group, those will be included in this Group's layout bounds.
49 * <p>
50 * By default, a {@code Group} will "auto-size" its managed resizable
51 * children to their preferred sizes during the layout pass to ensure that Regions
52 * and Controls are sized properly as their state changes. If an application
53 * needs to disable this auto-sizing behavior, then it should set
54 * {@link #autoSizeChildrenProperty() autoSizeChildren} to {@code false} and understand that if the preferred size of
55 * the children change, they will not automatically resize (so buyer beware!).
56 *
57 * <p>Group Example:</p>
58 *
59 <PRE>
60 import javafx.scene.*;
61 import javafx.scene.paint.*;
62 import javafx.scene.shape.*;
63 import java.lang.Math;
64
65 Group g = new Group();
66 for (int i = 0; i < 5; i++) {
67 Rectangle r = new Rectangle();
68 r.setY(i * 20);
69 r.setWidth(100);
70 r.setHeight(10);
71 r.setFill(Color.RED);
72 g.getChildren().add(r);
73 }
74 </PRE>
75 * @since JavaFX 2.0
214 layout();
215 }
216 final double result = getLayoutBounds().getHeight();
217 return Double.isNaN(result) || result < 0 ? 0 : result;
218 }
219
220
221 @Override
222 public double minHeight(double width) {
223 return prefHeight(width);
224 }
225
226 @Override
227 public double minWidth(double height) {
228 return prefWidth(height);
229 }
230
231 /**
232 * Group implements layoutChildren such that each child is resized to its preferred
233 * size, if the child is resizable. Non-resizable children are simply left alone.
234 * If {@link #autoSizeChildrenProperty() autoSizeChildren} is false, then Group does nothing in this method.
235 */
236 @Override protected void layoutChildren() {
237 if (isAutoSizeChildren()) {
238 super.layoutChildren();
239 }
240 }
241 }
|