public class AbstractPopup extends java.lang.Object implements JBPopup, ScreenAreaConsumer
Modifier and Type | Class and Description |
---|---|
static class |
AbstractPopup.MyContentPanel |
Disposable.Parent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FIRST_TIME_SIZE |
protected boolean |
myOk |
protected java.awt.Component |
myOwner |
protected SpeedSearch |
mySpeedSearch |
protected SearchTextField |
mySpeedSearchPatternField |
static java.lang.String |
SHOW_HINTS |
Modifier | Constructor and Description |
---|---|
protected |
AbstractPopup() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(JBPopupListener listener) |
protected void |
addPopupListener(JBPopupListener listener) |
void |
addResizeListener(java.lang.Runnable runnable,
Disposable parentDisposable)
Passed listener will be notified if popup is resized by user (using mouse)
|
protected void |
afterShow() |
protected void |
afterShowSync() |
protected boolean |
beforeShow() |
void |
cancel()
Cancels the popup as if Esc was pressed or any other "cancel" action.
|
void |
cancel(java.awt.event.InputEvent e)
Cancels the popup as a response to some mouse action.
|
boolean |
canClose()
Checks if it's currently allowed to close the popup.
|
boolean |
canShow()
Whether it's OK to invoke one of the 'show' methods.
|
void |
closeOk(java.awt.event.InputEvent e)
Hides popup as if Enter was pressed or or any other "accept" action.
|
protected AbstractPopup.MyContentPanel |
createContentPanel(boolean resizable,
PopupBorder border,
boolean isToDrawMacCorner) |
boolean |
dispatchKeyEvent(java.awt.event.KeyEvent e)
This callback is called when new key event from the event queue is being processed.
|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
focusPreferredComponent() |
java.awt.Point |
getBestPositionFor(DataContext dataContext)
Returns location most appropriate for the specified data context.
|
static java.awt.Point |
getCenterOf(java.awt.Component aContainer,
javax.swing.JComponent content) |
static java.util.List<JBPopup> |
getChildPopups(java.awt.Component component) |
javax.swing.JComponent |
getComponent() |
java.awt.Rectangle |
getConsumedScreenBounds() |
javax.swing.JComponent |
getContent()
Returns the Swing component contained in the popup.
|
java.lang.String |
getDimensionServiceKey() |
java.awt.Dimension |
getFooterPreferredSize() |
java.awt.Dimension |
getHeaderPreferredSize() |
java.awt.Point |
getLocationOnScreen() |
java.awt.Component |
getOwner() |
PopupBorder |
getPopupBorder() |
java.awt.Window |
getPopupWindow() |
Project |
getProject() |
java.awt.Dimension |
getSize() |
CaptionPanel |
getTitle() |
java.awt.Window |
getUnderlyingWindow() |
<T> T |
getUserData(java.lang.Class<T> userDataClass) |
protected AbstractPopup |
init(Project project,
javax.swing.JComponent component,
javax.swing.JComponent preferredFocusedComponent,
boolean requestFocus,
boolean focusable,
boolean movable,
java.lang.String dimensionServiceKey,
boolean resizable,
java.lang.String caption,
Computable<java.lang.Boolean> callback,
boolean cancelOnClickOutside,
java.util.Set<JBPopupListener> listeners,
boolean useDimServiceForXYLocation,
ActiveComponent commandButton,
IconButton cancelButton,
MouseChecker cancelOnMouseOutCallback,
boolean cancelOnWindow,
ActiveIcon titleIcon,
boolean cancelKeyEnabled,
boolean locateByContent,
boolean placeWithinScreenBounds,
java.awt.Dimension minSize,
float alpha,
MaskProvider maskProvider,
boolean inStack,
boolean modalContext,
java.awt.Component [] focusOwners,
java.lang.String adText,
int adTextAlignment,
boolean headerAlwaysFocusable,
java.util.List<? extends Pair<java.awt.event.ActionListener,javax.swing.KeyStroke>> keyboardActions,
java.awt.Component settingsButtons,
Processor<? super JBPopup> pinCallback,
boolean mayBeParent,
boolean showShadow,
boolean showBorder,
java.awt.Color borderColor,
boolean cancelOnWindowDeactivation,
BooleanFunction<? super java.awt.event.KeyEvent> keyEventHandler) |
protected boolean |
isBusy() |
boolean |
isCancelKeyEnabled() |
static boolean |
isCloseRequest(java.awt.event.KeyEvent e) |
boolean |
isDisposed() |
boolean |
isFocused() |
static boolean |
isFocused(java.awt.Component [] components) |
boolean |
isModalContext() |
boolean |
isNativePopup() |
boolean |
isPersistent() |
boolean |
isVisible()
Checks if the popup is currently visible.
|
static java.awt.Window |
moveTo(javax.swing.JComponent content,
java.awt.Point screenPoint,
java.awt.Dimension headerCorrectionSize) |
void |
moveToFitScreen() |
protected void |
onSpeedSearchPatternChanged() |
void |
pack(boolean width,
boolean height) |
protected void |
prepareToShow() |
void |
removeListener(JBPopupListener listener) |
protected boolean |
requestFocus() |
void |
setAdText(java.lang.String s) |
void |
setAdText(java.lang.String s,
int alignment) |
void |
setCaption(java.lang.String title) |
void |
setDataProvider(DataProvider dataProvider) |
void |
setDimensionServiceKey(java.lang.String dimensionServiceKey) |
void |
setFinalRunnable(java.lang.Runnable finalRunnable) |
protected void |
setHeaderComponent(javax.swing.JComponent c) |
void |
setLocation(java.awt.Point screenPoint)
Moves popup to the given point.
|
void |
setLocation(RelativePoint p) |
void |
setMinimumSize(java.awt.Dimension size) |
void |
setOk(boolean ok) |
void |
setOkHandler(java.lang.Runnable okHandler) |
void |
setRequestFocus(boolean requestFocus) |
void |
setShowHints(boolean show) |
void |
setSize(java.awt.Dimension size) |
static java.awt.Window |
setSize(javax.swing.JComponent content,
java.awt.Dimension size) |
void |
setSpeedSearchAlwaysShown(boolean value) |
void |
setUiVisible(boolean visible) |
void |
setUserData(java.util.List<java.lang.Object> userData) |
void |
setWarning(java.lang.String text) |
void |
show(java.awt.Component owner)
Shows in best position with a given owner
|
void |
show(java.awt.Component owner,
int aScreenX,
int aScreenY,
boolean considerForcedXY) |
void |
show(RelativePoint aPoint)
Shows the popup at the specified point.
|
void |
showCenteredInCurrentWindow(Project project)
Shows the popup in the center of the active window in the IDE frame for the specified project.
|
void |
showInBestPositionFor(DataContext dataContext)
Shows the popup in the position most appropriate for the specified data context.
|
void |
showInBestPositionFor(Editor editor)
Shows the popup near the cursor location in the specified editor.
|
void |
showInCenterOf(java.awt.Component aComponent)
Shows the popup in the center of the specified component.
|
void |
showInFocusCenter()
Shows the popups in the center of currently focused component
|
void |
showInScreenCoordinates(java.awt.Component owner,
java.awt.Point point) |
void |
showUnderneathOf(java.awt.Component aComponent)
Shows the popup at the bottom left corner of the specified component.
|
void |
storeDimensionSize() |
public static final java.lang.String SHOW_HINTS
public static final java.lang.String FIRST_TIME_SIZE
protected java.awt.Component myOwner
protected boolean myOk
protected final SpeedSearch mySpeedSearch
protected SearchTextField mySpeedSearchPatternField
protected AbstractPopup init(Project project, javax.swing.JComponent component, javax.swing.JComponent preferredFocusedComponent, boolean requestFocus, boolean focusable, boolean movable, java.lang.String dimensionServiceKey, boolean resizable, java.lang.String caption, Computable<java.lang.Boolean> callback, boolean cancelOnClickOutside, java.util.Set<JBPopupListener> listeners, boolean useDimServiceForXYLocation, ActiveComponent commandButton, IconButton cancelButton, MouseChecker cancelOnMouseOutCallback, boolean cancelOnWindow, ActiveIcon titleIcon, boolean cancelKeyEnabled, boolean locateByContent, boolean placeWithinScreenBounds, java.awt.Dimension minSize, float alpha, MaskProvider maskProvider, boolean inStack, boolean modalContext, java.awt.Component [] focusOwners, java.lang.String adText, int adTextAlignment, boolean headerAlwaysFocusable, java.util.List<? extends Pair<java.awt.event.ActionListener,javax.swing.KeyStroke>> keyboardActions, java.awt.Component settingsButtons, Processor<? super JBPopup> pinCallback, boolean mayBeParent, boolean showShadow, boolean showBorder, java.awt.Color borderColor, boolean cancelOnWindowDeactivation, BooleanFunction<? super java.awt.event.KeyEvent> keyEventHandler)
protected AbstractPopup.MyContentPanel createContentPanel(boolean resizable, PopupBorder border, boolean isToDrawMacCorner)
public void setShowHints(boolean show)
public java.lang.String getDimensionServiceKey()
public void setDimensionServiceKey(java.lang.String dimensionServiceKey)
public void setAdText(java.lang.String s)
public PopupBorder getPopupBorder()
public void setAdText(java.lang.String s, int alignment)
public static java.awt.Point getCenterOf(java.awt.Component aContainer, javax.swing.JComponent content)
public void showCenteredInCurrentWindow(Project project)
JBPopup
showCenteredInCurrentWindow
in interface JBPopup
project
- the project in which the popup should be displayed.public void showInCenterOf(java.awt.Component aComponent)
JBPopup
showInCenterOf
in interface JBPopup
aComponent
- the component at which the popup should be centered.public void showUnderneathOf(java.awt.Component aComponent)
JBPopup
showUnderneathOf
in interface JBPopup
aComponent
- the component near which the popup should be displayed.public void show(RelativePoint aPoint)
JBPopup
public void showInScreenCoordinates(java.awt.Component owner, java.awt.Point point)
showInScreenCoordinates
in interface JBPopup
public java.awt.Point getBestPositionFor(DataContext dataContext)
JBPopup
getBestPositionFor
in interface JBPopup
JBPopup.showInBestPositionFor(DataContext)
,
JBPopup.setLocation(Point)
public void showInBestPositionFor(DataContext dataContext)
JBPopup
showInBestPositionFor
in interface JBPopup
dataContext
- the data context to which the popup is related.JBPopupFactory.guessBestPopupLocation(DataContext)
,
JBPopup.getBestPositionFor(DataContext)
public void showInFocusCenter()
JBPopup
showInFocusCenter
in interface JBPopup
public void showInBestPositionFor(Editor editor)
JBPopup
showInBestPositionFor
in interface JBPopup
editor
- the editor relative to which the popup should be displayed.JBPopupFactory.guessBestPopupLocation(Editor)
protected void addPopupListener(JBPopupListener listener)
public final void closeOk(java.awt.event.InputEvent e)
JBPopup
public final void cancel()
JBPopup
public void setRequestFocus(boolean requestFocus)
setRequestFocus
in interface JBPopup
requestFocus
- true
if popup should request focus.public void cancel(java.awt.event.InputEvent e)
JBPopup
public boolean canClose()
JBPopup
canClose
in interface JBPopup
true
if the popup can be closed, false
if a callback disallowed closing the popup.ComponentPopupBuilder.setCancelCallback(com.intellij.openapi.util.Computable)
public boolean isVisible()
JBPopup
public void show(java.awt.Component owner)
JBPopup
public void show(java.awt.Component owner, int aScreenX, int aScreenY, boolean considerForcedXY)
public void focusPreferredComponent()
protected void prepareToShow()
public boolean isDisposed()
isDisposed
in interface JBPopup
protected boolean beforeShow()
protected void afterShow()
protected void afterShowSync()
protected final boolean requestFocus()
public javax.swing.JComponent getContent()
JBPopup
getContent
in interface JBPopup
public void setLocation(RelativePoint p)
public javax.swing.JComponent getComponent()
public Project getProject()
public void dispose()
Disposable
dispose
in interface Disposable
public void storeDimensionSize()
public void setLocation(java.awt.Point screenPoint)
JBPopup
setLocation
in interface JBPopup
screenPoint
- Point to move to.public static java.awt.Window moveTo(javax.swing.JComponent content, java.awt.Point screenPoint, java.awt.Dimension headerCorrectionSize)
public java.awt.Point getLocationOnScreen()
getLocationOnScreen
in interface JBPopup
public void moveToFitScreen()
moveToFitScreen
in interface JBPopup
public static java.awt.Window setSize(javax.swing.JComponent content, java.awt.Dimension size)
public void setCaption(java.lang.String title)
setCaption
in interface JBPopup
public void setSpeedSearchAlwaysShown(boolean value)
public boolean isPersistent()
isPersistent
in interface JBPopup
public boolean isNativePopup()
isNativePopup
in interface JBPopup
public void setUiVisible(boolean visible)
setUiVisible
in interface JBPopup
public java.awt.Window getPopupWindow()
public void setUserData(java.util.List<java.lang.Object> userData)
public <T> T getUserData(java.lang.Class<T> userDataClass)
getUserData
in interface JBPopup
public boolean isModalContext()
isModalContext
in interface JBPopup
public static boolean isFocused(java.awt.Component [] components)
public boolean isCancelKeyEnabled()
isCancelKeyEnabled
in interface JBPopup
public CaptionPanel getTitle()
protected void setHeaderComponent(javax.swing.JComponent c)
public void setWarning(java.lang.String text)
public void addListener(JBPopupListener listener)
addListener
in interface JBPopup
public void removeListener(JBPopupListener listener)
removeListener
in interface JBPopup
protected void onSpeedSearchPatternChanged()
public void setMinimumSize(java.awt.Dimension size)
setMinimumSize
in interface JBPopup
public void setOkHandler(java.lang.Runnable okHandler)
public void setFinalRunnable(java.lang.Runnable finalRunnable)
setFinalRunnable
in interface JBPopup
public void setOk(boolean ok)
public void setDataProvider(DataProvider dataProvider)
setDataProvider
in interface JBPopup
public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
JBPopup
dispatchKeyEvent
in interface JBPopup
e
- new key event being processedtrue
if the event is completely dispatched, i.e. no further processing is necessary;
false
otherwisepublic java.awt.Dimension getHeaderPreferredSize()
public java.awt.Dimension getFooterPreferredSize()
public static boolean isCloseRequest(java.awt.event.KeyEvent e)
protected boolean isBusy()
public static java.util.List<JBPopup> getChildPopups(java.awt.Component component)
public boolean canShow()
JBPopup
public java.awt.Rectangle getConsumedScreenBounds()
getConsumedScreenBounds
in interface ScreenAreaConsumer
public java.awt.Window getUnderlyingWindow()
getUnderlyingWindow
in interface ScreenAreaConsumer
public void addResizeListener(java.lang.Runnable runnable, Disposable parentDisposable)