Class PaletteTab

All Implemented Interfaces:
Drawable

public class PaletteTab extends Composite
The Palette tab of the SWT color chooser (CC-COLOR-CHOOSER-SWT-PANELS, 2026-10-10): the PaletteEntries in a table of three columns (the header hidden) - a group as a bold header in the first column that cannot be chosen, an entry with its two swatches (light, dark) and its path in the first column, its light hex value in the second and its dark hex value in the third, so that the values align (CC-COLOR-CHOOSER-SWT-SWITCH, the owner's addition of 2026-10-10; the first version wrote path and values into one cell). Choosing an entry sets the literal of the Designer's saved scheme in the chooser and records the reference; a change of the color made elsewhere clears the selection, and with it the reference. The swatch images paint on the theme's field background with a frame in its border color and an unresolved value's cross in its disabled foreground (ChooserColors, CC-FIX-COLOR-CHOOSER-DARK); the table itself is themed by Eclipse.
Author:
Christopher Mindus
  • Constructor Details

    • PaletteTab

      public PaletteTab(Composite parent, ColorChooserComposite chooser, List<PaletteEntries.Entry> entries, boolean isDark, String currentRef, Font font, int fontHeight, ChooserColors colors)
      Creates the tab.
      Parameters:
      parent - The parent.
      chooser - The chooser.
      entries - The entries in display order.
      isDark - true to set the dark scheme's literal when an entry is chosen.
      currentRef - The reference to preselect, or null.
      font - The dialog font, or null for the default.
      fontHeight - The height of the dialog font's metrics in points, for the swatch size.
      colors - The theme colors: this page's background, and of the swatch images the field background, the border for the frame, the disabled foreground for an unresolved value's cross.
  • Method Details

    • getTable

      public Table getTable()
      Gets the table.
    • getHint

      public Label getHint()
      Gets the hint label.
    • getEntries

      public List<PaletteEntries.Entry> getEntries()
      Gets the entries shown, one per table item.
    • getSelectedEntry

      public PaletteEntries.Entry getSelectedEntry()
      Gets the entry chosen, null for none.
    • select

      public boolean select(String ref)
      Selects the entry of a reference as the user would: the chooser gets its literal and the reference.
      Parameters:
      ref - The reference.
      Returns:
      true if an entry holds the reference.
    • clearSelection

      public void clearSelection()
      Clears the selection: the chooser's color was changed elsewhere.