private void onShownHandler(WindowEvent windowEvent) { dialogStage.sizeToScene(); Window parent = dialogStage.getOwner(); dialogStage.setX(parent.getX() + parent.getWidth() / 2 - dialogStage.getWidth() / 2); dialogStage.setY(parent.getY() + parent.getHeight() / 2 - dialogStage.getHeight() / 2); dialogStage.requestFocus(); }
/* */ public WCRectangle getViewBounds() /* */ { /* 71 */ WebView localWebView = this.accessor.getView(); /* 72 */ Window localWindow = null; /* 73 */ if ((localWebView != null) && (localWebView.getScene() != null) && ((localWindow = localWebView.getScene().getWindow()) != null)) /* */ { /* 77 */ return new WCRectangle( (float) localWindow.getX(), (float) localWindow.getY(), (float) localWindow.getWidth(), (float) localWindow.getHeight()); /* */ } /* */ /* 81 */ return null; /* */ }
/** * Show this popup right below the given Node * * @param node */ public void show(Node node) { if (node.getScene() == null || node.getScene().getWindow() == null) throw new IllegalStateException( "Can not show popup. The node must be attached to a scene/window."); //$NON-NLS-1$ if (isShowing()) { return; } Window parent = node.getScene().getWindow(); this.show( parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + TITLE_HEIGHT); }
/* */ public WCPoint windowToScreen(WCPoint paramWCPoint) /* */ { /* 125 */ WebView localWebView = this.accessor.getView(); /* 126 */ Scene localScene = localWebView.getScene(); /* 127 */ Window localWindow = null; /* */ /* 129 */ if ((localScene != null) && ((localWindow = localScene.getWindow()) != null)) /* */ { /* 132 */ Point2D localPoint2D = localWebView.localToScene(paramWCPoint.getX(), paramWCPoint.getY()); /* 133 */ return new WCPoint( (float) (localPoint2D.getX() + localScene.getX() + localWindow.getX()), (float) (localPoint2D.getY() + localScene.getY() + localWindow.getY())); /* */ } /* */ /* 136 */ return new WCPoint(0.0F, 0.0F); /* */ }
/* */ public WCPoint screenToWindow(WCPoint paramWCPoint) { /* 108 */ WebView localWebView = this.accessor.getView(); /* 109 */ Scene localScene = localWebView.getScene(); /* 110 */ Window localWindow = null; /* */ /* 112 */ if ((localScene != null) && ((localWindow = localScene.getWindow()) != null)) /* */ { /* 115 */ Point2D localPoint2D = localWebView.sceneToLocal( paramWCPoint.getX() - localWindow.getX() - localScene.getX(), paramWCPoint.getY() - localWindow.getY() - localScene.getY()); /* */ /* 118 */ return new WCPoint((float) localPoint2D.getX(), (float) localPoint2D.getY()); /* */ } /* 120 */ return new WCPoint(0.0F, 0.0F); /* */ }
/** Bounds of Window on Screen. */ public static Bounds bounds(Window window) { return bounds(window.getX(), window.getY(), window.getWidth(), window.getHeight()); }