Package org.eclipse.gef.ui.palette

# Class FlyoutPaletteComposite

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.gef.ui.palette.FlyoutPaletteComposite

All Implemented Interfaces:
  `Drawable`

public class FlyoutPaletteComposite extends Composite
The FlyoutPaletteComposite is used to show a flyout palette alongside another control. The flyout palette auto-hides (thus maximizing space) when not in use, but can also be pinned open if so desired. It will only be visible when the PaletteView is not.

Since:
  3.0

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`FlyoutPaletteComposite.FlyoutPreferences`
FlyoutPreferences is used to save/load the preferences for the flyout palette.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`STATE_COLLAPSED`
One of the two possible initial states of the flyout palette.
`static final int`
`STATE_PINNED_OPEN`
One of the two possible initial states of the flyout palette.

### Fields inherited from class org.eclipse.swt.widgets.Control

`view`

## Constructor Summary

Constructors
Constructor
Description
`FlyoutPaletteComposite(Composite parent, int style, IWorkbenchPage page, PaletteViewerProvider pvProvider, FlyoutPaletteComposite.FlyoutPreferences preferences)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`static FlyoutPaletteComposite.FlyoutPreferences`
`createFlyoutPreferences(Preferences prefs)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `createFlyoutPreferences(IPreferenceStore)` instead.
`static FlyoutPaletteComposite.FlyoutPreferences`
`createFlyoutPreferences(IPreferenceStore prefs)`
This is a convenient method to get a default FlyoutPreferences object.
`void`
`hookDropTargetListener(GraphicalViewer viewer)`
This method hooks a DropTargetListener that collapses the flyout patette when the user drags something from the palette and moves the cursor to the primary viewer's control.
`void`
`layout(boolean changed)`
`void`
`setExternalViewer(PaletteViewer viewer)`
If an external palette viewer is provided, palette state (that is captured in `PaletteViewer.saveState(IMemento)` -- active tool, drawer expansion state, drawer pin state, etc.) will be maintained when switching between the two viewers.
`void`
`setGraphicalControl(Control graphicalViewer)`
Sets the control along the side of which the palette is to be displayed.

### Methods inherited from class org.eclipse.swt.widgets.Composite

`changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString`

### Methods inherited from class org.eclipse.swt.widgets.Scrollable

`computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode`

### Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setAutoscalingMode, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.swt.graphics.Drawable

`isAutoScalable`

## Field Details

### STATE_COLLAPSED

public static final int STATE_COLLAPSED
One of the two possible initial states of the flyout palette. This is the default one. When in this state, only the flyout palette's sash is visible.

See Also:
  - Constant Field Values

### STATE_PINNED_OPEN

public static final int STATE_PINNED_OPEN
One of the two possible initial states of the flyout palette. When in this state, the flyout palette is completely visible and pinned open so that it doesn't disappear when the user wanders away from the flyout.

See Also:
  - Constant Field Values

## Constructor Details

### FlyoutPaletteComposite

public FlyoutPaletteComposite(Composite parent, int style, IWorkbenchPage page, PaletteViewerProvider pvProvider, FlyoutPaletteComposite.FlyoutPreferences preferences)
Constructor

Parameters:
  `parent` - The parent Composite
  `style` - The style of the widget to construct; only SWT.BORDER is allowed
  `page` - The current workbench page
  `pvProvider` - The provider that is to be used to create the flyout palette
  `preferences` - To save/retrieve the preferences for the flyout

## Method Details

### createFlyoutPreferences

@Deprecated(forRemoval=true, since="3.22.0") public static FlyoutPaletteComposite.FlyoutPreferences createFlyoutPreferences(Preferences prefs)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `createFlyoutPreferences(IPreferenceStore)` instead. This method will be removed after the 2027-06 release.
This is a convenient method to get a default FlyoutPreferences object. The returned FlyoutPreferences does not save any changes made to the given `Preferences`. It's upto the owner plugin to `save` the changes before it `stops`.

Parameters:
  `prefs` - `a plugin's Preferences`
Returns:
  a default implementation of FlyoutPreferences that stores the settings in the given Preferences
Since:
  3.2

### createFlyoutPreferences

public static FlyoutPaletteComposite.FlyoutPreferences createFlyoutPreferences(IPreferenceStore prefs)
This is a convenient method to get a default FlyoutPreferences object.

Parameters:
  `prefs` - an `IPreferenceStore`
Returns:
  a default implementation of FlyoutPreferences that stores the settings in the given Preferences
Since:
  3.22

### layout

public void layout(boolean changed)

Overrides:
  `layout` in class `Composite`
See Also:
  - `Composite.layout(boolean)`

### setExternalViewer

public void setExternalViewer(PaletteViewer viewer)
If an external palette viewer is provided, palette state (that is captured in `PaletteViewer.saveState(IMemento)` -- active tool, drawer expansion state, drawer pin state, etc.) will be maintained when switching between the two viewers. Providing an external viewer, although recommended, is optional.

Parameters:
  `viewer` - The palette viewer used in the PaletteView

### setGraphicalControl

public void setGraphicalControl(Control graphicalViewer)
Sets the control along the side of which the palette is to be displayed. The given Control should be a child of this Composite. This method should only be invoked once.

Parameters:
  `graphicalViewer` - the control of the graphical viewer; cannot be `null`

### hookDropTargetListener

public void hookDropTargetListener(GraphicalViewer viewer)
This method hooks a DropTargetListener that collapses the flyout patette when the user drags something from the palette and moves the cursor to the primary viewer's control. If the auto-hide feature of the palette is to work properly when dragging, this method should be called before any other drop target listeners are added to the primary viewer.

Parameters:
  `viewer` - the primary viewer