-
Notifications
You must be signed in to change notification settings - Fork 31
WindowBuilder Palette
Each Java file belongs to one of the UI subsets (SWT, Swing, GWT, etc.). Each subset has its own palette.
The palette consists of a provider and three types of objects:
Tool
Category
- [Name]
- [Visibility...]
- [Visibility state (TRUE | FALSE, default = TRUE)]
- [Open state (OPEN | PINNED | CLOSED, default = OPEN)]
Entry
- [Name]
- [Icon...]
- [Description (optional)]
- [Category]
- [Visibility...]
- [Visibility state (TRUE | FALSE, default = TRUE)]
- [Action when used...]
The 'scope' and 'visibility state' attributes assigned to a category are inherited by its entries. Entries can override these values with their own.
Visibility can be limited by:
- [Eclipse version (minIDEVersion)]
- [Unsupported OS (excludeOS)]
- [Supported OS (includeOS)]
- [Designer version (PRO | EVALUTION)]
- [Ability to load a specified Java class]
- [Special 'visibility key' (showCondition)...]
The value of the 'visibility key' is determined by the provider. When performing certain actions, the provider can set the key to TRUE or FALSE, and the objects affected by it will be either added to or removed from the palette.
Also, if an entry is added to a palette that belongs to another palette (in cases where this is generally allowed, for example, in SWT, Swing entries can be added when using SWT_AWT), the provider must set the 'visibility key' for them that it provides for that other palette. If these new entries were added to a newly created category, then it should also inherit this key.
The set of entries and categories for each palette available in the designer are described in an XML file. The user can change the settings for each palette. A customized palette can be stored in two places: palette settings for the entire workspace, or Java projects can have their own palette settings.
The user can change the 'expand' and visibility states. They can also change the order of categories, as well as the arrangement of entries within categories. New categories and entries can be added. A set of entries can be added, including within a separate category, from a JAR containing Java beans defined in the manifest.
When added via the 'Palette Dialog,' the values of palette objects are stored in the palette settings. Categories and entries can also be added via an extension point. The presence of such objects is determined when the first designer is launched.
When using special tools to select components (for example, the 'choose panel'), you need to create an entry for them and add it to a special category (Custom Controls) in the user palette.
The provider can provide its own component selection dialog or icon selection dialog when adding an entry.
When adding an entry, if the palette allows it, it is possible to specify that the entry belongs to another palette (in the SWT palette, you can create a Swing entry).
When creating a new entry, the code for generation and imports are specified. This is a pure String, and classes and class loaders are not required.
The icon is taken either from an absolute file system path, from BeanInfo, or from the designer's icon database. If the entry is described via an extension point, the icon is determined either from the plugin or from BeanInfo. (In fact, BeanInfo is evil! Because if you use only the code for creation, there won't be any fuss with loading classes, and BeanInfo ruins all that.)
Load the designer's standard palettes via an extension point. Store any user changes as a patch, which is applied to the palette loaded via all corresponding extension points.