Package com.iizix.prop.ui.device
Class GThemes
java.lang.Object
com.iizix.prop.ui.device.GThemes
- All Implemented Interfaces:
- Cloneable
This 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 SummaryFieldsModifier and TypeFieldDescription- static final intThe type: ANY.- static final GThemesThe "ANY_MASK" themes mask, could replace a mask with "null" value (note: not the same- NONE).- static final GThemesThe default theme selection for desktop, i.e.- static final GThemesThe default theme selection: allow all, both desktop and mobile.- static final GThemesThe default theme selection for mobile, all default desktop theme and all mobile themes.- static final GThemesThe default start-up theme for the app: Flat and iOS7+.- static final intThe type: DESKTOP.- static final GThemesThe default theme selection for any desktop theme and no mobile themes.- static final intThe type: MOBILE.- static final GThemesThe default theme selection for any mobile theme and no desktop themes.- static final GThemesThe "NONE" themes mask when intersection is too narrow.
- Constructor SummaryConstructorsConstructorDescription- GThemes- (int type, UIThemes.Name[] desktop, UIThemes.Name[] mobile) Creates a new instance of themes.
- Method SummaryModifier and TypeMethodDescription- void- append- (SendTransaction trans) Appends the themes to a transaction.- 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.The data string representation.- booleanChecks 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 GThemesCreates 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.Gets the desktop themes.Gets the mobile themes.- booleanChecks if this theme is for desktop.- boolean- isMobile()Checks if this theme is for mobile.- booleanReturns if this mask is a "null" mask, or a NONE mask.Returns the representation of the theme for the client to use.- toString()Returns a string representation of this class instance and its values.Verifies if the current theme is not "masked away" from its initial intents.
- Field Details- ANYpublic static final int ANYThe type: ANY.- See Also:
 
- DESKTOPpublic static final int DESKTOPThe type: DESKTOP.- See Also:
 
- MOBILEpublic static final int MOBILEThe type: MOBILE.- See Also:
 
- NONEThe "NONE" themes mask when intersection is too narrow.
- DEFAULT_DESKTOPThe default theme selection for desktop, i.e. Flat, Bootstrap and Claro.
- DEFAULT_MOBILEThe default theme selection for mobile, all default desktop theme and all mobile themes.
- DEFAULT_MASKThe default theme selection: allow all, both desktop and mobile.
- MOBILE_MASKThe default theme selection for any mobile theme and no desktop themes.
- DESKTOP_MASKThe default theme selection for any desktop theme and no mobile themes.
- DEFAULT_STARTUPThe default start-up theme for the app: Flat and iOS7+.
- ANY_MASKThe "ANY_MASK" themes mask, could replace a mask with "null" value (note: not the same- NONE).
 
- Constructor Details- GThemesCreates 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:
- IllegalArgumentException- If type is not ANY, DESKTOP or MOBILE, or if the theme names are invalid for the type.
- NullPointerException- If any theme instance in the array is- null.
 
 
- Method Details- fromCreates 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:
- IllegalArgumentException- If type is not ANY, DESKTOP or MOBILE, or if the theme names are invalid for the type.
- NullPointerException- If any theme instance in the array is- null.
 
- fromCreates 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:
- IllegalArgumentException- If the string type or theme name is wrong.
- NoSuchElementException- If there are no more tokens in this tokenizer's string.
 
- fromCreates a color from a transaction.- Parameters:
- trans- The transaction.
- Throws:
- IllegalArgumentException- If there is a Transaction error.
 
- fromMobileGets 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:
- IllegalArgumentException- If the name is not of mobile type.
 
- fromDesktopGets 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:
- IllegalArgumentException- If the name is not of desktop type.
 
- appendAppends the themes to a transaction.
- equalsChecks if two color objects are equal.
- isDesktoppublic boolean isDesktop()Checks if this theme is for desktop. The theme can be mobile also.
- isMobilepublic boolean isMobile()Checks if this theme is for mobile. The theme can be for desktop also.
- getDesktopThemesGets the desktop themes.- Returns:
- An array of desktop themes possible, or null for any. DO NOT MODIFY THE RETURNED ARRAY!
 
- getMobileThemesGets the mobile themes.- Returns:
- An array of mobile themes possible, or null for any. DO NOT MODIFY THE RETURNED ARRAY!
 
- dataToStringThe data string representation.
- toStringReturns a string representation of this class instance and its values.
- computeIntersectionComputes 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).
 
- isNullMaskpublic 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.
 
- verifyVerifies 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.
 
- containsChecks 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.
 
- toClientThemesStringReturns the representation of the theme for the client to use.- Returns:
- String formatted as "desktop,[mobile]".