Class CastQRWindow

java.lang.Object
com.iizigo.panel.CastQRWindow

public class CastQRWindow extends Object
The window of "Show QR code for iiziRun Developer" (the Panel Editor's Cast to Device drop-down): a chooser of this computer's addresses, named by interface, and ONE QR code for the address chosen (QL-D-2), the link as selectable text under it, and a line saying what to do on the phone. The addresses, the port and the link come from CastLink. The window is not modal: the Designer stays usable while the phone scans, and the device appears in the drop-down once it has connected. One window is open at a time; opening it again replaces it.

The texts are in PanelEditor.properties, keys castQR.*.

Author:
Christopher Mindus
  • Method Details

    • open

      public static CastQRWindow open(Shell parent)
      Opens the window for this computer: the addresses by CastLink.offerOfThisComputer(), the port the web server holds. Returns at once (the window is not modal).
      Parameters:
      parent - The parent shell.
      Returns:
      The window.
    • open

      public static CastQRWindow open(Shell parent, List<CastLink.Address> addresses, int port)
      Opens the window for given addresses and port. Returns at once (the window is not modal); a window already open is closed first.
      Parameters:
      parent - The parent shell.
      addresses - The addresses to offer, the first one chosen.
      port - The HTTP port, 0 when the web server is not running.
      Returns:
      The window.
    • getCurrent

      public static CastQRWindow getCurrent()
      Gets the window that is open.
      Returns:
      The window, null for none.
    • getShell

      public Shell getShell()
      Gets the shell.
      Returns:
      The shell.
    • getAddresses

      public List<CastLink.Address> getAddresses()
      Gets the addresses offered, in the order of the chooser.
      Returns:
      The unmodifiable list.
    • getChooserItems

      public String[] getChooserItems()
      Gets the texts of the chooser.
      Returns:
      The items.
    • choose

      public void choose(int index)
      Chooses an address, as a user does in the chooser.
      Parameters:
      index - The index in the chooser.
    • getLink

      public String getLink()
      Gets the link of the address chosen.
      Returns:
      The link, null when there is none (no address, or the web server is not running).
    • getLinkText

      public String getLinkText()
      Gets the link text shown.
      Returns:
      The text, empty when there is no link.
    • getCodeImageData

      public ImageData getCodeImageData()
      Gets the QR code shown at 100 % zoom.
      Returns:
      The image data, null when no code is shown.
    • getCodeText

      public String getCodeText()
      Gets the text shown in place of the code.
      Returns:
      The text, empty when a code is shown.
    • toImageData

      public static ImageData toImageData(BufferedImage image)
      Converts an image to SWT image data, 24 bits per pixel.
      Parameters:
      image - The image.
      Returns:
      The image data.