< prev index next >
modules/graphics/src/test/java/test/javafx/scene/layout/MockResizable.java
Print this page
*** 29,50 ****
--- 29,71 ----
import javafx.geometry.Bounds;
import javafx.scene.Parent;
import com.sun.javafx.scene.DirtyBits;
import com.sun.javafx.scene.NodeHelper;
+ import javafx.scene.Node;
+ import test.com.sun.javafx.scene.layout.MockResizableHelper;
public class MockResizable extends Parent {
+ static {
+ // This is used by classes in different packages to get access to
+ // private and package private methods.
+ MockResizableHelper.setMockResizableAccessor(new MockResizableHelper.MockResizableAccessor() {
+ @Override
+ public Bounds doComputeLayoutBounds(Node node) {
+ return ((MockResizable) node).doComputeLayoutBounds();
+ }
+ @Override
+ public void doNotifyLayoutBoundsChanged(Node node) {
+ ((MockResizable) node).doNotifyLayoutBoundsChanged();
+ }
+ });
+ }
+
private double minWidth = 0;
private double minHeight = 0;
private double prefWidth;
private double prefHeight;
private double maxWidth = 5000;
private double maxHeight = 5000;
private double width;
private double height;
+ {
+ // To initialize the class helper at the begining each constructor of this class
+ MockResizableHelper.initHelper(this);
+ }
public MockResizable(double prefWidth, double prefHeight) {
this.prefWidth = prefWidth;
this.prefHeight = prefHeight;
}
public MockResizable(double minWidth, double minHeight, double prefWidth, double prefHeight, double maxWidth, double maxHeight) {
*** 65,94 ****
return height;
}
@Override public void resize(double width, double height) {
this.width = width;
this.height = height;
! impl_layoutBoundsChanged();
! impl_geomChanged();
NodeHelper.markDirty(this, DirtyBits.NODE_GEOMETRY);
requestLayout();
}
@Override public double getBaselineOffset() {
return Math.max(0, prefHeight - 10);
}
! /**
! * The layout bounds of this region: {@code 0, 0 width x height}
! */
! @Override protected Bounds impl_computeLayoutBounds() {
return new BoundingBox(0, 0, 0, width, height, 0);
}
! /**
! * @treatAsPrivate implementation detail
! * @deprecated This is an internal API that is not intended for use and will be removed in the next version
! */
! @Deprecated
! @Override protected void impl_notifyLayoutBoundsChanged() {
// change in geometric bounds does not necessarily change layoutBounds
}
@Override public double minWidth(double height) {
return minWidth;
}
--- 86,109 ----
return height;
}
@Override public void resize(double width, double height) {
this.width = width;
this.height = height;
! NodeHelper.layoutBoundsChanged(this);
! NodeHelper.geomChanged(this);
NodeHelper.markDirty(this, DirtyBits.NODE_GEOMETRY);
requestLayout();
}
@Override public double getBaselineOffset() {
return Math.max(0, prefHeight - 10);
}
!
! private Bounds doComputeLayoutBounds() {
return new BoundingBox(0, 0, 0, width, height, 0);
}
!
! private void doNotifyLayoutBoundsChanged() {
// change in geometric bounds does not necessarily change layoutBounds
}
@Override public double minWidth(double height) {
return minWidth;
}
< prev index next >