Class GSimpleDevice

java.lang.Object
com.iizix.prop.ui.device.GSimpleDevice

public class GSimpleDevice extends Object
Class for a simple panel device, i.e. without orientation, device pixel ratio, etc.
Author:
Christopher Mindus
  • Field Details

    • BROWSER

      public static final GSimpleDevice BROWSER
      The browser device has size 0.
    • PANEL_PART

      public static final GSimpleDevice PANEL_PART
      The panel part has the size of the panel part container.
    • IPHONE5_LANDSCAPE

      public static final GSimpleDevice IPHONE5_LANDSCAPE
      The iPhone 5 device (or iPhone SE) in landscape mode.
    • IPHONE5_PORTRAIT

      public static final GSimpleDevice IPHONE5_PORTRAIT
      The iPhone 5 device (or iPhone SE) in portrait mode.
    • IPAD_LANDSCAPE

      public static final GSimpleDevice IPAD_LANDSCAPE
      The iPad device in landscape mode.
    • IPAD_PORTRAIT

      public static final GSimpleDevice IPAD_PORTRAIT
      The iPad device in portrait mode.
  • Constructor Details

    • GSimpleDevice

      public GSimpleDevice(String name, int pixelX, int pixelY)
      Constructs the device.
      Parameters:
      name - The device name.
      pixelX - The pixel size in X.
      pixelY - The pixel size in Y.
      Throws:
      NullPointerException - If the name is null.
      IllegalArgumentException - For illegal definitions.
    • GSimpleDevice

      public GSimpleDevice(String name, int pixelX, int pixelY, boolean canChangeOrientation)
      Constructs the device.
      Parameters:
      name - The device name.
      pixelX - The pixel size in X.
      pixelY - The pixel size in Y.
      Throws:
      NullPointerException - If the name is null.
      IllegalArgumentException - For illegal definitions.
    • GSimpleDevice

      public GSimpleDevice(String string)
      Creates from a string representation "width={integer},height={integer},canChangeOrientation={boolean},name".
      Parameters:
      string - The string.
      Throws:
      IllegalArgumentException - For illegal definitions.
      NumberFormatException - For value errors.
      NoSuchElementException - For format errors.
    • GSimpleDevice

      public GSimpleDevice(ReadTransaction trans)
      Constructs the device from a transaction.
  • Method Details

    • isBrowser

      public boolean isBrowser()
      Checks if the device is the browser device.
    • isPanelPart

      public boolean isPanelPart()
      Checks if the device is for a panel part.
    • append

      public void append(SendTransaction trans)
      Appends the device to a transaction.
    • getName

      public String getName()
      Gets the name of the device.
    • isPortrait

      public boolean isPortrait()
      Gets the orientation.
      Returns:
      true if it's portrait sized.
    • isLandscape

      public boolean isLandscape()
      Gets the orientation.
      Returns:
      true if it's landscape sized.
    • getWidth

      public int getWidth()
      Gets the width.
      Returns:
      A value for pixels in HTML.
    • getHeight

      public int getHeight()
      Gets the height.
      Returns:
      A value for pixels in HTML.
    • equals

      public boolean equals(Object o)
      Compares two devices.
      Overrides:
      equals in class Object
      Parameters:
      o - The device to compare with.
      Returns:
      true if equal.
    • hashCode

      public int hashCode()
      The hash code.
      Overrides:
      hashCode in class Object
    • equalsNoOrientation

      public boolean equalsNoOrientation(GSimpleDevice d)
      Compares two devices without caring about orientation.
      Parameters:
      d - The device to compare with.
      Returns:
      true if equal.
    • dataToString

      public String dataToString()
      The data string representation.
    • toString

      public String toString()
      Returns a string representation of this class instance and its values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this class instance.
    • canChangeOrientation

      public boolean canChangeOrientation()
      Checks if orientation can be changed.
      Returns:
      Some devices do not support orientation changes, e.g. a TV.
    • changeOrientation

      public GSimpleDevice changeOrientation()
      Creates a new simple device with changed orientation type (portrait/landscape).
      Returns:
      The new simple device if not same width and height, otherwise it's the same instance.