Class GraphicsDevice

java.lang.Object
vaadinx.awt.GraphicsDevice

public final class GraphicsDevice extends Object
Import-swap target for GraphicsDevice — the browser viewport as the one screen a migrated app has (D_graphics_environment). Obtained from the environment, and the usual reason to hold one is its display mode:
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int w = gd.getDisplayMode().getWidth();     // viewport width
gd.setFullScreenWindow(frame);              // windowed-mode fallback: fills the viewport

Full-screen exclusive mode is unsupported, exactly as on a JDK device with no exclusive-mode capability — isFullScreenSupported() is false, and setFullScreenWindow(Window) therefore takes the JDK's windowed-mode path: it resizes the window to the viewport, shows it and raises it, restoring the previous bounds when full-screen is later released. That is a working effect, not a stub, so no WARN is logged.

Like Toolkit this does not extend the abstract JDK class, so setFullScreenWindow(Window) takes a vaadinx.awt.Window (R_no_vaadin_in_api limb 1). One instance; a browser has one viewport.

The full-screen window is held per UI, which is this runtime's analogue of the JDK's per-AppContext scoping: two browser tabs are two screens, and neither may see the other's full-screen window.

  • Field Details

  • Method Details

    • getType

      public int getType()
    • getIDstring

      public String getIDstring()
    • getConfigurations

      public GraphicsConfiguration[] getConfigurations()
    • getDefaultConfiguration

      public GraphicsConfiguration getDefaultConfiguration()
    • getBestConfiguration

      public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct)
      Parameters:
      gct - ignored — with a single configuration to choose from, the best match is it
    • isFullScreenSupported

      public boolean isFullScreenSupported()
    • setFullScreenWindow

      public void setFullScreenWindow(Window w)
      Enters the JDK's windowed-mode emulation of full screen for w, or leaves it when w is null — restoring the bounds the window had on entry.
      Parameters:
      w - the window to fill the viewport with, or null to release
    • getFullScreenWindow

      public Window getFullScreenWindow()
      Returns:
      this UI's full-screen window, or null if it has none
    • isDisplayChangeSupported

      public boolean isDisplayChangeSupported()
    • setDisplayMode

      public void setDisplayMode(DisplayMode dm)
      Throws:
      UnsupportedOperationException - always — the browser viewport's size is the user's to change, matching a JDK device that cannot change display mode
    • getDisplayMode

      public DisplayMode getDisplayMode()
      Returns:
      the viewport extents, at the default colour model's depth and unknown refresh rate
    • getDisplayModes

      public DisplayMode[] getDisplayModes()
    • getAvailableAcceleratedMemory

      public int getAvailableAcceleratedMemory()
      Returns:
      always -1, the JDK's "unknown" — there is no accelerated surface to measure
    • isWindowTranslucencySupported

      public boolean isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency translucencyKind)
      Returns:
      always false — Window.setShape(Shape) and Window.setOpacity(float) have no browser counterpart, so no translucency kind is deliverable