Package com.iizix.prop.ui.device
Class GSimpleDevice
java.lang.Object
com.iizix.prop.ui.device.GSimpleDevice
Class for a simple panel device, i.e. without orientation, device pixel ratio, etc.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final GSimpleDevice
The browser device has size 0.static final GSimpleDevice
The iPad device in landscape mode.static final GSimpleDevice
The iPad device in portrait mode.static final GSimpleDevice
The iPhone 5 device (or iPhone SE) in landscape mode.static final GSimpleDevice
The iPhone 5 device (or iPhone SE) in portrait mode.static final GSimpleDevice
The panel part has the size of the panel part container.Constructor Summary
ConstructorDescriptionGSimpleDevice
(ReadTransaction trans) Constructs the device from a transaction.GSimpleDevice
(String string) Creates from a string representation "width={integer},height={integer},canChangeOrientation={boolean},name".GSimpleDevice
(String name, int pixelX, int pixelY) Constructs the device.GSimpleDevice
(String name, int pixelX, int pixelY, boolean canChangeOrientation) Constructs the device.Method Summary
Modifier and TypeMethodDescriptionvoid
append
(SendTransaction trans) Appends the device to a transaction.boolean
Checks if orientation can be changed.Creates a new simple device with changed orientation type (portrait/landscape).The data string representation.boolean
Compares two devices.boolean
Compares two devices without caring about orientation.int
Gets the height.getName()
Gets the name of the device.int
getWidth()
Gets the width.int
hashCode()
The hash code.boolean
Checks if the device is the browser device.boolean
Gets the orientation.boolean
Checks if the device is for a panel part.boolean
Gets the orientation.toString()
Returns a string representation of this class instance and its values.
Field Details
BROWSER
The browser device has size 0.PANEL_PART
The panel part has the size of the panel part container.IPHONE5_LANDSCAPE
The iPhone 5 device (or iPhone SE) in landscape mode.IPHONE5_PORTRAIT
The iPhone 5 device (or iPhone SE) in portrait mode.IPAD_LANDSCAPE
The iPad device in landscape mode.IPAD_PORTRAIT
The iPad device in portrait mode.
Constructor Details
GSimpleDevice
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
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
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
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
Appends the device to a transaction.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
Compares two devices.hashCode
public int hashCode()The hash code.equalsNoOrientation
Compares two devices without caring about orientation.- Parameters:
d
- The device to compare with.- Returns:
- true if equal.
dataToString
The data string representation.toString
Returns a string representation of this class instance and its values.canChangeOrientation
public boolean canChangeOrientation()Checks if orientation can be changed.- Returns:
- Some devices do not support orientation changes, e.g. a TV.
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.