modules/graphics/src/test/java/test/com/sun/javafx/pgstub/StubStage.java

Print this page




  55     @Override
  56     public void setScene(TKScene scene) {
  57         if (scene != null) {
  58             StubScene s = (StubScene) scene;
  59             s.stage = this;
  60             notificationSender.setScene(s);
  61             if (visible && width != -1 && height != -1)
  62                 s.getListener().changedSize(width, height);
  63         }
  64     }
  65 
  66     public int numTimesSetSizeAndLocation;
  67 
  68     // Platform place/resize the window with some
  69     // "default" value. Pretending that the values
  70     // below are those platform defaults.
  71     public float x = 16;
  72     public float y = 12;
  73     public float width = 256;
  74     public float height = 192;


  75 
  76     public boolean visible;
  77     public float opacity;
  78 
  79     @Override
  80     public void setBounds(float x, float y, boolean xSet, boolean ySet,
  81                           float width, float height,
  82                           float contentWidth, float contentHeight,
  83                           float xGravity, float yGravity)

  84     {
  85         numTimesSetSizeAndLocation++;
  86 
  87         boolean locationChanged = false;
  88 
  89         if (xSet && (this.x != x)) {
  90             this.x = x;
  91             locationChanged = true;
  92         }
  93 
  94         if (ySet && (this.y != y)) {
  95             this.y = y;
  96             locationChanged = true;
  97         }
  98 
  99         if (locationChanged) {
 100             notificationSender.changedLocation(x, y);
 101         }
 102 
 103         boolean sizeChanged = false;


 112                 this.width = contentWidth;
 113                 sizeChanged = true;
 114             }
 115         }
 116 
 117         if (height > 0) {
 118             if (this.height != height) {
 119                 this.height = height;
 120                 sizeChanged = true;
 121             }
 122         } else if (contentHeight > 0) {
 123             if (this.height != contentHeight) {
 124                 this.height = contentHeight;
 125                 sizeChanged = true;
 126             }
 127         }
 128 
 129         if (sizeChanged) {
 130             notificationSender.changedSize(width, height);
 131         }


 132     }
 133 
 134     @Override
 135     public float getUIScale() {
 136         return 1.0f;
 137     }
 138 
 139     @Override
 140     public float getRenderScale() {










 141         return 1.0f;
 142     }
 143 
 144     // Just a helper method
 145     public void setSize(float w, float h) {
 146         setBounds(0, 0, false, false, w, h, 0, 0, 0, 0);
 147     }
 148 
 149     // Just a helper method
 150     public void setLocation(float x, float y) {
 151         setBounds(x, y, true, true, 0, 0, 0, 0, 0, 0);
 152     }
 153 
 154     @Override
 155     public void setIcons(List icons) {
 156     }
 157 
 158     @Override
 159     public void setTitle(String title) {
 160     }
 161 
 162     @Override
 163     public void setVisible(boolean visible) {
 164         this.visible = visible;
 165 
 166         if (!visible) {
 167             notificationSender.changedFocused(false, FocusCause.DEACTIVATED);
 168         }
 169 
 170         notificationSender.changedLocation(x, y);
 171         notificationSender.changedSize(width, height);


 313         private void releaseSingleNotification() {
 314             queue.poll().execute(listener);
 315         }
 316 
 317         @Override
 318         public void changedLocation(final float x, final float y) {
 319             process(listener1 -> listener1.changedLocation(x, y));
 320         }
 321 
 322         @Override
 323         public void changedSize(final float width, final float height) {
 324             process(listener1 -> {
 325                 listener1.changedSize(width, height);
 326                 if (scene != null && width != -1 && height != -1) {
 327                     scene.getListener().changedSize(width, height);
 328                 }
 329             });
 330         }
 331 
 332         @Override





 333         public void changedFocused(final boolean focused,
 334                                    final FocusCause cause) {
 335             process(listener1 -> listener1.changedFocused(focused, cause));
 336         }
 337 
 338         @Override
 339         public void changedIconified(final boolean iconified) {
 340             process(listener1 -> listener1.changedIconified(iconified));
 341         }
 342 
 343         @Override
 344         public void changedMaximized(final boolean maximized) {
 345             process(listener1 -> listener1.changedMaximized(maximized));
 346         }
 347 

 348         public void changedAlwaysOnTop(boolean alwaysOnTop) {
 349             process(listener1 -> listener1.changedAlwaysOnTop(alwaysOnTop));
 350         }
 351 
 352 
 353         @Override
 354         public void changedResizable(final boolean resizable) {
 355             process(listener1 -> listener1.changedResizable(resizable));
 356         }
 357 
 358         @Override
 359         public void changedFullscreen(final boolean fs) {
 360             process(listener1 -> listener1.changedFullscreen(fs));
 361         }
 362 
 363         @Override
 364         public void closing() {
 365             process(listener1 -> listener1.closing());
 366         }
 367 


 396             while (nextNotification != null) {
 397                 nextNotification.execute(listener);
 398                 nextNotification = queue.poll();
 399             }
 400         }
 401 
 402         /**
 403         * Initialize accessibility
 404         */
 405         public void initAccessibleTKStageListener() {
 406             // TODO: Add code later
 407         }
 408 
 409         @Override
 410         public void changedScreen(Object from, Object to) {
 411             // TODO: Add code later
 412         }
 413 
 414     }
 415 

 416     public void setRTL(boolean b) {
 417     }
 418 }


  55     @Override
  56     public void setScene(TKScene scene) {
  57         if (scene != null) {
  58             StubScene s = (StubScene) scene;
  59             s.stage = this;
  60             notificationSender.setScene(s);
  61             if (visible && width != -1 && height != -1)
  62                 s.getListener().changedSize(width, height);
  63         }
  64     }
  65 
  66     public int numTimesSetSizeAndLocation;
  67 
  68     // Platform place/resize the window with some
  69     // "default" value. Pretending that the values
  70     // below are those platform defaults.
  71     public float x = 16;
  72     public float y = 12;
  73     public float width = 256;
  74     public float height = 192;
  75     public float renderScaleX = 1.0f;
  76     public float renderScaleY = 1.0f;
  77 
  78     public boolean visible;
  79     public float opacity;
  80 
  81     @Override
  82     public void setBounds(float x, float y, boolean xSet, boolean ySet,
  83                           float width, float height,
  84                           float contentWidth, float contentHeight,
  85                           float xGravity, float yGravity,
  86                           float renderScaleX, float renderScaleY)
  87     {
  88         numTimesSetSizeAndLocation++;
  89 
  90         boolean locationChanged = false;
  91 
  92         if (xSet && (this.x != x)) {
  93             this.x = x;
  94             locationChanged = true;
  95         }
  96 
  97         if (ySet && (this.y != y)) {
  98             this.y = y;
  99             locationChanged = true;
 100         }
 101 
 102         if (locationChanged) {
 103             notificationSender.changedLocation(x, y);
 104         }
 105 
 106         boolean sizeChanged = false;


 115                 this.width = contentWidth;
 116                 sizeChanged = true;
 117             }
 118         }
 119 
 120         if (height > 0) {
 121             if (this.height != height) {
 122                 this.height = height;
 123                 sizeChanged = true;
 124             }
 125         } else if (contentHeight > 0) {
 126             if (this.height != contentHeight) {
 127                 this.height = contentHeight;
 128                 sizeChanged = true;
 129             }
 130         }
 131 
 132         if (sizeChanged) {
 133             notificationSender.changedSize(width, height);
 134         }
 135         if (renderScaleX > 0.0) this.renderScaleX = renderScaleX;
 136         if (renderScaleY > 0.0) this.renderScaleY = renderScaleY;
 137     }
 138 
 139     @Override
 140     public float getPlatformScaleX() {
 141         return 1.0f;
 142     }
 143 
 144     @Override
 145     public float getPlatformScaleY() {
 146         return 1.0f;
 147     }
 148 
 149     @Override
 150     public float getOutputScaleX() {
 151         return 1.0f;
 152     }
 153 
 154     @Override
 155     public float getOutputScaleY() {
 156         return 1.0f;
 157     }
 158 
 159     // Just a helper method
 160     public void setSize(float w, float h) {
 161         setBounds(0, 0, false, false, w, h, 0, 0, 0, 0, 0, 0);
 162     }
 163 
 164     // Just a helper method
 165     public void setLocation(float x, float y) {
 166         setBounds(x, y, true, true, 0, 0, 0, 0, 0, 0, 0, 0);
 167     }
 168 
 169     @Override
 170     public void setIcons(List icons) {
 171     }
 172 
 173     @Override
 174     public void setTitle(String title) {
 175     }
 176 
 177     @Override
 178     public void setVisible(boolean visible) {
 179         this.visible = visible;
 180 
 181         if (!visible) {
 182             notificationSender.changedFocused(false, FocusCause.DEACTIVATED);
 183         }
 184 
 185         notificationSender.changedLocation(x, y);
 186         notificationSender.changedSize(width, height);


 328         private void releaseSingleNotification() {
 329             queue.poll().execute(listener);
 330         }
 331 
 332         @Override
 333         public void changedLocation(final float x, final float y) {
 334             process(listener1 -> listener1.changedLocation(x, y));
 335         }
 336 
 337         @Override
 338         public void changedSize(final float width, final float height) {
 339             process(listener1 -> {
 340                 listener1.changedSize(width, height);
 341                 if (scene != null && width != -1 && height != -1) {
 342                     scene.getListener().changedSize(width, height);
 343                 }
 344             });
 345         }
 346 
 347         @Override
 348         public void changedScale(float xScale, float yScale) {
 349             process(listener1 -> listener1.changedScale(xScale, yScale));
 350         }
 351 
 352         @Override
 353         public void changedFocused(final boolean focused,
 354                                    final FocusCause cause) {
 355             process(listener1 -> listener1.changedFocused(focused, cause));
 356         }
 357 
 358         @Override
 359         public void changedIconified(final boolean iconified) {
 360             process(listener1 -> listener1.changedIconified(iconified));
 361         }
 362 
 363         @Override
 364         public void changedMaximized(final boolean maximized) {
 365             process(listener1 -> listener1.changedMaximized(maximized));
 366         }
 367 
 368         @Override
 369         public void changedAlwaysOnTop(boolean alwaysOnTop) {
 370             process(listener1 -> listener1.changedAlwaysOnTop(alwaysOnTop));
 371         }
 372 
 373 
 374         @Override
 375         public void changedResizable(final boolean resizable) {
 376             process(listener1 -> listener1.changedResizable(resizable));
 377         }
 378 
 379         @Override
 380         public void changedFullscreen(final boolean fs) {
 381             process(listener1 -> listener1.changedFullscreen(fs));
 382         }
 383 
 384         @Override
 385         public void closing() {
 386             process(listener1 -> listener1.closing());
 387         }
 388 


 417             while (nextNotification != null) {
 418                 nextNotification.execute(listener);
 419                 nextNotification = queue.poll();
 420             }
 421         }
 422 
 423         /**
 424         * Initialize accessibility
 425         */
 426         public void initAccessibleTKStageListener() {
 427             // TODO: Add code later
 428         }
 429 
 430         @Override
 431         public void changedScreen(Object from, Object to) {
 432             // TODO: Add code later
 433         }
 434 
 435     }
 436 
 437     @Override
 438     public void setRTL(boolean b) {
 439     }
 440 }