Class AppTheme
- All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
CC-DESIGN-THEME-EDITOR DESIGN.md section 3, phase TE1).On disk a theme is one .iiziStyle file under a module's style folder, the root tag theme, beside the paletteColor and palette files (the FontFaces precedent: one folder extension, the root tag names the type). Its children:
base, a string: the shipped family (UISchemes.Family) the theme is built on; required.modes, an integer:MODES_BOTH(the default),MODES_LIGHTorMODES_DARK- the members the theme has. A theme with one member serves both modes with it, as a one-member family ignores the mode.lightanddark, plain containers (the members), each holding values named by role (ColorRoles: aColorPropliteral or aColorReferenceto a palette color, exactly aPaletteColor's two value forms) and by token slug (ThemeTokens: aStringPropof CSS text).
A theme is its base plus overrides. What a member does not set comes from the base family's member of that mode in the shipped sheet, so a theme is always complete and a theme of three edits is a valid theme. The client receives it as two rules of the app block, one per mode, each holding all 48 tokens (AppPaletteCSS).
The family name is the file name folded as a palette slug (ColorSlug): Ocean is ocean. It must start with a letter and must not be a name the platform uses (RESERVED): a shipped family, a Dojo skin name live or removed, or a mode name. Two modules of one application whose themes fold to one name are both refused by the generator, as two colliding palette slugs are.
Verification (verify(PropVerification)): an ERROR for a bad name, a missing or unknown base, an unknown modes value, a literal holding a color reference and a pointer that leads into a cycle; a WARNING for a child that is neither a role nor a token (not delivered), a token value that is not of its kind, a member the modes value leaves unused, and every contrast pair of ColorRoles.CONTRAST_PAIRS below its WCAG ratio, per mode, with the ratio in the text. Contrast is never an error: a theme below AA still ships, an application's own brand may be below AA and its designer may know it.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AtomThe base family child:base.static final StringThe dark member:dark.static final StringThe light member:light.The modes, in the order the generator writes them.static final AtomThe members child:modes.static final intThe theme has a light and a dark member: the default.static final intThe theme has a dark member only, which serves both modes.static final intThe theme has a light member only, which serves both modes.The family names a theme must not fold to, sorted: the shipped families (UISchemes.Family), the modes (UISchemes.Mode), the live Dojo skins (UIThemes.Name), the names an old launcher sends (UISchemesOldNames), and the removed skins and mode names no catalogue lists.static final StringThe root tag of a theme file, thebase-properties.xmlrow:theme.static final StringThe ID prefix of the verification errors this class adds.Fields inherited from class PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_ATTR_STRING_SECRET, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EQC_SAVE_RELEVANT_ONLY, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic StringcheckFamilyName(String family) Checks a family name against the name rule.Collects the themes under a folder, recursively, in tree order.composeColors(String mode, ThemeSheetPalette.Sheet sheet, PropCnr basePalette) Gets the colors a member composes to, for the contrast check of the Designer and ofverify(PropVerification): per role, the base family's value from the sheet, then the role override of this theme's module (a palette color named by the role at the top of itsstylefolder, B2), then the theme's own value - a pointer resolved for the mode byColorResolver.static StringfamilyName(String name) Folds a theme name to its family name, as a palette slug is folded.getBase()Gets the base family's name as written.Gets the base family.Gets the family name of this theme: its name folded.Gets a member's container.intgetModes()Gets the members value.GProp<?> getRoleValue(String member, ColorRoles.Role role) Gets the value a member sets for a role.getTokenValue(String member, ThemeTokens.Token token) Gets the value a member sets for a token.booleanChecks if the theme has a member, by itsmodesvalue.Gets the member that serves a mode: the mode's own, or for a theme with one member that member.booleanverify(PropVerification verification) Verifies this theme: the name, the base, the members value, every member's children, and the contrast of every pair per mode (pattern:ThemesProp.verify).Methods inherited from class PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, clone, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializePropTree, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropErrorPersisted, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropForEditorAtCreation, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropSaveRelevant, isPropSecret, isPropSecretCapable, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onInitialize, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropSecret, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toShortString, toShortString, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Details
TAG
The root tag of a theme file, thebase-properties.xmlrow:theme.- See Also:
VERIFY_ID
The ID prefix of the verification errors this class adds.- See Also:
BASE
The base family child:base.MODES
The members child:modes.MODES_BOTH
public static final int MODES_BOTHThe theme has a light and a dark member: the default.- See Also:
MODES_LIGHT
public static final int MODES_LIGHTThe theme has a light member only, which serves both modes.- See Also:
MODES_DARK
public static final int MODES_DARKThe theme has a dark member only, which serves both modes.- See Also:
LIGHT
DARK
MODE_NAMES
RESERVED
The family names a theme must not fold to, sorted: the shipped families (UISchemes.Family), the modes (UISchemes.Mode), the live Dojo skins (UIThemes.Name), the names an old launcher sends (UISchemesOldNames), and the removed skins and mode names no catalogue lists.
Constructor Details
AppTheme
public AppTheme()Creates the theme property container without a name. The name must be set in all cases using thesetPropertyAtomcall.AppTheme
Creates the theme property container with the specified name.- Parameters:
propertyAtom- the name of the theme, its file name.
Method Details
familyName
Folds a theme name to its family name, as a palette slug is folded.- Parameters:
name- The theme's name, its file name without the extension.- Returns:
- The family name: lower case, runs of other characters than
a-z0-9one dash, no dash at either end; possibly empty.
checkFamilyName
getFamilyName
Gets the family name of this theme: its name folded.- Returns:
- The family name, possibly invalid (
checkFamilyName(String)).
getBase
Gets the base family's name as written.- Returns:
- The name, or null when the theme has none.
getBaseFamily
Gets the base family.- Returns:
- The shipped family, or null when the base is missing or unknown.
getModes
public int getModes()Gets the members value.- Returns:
MODES_BOTH,MODES_LIGHT,MODES_DARK, or another value as written, which verification reports.
memberFor
hasMember
getMember
getRoleValue
Gets the value a member sets for a role.- Parameters:
member-LIGHTorDARK.role- The role.- Returns:
- The
ColorProporColorReference, or null when the member does not set the role (or sets it as something else, which verification reports).
getTokenValue
Gets the value a member sets for a token.composeColors
public Map<String,Integer> composeColors(String mode, ThemeSheetPalette.Sheet sheet, PropCnr basePalette) Gets the colors a member composes to, for the contrast check of the Designer and ofverify(PropVerification): per role, the base family's value from the sheet, then the role override of this theme's module (a palette color named by the role at the top of itsstylefolder, B2), then the theme's own value - a pointer resolved for the mode byColorResolver.- Parameters:
mode-LIGHTorDARK: the mode served.sheet- The family members of the shipped sheet.basePalette- The platform base palette for the resolver, or null.- Returns:
- The ARGB colors by role name; a role whose value does not resolve is absent. Empty when the base is unknown or the sheet has no member for it.
verify
Verifies this theme: the name, the base, the members value, every member's children, and the contrast of every pair per mode (pattern:ThemesProp.verify).collect