Package com.iizix.prop.ui.device
Class GThemes
- java.lang.Object
- com.iizix.prop.ui.device.GThemes
 
- All Implemented Interfaces:
- java.lang.Cloneable
 - public class GThemes extends java.lang.Object implements java.lang.CloneableThis is a data holder class for UI themes, specifying UI type (desktop/mobile) and the themes that are selected or possible.- Author:
- Christopher Mindus
 
- Field Summary- Fields - Modifier and Type - Field - Description - static int- ANYThe type: ANY.- static GThemes- ANY_MASKThe "ANY_MASK" themes mask, could replace a mask with "null" value (note: not the same- NONE).- static GThemes- DEFAULT_DESKTOPThe default theme selection for desktop, i.e.- static GThemes- DEFAULT_MASKThe default theme selection: allow all, both desktop and mobile.- static GThemes- DEFAULT_MOBILEThe default theme selection for mobile, all default desktop theme and all mobile themes.- static GThemes- DEFAULT_STARTUPThe default start-up theme for the app: Flat and iOS7+.- static int- DESKTOPThe type: DESKTOP.- static GThemes- DESKTOP_MASKThe default theme selection for any desktop theme and no mobile themes.- static int- MOBILEThe type: MOBILE.- static GThemes- MOBILE_MASKThe default theme selection for any mobile theme and no desktop themes.- static GThemes- NONEThe "NONE" themes mask when intersection is too narrow.
 - Constructor Summary- Constructors - Constructor - Description - GThemes(int type, UIThemes.Name[] desktop, UIThemes.Name[] mobile)Creates a new instance of themes.
 - Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - void- append(SendTransaction trans)Appends the themes to a transaction.- GThemes- computeIntersection(GThemes mask)Computes the "intersection" of this mask and another one.- boolean- contains(UIThemes.Name name)Checks if the theme name is contained in this theme instances mask.- java.lang.String- dataToString()The data string representation.- boolean- equals(java.lang.Object o)Checks if two color objects are equal.- static GThemes- from(int type, UIThemes.Name[] desktop, UIThemes.Name[] mobile)Creates a new instance of themes or grabs a cached copy.- static GThemes- from(ReadTransaction trans)Creates a color from a transaction.- static GThemes- from(java.lang.String string)Creates an instance of the themes from a string.- static GThemes- fromDesktop(UIThemes.Name name)Gets a cached desktop theme from a name using with no mobile themes.- static GThemes- fromMobile(UIThemes.Name name)Gets a cached mobile theme from a name using the default desktop name.- UIThemes.Name[]- getDesktopThemes()Gets the desktop themes.- UIThemes.Name[]- getMobileThemes()Gets the mobile themes.- boolean- isDesktop()Checks if this theme is for desktop.- boolean- isMobile()Checks if this theme is for mobile.- boolean- isNullMask()Returns if this mask is a "null" mask, or a NONE mask.- java.lang.String- toClientThemesString()Returns the representation of the theme for the client to use.- java.lang.String- toString()Returns a string representation of this class instance and its values.- java.lang.String- verify(GThemes mask)Verifies if the current theme is not "masked away" from its initial intents.
 
- Field Detail- ANY- public static final int ANY The type: ANY.- See Also:
- Constant Field Values
 
 - DESKTOP- public static final int DESKTOP The type: DESKTOP.- See Also:
- Constant Field Values
 
 - MOBILE- public static final int MOBILE The type: MOBILE.- See Also:
- Constant Field Values
 
 - NONE- public static final GThemes NONE The "NONE" themes mask when intersection is too narrow.
 - DEFAULT_DESKTOP- public static final GThemes DEFAULT_DESKTOP The default theme selection for desktop, i.e. Flat, Bootstrap and Claro.
 - DEFAULT_MOBILE- public static final GThemes DEFAULT_MOBILE The default theme selection for mobile, all default desktop theme and all mobile themes.
 - DEFAULT_MASK- public static final GThemes DEFAULT_MASK The default theme selection: allow all, both desktop and mobile.
 - MOBILE_MASK- public static final GThemes MOBILE_MASK The default theme selection for any mobile theme and no desktop themes.
 - DESKTOP_MASK- public static final GThemes DESKTOP_MASK The default theme selection for any desktop theme and no mobile themes.
 - DEFAULT_STARTUP- public static final GThemes DEFAULT_STARTUP The default start-up theme for the app: Flat and iOS7+.
 
 - Constructor Detail- GThemes- public GThemes(int type, UIThemes.Name[] desktop, UIThemes.Name[] mobile)Creates a new instance of themes.- Parameters:
