Class PopupPanelManager
- java.lang.Object
-
- org.pushingpixels.radiance.component.api.common.popup.PopupPanelManager
-
public class PopupPanelManager extends java.lang.Object
Manager for showing and hidingJPopupPanel
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.static class
PopupPanelManager.RadiancePopupMenu
private static class
PopupPanelManager.WeakPopupListener
-
Field Summary
Fields Modifier and Type Field Description private static PopupPanelManager
instance
The singleton instance of popup panel manager.private java.util.List<PopupPanelManager.WeakPopupListener>
listenerList
List of all registered listeners.private java.util.Map<JPopupPanel,PopupPanelManager.RadiancePopupMenu>
popupHosts
Maps every shown popup panel to its popup menu host.private java.util.LinkedList<PopupPanelManager.PopupInfo>
shownPath
All currently shown popup panels.
-
Constructor Summary
Constructors Modifier Constructor Description private
PopupPanelManager()
Private constructor to prevent initialization outside ofdefaultManager()
calls.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPopupListener(PopupPanelManager.PopupListener l)
Adds the specified popup listener.static PopupPanelManager
defaultManager()
Returns the default popup panel manager.protected void
firePopupHidden(JPopupPanel panel, javax.swing.JComponent popupOriginator)
Fires an event on hiding the specified popup panel.protected void
firePopupShown(JPopupPanel panel, javax.swing.JComponent popupOriginator)
Fires an event on showing the specified popup panel.java.util.List<PopupPanelManager.PopupInfo>
getShownPath()
Returns all currently shown popup panels.void
hideLastPopup()
Hides the last shown popup panel.void
hidePopups(java.awt.Component comp)
Hides all popup panels based on the specified component.void
removePopupListener(PopupPanelManager.PopupListener l)
Removes the specified popup listener.void
showPopup(javax.swing.JComponent popupOriginator, JPopupPanel popupContent, int xOnScreen, int yOnScreen)
Shows the specified content in a new popup and starts tracking it.
-
-
-
Field Detail
-
listenerList
private java.util.List<PopupPanelManager.WeakPopupListener> listenerList
List of all registered listeners.
-
instance
private static final PopupPanelManager instance
The singleton instance of popup panel manager.
-
shownPath
private java.util.LinkedList<PopupPanelManager.PopupInfo> shownPath
All currently shown popup panels.
-
popupHosts
private java.util.Map<JPopupPanel,PopupPanelManager.RadiancePopupMenu> popupHosts
Maps every shown popup panel to its popup menu host.
-
-
Constructor Detail
-
PopupPanelManager
private PopupPanelManager()
Private constructor to prevent initialization outside ofdefaultManager()
calls.
-
-
Method Detail
-
defaultManager
public static PopupPanelManager defaultManager()
Returns the default popup panel manager.- Returns:
- a PopupPanelManager object
-
showPopup
public void showPopup(javax.swing.JComponent popupOriginator, JPopupPanel popupContent, int xOnScreen, int yOnScreen)
Shows the specified content in a new popup and starts tracking it.- Parameters:
popupOriginator
- The originator component.popupContent
- The content of the popup.
-
hideLastPopup
public void hideLastPopup()
Hides the last shown popup panel.
-
hidePopups
public void hidePopups(java.awt.Component comp)
Hides all popup panels based on the specified component. We find the first ancestor of the specified component that is a popup panel, and close all popups that were open from that popup panel. If the specified component isnull
, all popup panels are closed.- Parameters:
comp
- Component.
-
getShownPath
public java.util.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, javax.swing.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, javax.swing.JComponent popupOriginator)
Fires an event on hiding the specified popup panel.- Parameters:
panel
- Popup panel that was hidden.popupOriginator
- The originating component.
-
-