Package org.pushingpixels.flamingo.api.common.popup

# Class PopupPanelManager

java.lang.Object
org.pushingpixels.flamingo.api.common.popup.PopupPanelManager

public class PopupPanelManager extends Object
Manager for showing and hiding `JPopupPanel`s.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`PopupPanelManager.PopupEvent`
Popup event.
`static class`
`PopupPanelManager.PopupInfo`
Information on a single showing popup.
`static interface`
`PopupPanelManager.PopupListener`
Listener on showing and hiding the popup panels.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected EventListenerList`
`listenerList`
List of all registered listeners.
`protected Map<JPopupPanel,Popup>`
`popupPanels`
Map of all popup panels and associated `Popup` objects.
`protected LinkedList<PopupPanelManager.PopupInfo>`
`shownPath`
All currently shown popup panels.

## Constructor Summary

Constructors
Constructor
Description
`PopupPanelManager()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPopup(JComponent popupOriginator, Popup popup, JPopupPanel popupInitiator)`
Adds new popup to the tracking structures.
`void`
`addPopupListener(PopupPanelManager.PopupListener l)`
Adds the specified popup listener.
`static PopupPanelManager`
`defaultManager()`
Returns the default popup panel manager.
`protected void`
`firePopupHidden(JPopupPanel panel, JComponent popupOriginator)`
Fires an event on hiding the specified popup panel.
`protected void`
`firePopupShown(JPopupPanel panel, JComponent popupOriginator)`
Fires an event on showing the specified popup panel.
`List<PopupPanelManager.PopupInfo>`
`getShownPath()`
Returns all currently shown popup panels.
`void`
`hideLastPopup()`
Hides the last shown popup panel.
`void`
`hidePopups(Component comp)`
Hides all popup panels based on the specified component.
`void`
`removePopupListener(PopupPanelManager.PopupListener l)`
Removes the specified popup listener.

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

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

## Field Details

### listenerList

protected EventListenerList listenerList
List of all registered listeners.

### shownPath

protected LinkedList<PopupPanelManager.PopupInfo> shownPath
All currently shown popup panels.

### popupPanels

protected Map<JPopupPanel,Popup> popupPanels
Map of all popup panels and associated `Popup` objects.

## Constructor Details

### PopupPanelManager

public PopupPanelManager()

## Method Details

### defaultManager

public static PopupPanelManager defaultManager()
Returns the default popup panel manager.

Returns:
  a PopupPanelManager object

### addPopup

public void addPopup(JComponent popupOriginator, Popup popup, JPopupPanel popupInitiator)
Adds new popup to the tracking structures.

Parameters:
  `popupOriginator` - The originating component.
  `popup` - The new popup.
  `popupInitiator` - The initiator of the popup.

### hideLastPopup

public void hideLastPopup()
Hides the last shown popup panel.

### hidePopups

public void hidePopups(Component comp)
Hides all popup panels based on the specified component. We find the first ancestor of the specified component that is popup panel, and close all popup panels that were open from that popup panel. If the specified component is `null`, all popup panels are closed.

Parameters:
  `comp` - Component.

### getShownPath

public List<PopupPanelManager.PopupInfo> getShownPath()
Returns all currently shown popup panels.

Returns:
  All currently shown popup panels.

### addPopupListener

public void addPopupListener(PopupPanelManager.PopupListener l)
Adds the specified popup listener.

Parameters:
  `l` - Listener to add.

### removePopupListener

public void removePopupListener(PopupPanelManager.PopupListener l)
Removes the specified popup listener.

Parameters:
  `l` - Listener to remove.

### firePopupShown

protected void firePopupShown(JPopupPanel panel, JComponent popupOriginator)
Fires an event on showing the specified popup panel.

Parameters:
  `panel` - Popup panel that was shown.
  `popupOriginator` - The originating component.

### firePopupHidden

protected void firePopupHidden(JPopupPanel panel, JComponent popupOriginator)
Fires an event on hiding the specified popup panel.

Parameters:
  `panel` - Popup panel that was hidden.
  `popupOriginator` - The originating component.