- type- The theme type: ANY=-1 for any, DESKTOP=0, MOBILE=1.
- desktop- The array of themes for desktop, or null for any.
- mobile- The array of themes for mobile, or null for any.
- Throws:
- java.lang.IllegalArgumentException- If type is not ANY, DESKTOP or MOBILE, or if the theme names are invalid for the type.
- java.lang.NullPointerException- If any theme instance in the array is- null.
 
 
 - Method Detail- from- public static GThemes from(int type, UIThemes.Name[] desktop, UIThemes.Name[] mobile) Creates a new instance of themes or grabs a cached copy.- Parameters:
- type- The theme type: ANY=-1 for any, DESKTOP=0, MOBILE=1.
- desktop- The array of themes for desktop, or null for any.
- mobile- The array of themes for mobile, or null for any.
- Returns:
- A cached instance of GThemes. The instance might be just newly created.
- Throws:
- java.lang.IllegalArgumentException- If type is not ANY, DESKTOP or MOBILE, or if the theme names are invalid for the type.
- java.lang.NullPointerException- If any theme instance in the array is- null.
 
 - from- public static GThemes from(java.lang.String string) Creates an instance of the themes from a string.- The format of the string must be the same as the one returned in - dataToString().- Parameters:
- string- The string.
- Throws:
- java.lang.IllegalArgumentException- If the string type or theme name is wrong.
- java.util.NoSuchElementException- If there are no more tokens in this tokenizer's string.
 
 - from- public static GThemes from(ReadTransaction trans) Creates a color from a transaction.- Parameters:
- trans- The transaction.
- Throws:
- java.lang.IllegalArgumentException- If there is a Transaction error.
 
 - fromMobile- public static GThemes fromMobile(UIThemes.Name name) Gets a cached mobile theme from a name using the default desktop name.- Parameters:
- name- The name.
- Returns:
- A cached instance for the theme for the name.
- Throws:
- java.lang.IllegalArgumentException- If the name is not of mobile type.
 
 - fromDesktop- public static GThemes fromDesktop(UIThemes.Name name) Gets a cached desktop theme from a name using with no mobile themes.- Parameters:
- name- The name.
- Returns:
- A cached instance for the theme for the name.
- Throws:
- java.lang.IllegalArgumentException- If the name is not of desktop type.
 
 - append- public void append(SendTransaction trans) Appends the themes to a transaction.
 - equals- public boolean equals(java.lang.Object o) Checks if two color objects are equal.- Overrides:
- equalsin class- java.lang.Object
 
 - isDesktop- public boolean isDesktop() Checks if this theme is for desktop. The theme can be mobile also.
 - isMobile- public boolean isMobile() Checks if this theme is for mobile. The theme can be for desktop also.
 - getDesktopThemes- public UIThemes.Name[] getDesktopThemes() Gets the desktop themes.- Returns:
- An array of desktop themes possible, or null for any. DO NOT MODIFY THE RETURNED ARRAY!
 
 - getMobileThemes- public UIThemes.Name[] getMobileThemes() Gets the mobile themes.- Returns:
- An array of mobile themes possible, or null for any. DO NOT MODIFY THE RETURNED ARRAY!
 
 - dataToString- public java.lang.String dataToString() The data string representation.
 - toString- public java.lang.String toString() Returns a string representation of this class instance and its values.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- A string representation of this class instance.
 
 - computeIntersection- public GThemes computeIntersection(GThemes mask) Computes the "intersection" of this mask and another one.- Parameters:
- mask- The mask to "intersect" with.
- Returns:
- The "intersection" mask, or the special value NONEthat is not allowed to be serialized (saved to XML, stored in ThemesProp or sent over a transaction).
 
 - isNullMask- public boolean isNullMask() Returns if this mask is a "null" mask, or a NONE mask.- Returns:
- true if no themes are present, i.e. a "null" mask or NONE mask, false if there is a type present.
 
 - verify- public java.lang.String verify(GThemes mask) Verifies if the current theme is not "masked away" from its initial intents. This method is intended to be used on a panel theme and a mask applies from parent folders.- Parameters:
- mask- The mask from parent folders.
- Returns:
- null if it is valid, otherwise an error message of the problem.
 
 - contains- public boolean contains(UIThemes.Name name) Checks if the theme name is contained in this theme instances mask.- Parameters:
- name- The themes name to test.
- Returns:
- true if it is contained in either mobile or desktop.
 
 - toClientThemesString- public java.lang.String toClientThemesString() Returns the representation of the theme for the client to use.- Returns:
- String formatted as "desktop,[mobile]".