Class DesignerPalette
java.lang.Object
com.iizigo.color.DesignerPalette
The Designer's palette service: installs the platform base palette from the theme sheet the internal web server serves, so that a role reference resolves in iiziGo as it does on a server; reads the base palette of every shipped family for the previews; lists the module roots whose
style folders hold the palette colors; and tells the design views when a palette changed, so that the palette block they show (AppPaletteCSS) is regenerated.The saved theme choice - the family and the mode the Panel Editor's "Theme and Client" menu stores in the preference store - is read here for the previews of the color editor and the chooser.
- Author:
- Christopher Mindus
Field Summary
FieldsMethod Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(Runnable listener) Adds a listener told, in the SWT thread and once per burst of changes, when a palette color changed.static PropCnrgetBasePalette(String family) Gets the base palette of a shipped family: the light and dark values the theme sheet defines for it.Gets the root containers of the loaded module projects: the ones whosestylefolders hold the palette colors the design views can show.static StringGets the saved theme family, the one the Panel Editor's "Theme and Client" menu stores.static StringGets the saved theme mode as a scheme name: light or dark, never auto (the Designer has no OS preference to follow, so auto previews as light).static booleaninstall()Installs the platform base palette in the color resolver from the theme sheet, once.static voidCalled when a palette color changed: the listeners are told once, asynchronously in the SWT thread, however many changes arrive before it runs.static booleanInstalls or refreshes the palette block on a design view's client root: the loaded modules' palette colors as CSS custom properties, the base palette installed first.static voidremoveListener(Runnable listener) Removes a listener.static ColorResolver.ResultResolves a color reference from a holder for a scheme against the saved family's base palette.static ColorResolver.ResultresolveEntry(PaletteColor color, String scheme) Resolves a palette color for a scheme against the saved family's base palette.
Field Details
PREF_FAMILY
The preference store key of the saved theme family, as the Panel Editor stores it.- See Also:
PREF_MODE
The preference store key of the saved theme mode, as the Panel Editor stores it.- See Also:
Method Details
install
public static boolean install()Installs the platform base palette in the color resolver from the theme sheet, once.- Returns:
- true when a base palette is installed.
getBasePalette
Gets the base palette of a shipped family: the light and dark values the theme sheet defines for it. The default family's palette is the installed one.- Parameters:
family- The family name, e.g. "graphite", or null for the default family.- Returns:
- The base palette, or null when the sheet cannot be read.
getSavedFamily
Gets the saved theme family, the one the Panel Editor's "Theme and Client" menu stores.- Returns:
- The family name, the default family when none is stored.
getSavedScheme
Gets the saved theme mode as a scheme name: light or dark, never auto (the Designer has no OS preference to follow, so auto previews as light).- Returns:
- The scheme name,
PaletteColor.SCHEME_LIGHTorPaletteColor.SCHEME_DARK.
resolveEntry
Resolves a palette color for a scheme against the saved family's base palette.- Parameters:
color- The palette color.scheme- The scheme, light or dark.- Returns:
- The result, never null.
resolve
Resolves a color reference from a holder for a scheme against the saved family's base palette.- Parameters:
holder- Any property in the tree the reference is written in.color- The referenced color.scheme- The scheme, light or dark.- Returns:
- The result, never null.
getModuleRoots
push
Installs or refreshes the palette block on a design view's client root: the loaded modules' palette colors as CSS custom properties, the base palette installed first.- Parameters:
clientRoot- The client root of the design view.- Returns:
- true when the block changed.
addListener
Adds a listener told, in the SWT thread and once per burst of changes, when a palette color changed.- Parameters:
listener- The listener.
removeListener
Removes a listener.- Parameters:
listener- The listener.
paletteChanged
public static void paletteChanged()Called when a palette color changed: the listeners are told once, asynchronously in the SWT thread, however many changes arrive before it runs.