|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.editor.PopupManager
public class PopupManager
Popup manager allows to display an arbitrary popup component over the underlying text component.
Nested Class Summary | |
---|---|
static class |
PopupManager.HorizontalBounds
Horizontal bounds of popup panel specification |
static class |
PopupManager.Placement
Placement of popup panel specification |
Field Summary | |
---|---|
static PopupManager.Placement |
Above
Place popup always above cursor |
static PopupManager.Placement |
AbovePreferred
Place popup above cursor. |
static PopupManager.Placement |
Below
Place popup always below cursor |
static PopupManager.Placement |
BelowPreferred
Place popup below cursor. |
static PopupManager.Placement |
Largest
Place popup to larger area. |
static PopupManager.HorizontalBounds |
ScrollBarBounds
Place popup inside the whole scrollbar |
static PopupManager.HorizontalBounds |
ViewPortBounds
Place popup inside the scrollbar's viewport |
Constructor Summary | |
---|---|
PopupManager(JTextComponent textComponent)
Creates a new instance of PopupManager |
Method Summary | |
---|---|
protected static Rectangle |
computeBounds(JComponent popup,
int viewWidth,
int viewHeight,
Rectangle cursorBounds,
PopupManager.Placement placement)
|
protected static Rectangle |
computeBounds(JComponent popup,
int viewWidth,
int viewHeight,
Rectangle cursorBounds,
PopupManager.Placement placement,
PopupManager.HorizontalBounds horizontalBounds)
Computes a best-fit bounds of popup panel according to available space in the underlying view (visible part of the pane). |
protected static Rectangle |
computeBounds(JComponent popup,
JComponent view,
Rectangle cursorBounds,
PopupManager.Placement placement)
|
protected static Rectangle |
computeBounds(JComponent popup,
JComponent view,
Rectangle cursorBounds,
PopupManager.Placement placement,
PopupManager.HorizontalBounds horizontalBounds)
Variation of the method for computing the bounds for the concrete view component. |
JComponent |
get()
Returns installed popup panel component |
void |
install(JComponent popup)
Install popup component to textComponent root pane based on caret coordinates with the Largest placement. |
void |
install(JComponent popup,
Rectangle cursorBounds,
PopupManager.Placement placement)
|
void |
install(JComponent popup,
Rectangle cursorBounds,
PopupManager.Placement placement,
PopupManager.HorizontalBounds horizontalBounds)
|
void |
install(JComponent popup,
Rectangle cursorBounds,
PopupManager.Placement placement,
PopupManager.HorizontalBounds horizontalBounds,
int horizontalAdjustment,
int verticalAdjustment)
|
void |
uninstall(JComponent popup)
Removes popup component from textComponent root pane |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final PopupManager.Placement Above
public static final PopupManager.Placement Below
public static final PopupManager.Placement Largest
public static final PopupManager.Placement AbovePreferred
public static final PopupManager.Placement BelowPreferred
public static final PopupManager.HorizontalBounds ViewPortBounds
public static final PopupManager.HorizontalBounds ScrollBarBounds
Constructor Detail |
---|
public PopupManager(JTextComponent textComponent)
Method Detail |
---|
public void install(JComponent popup)
Largest
placement.
Note: Make sure the component is properly uninstalled later,
if it is not necessary. See issue #35325 for details.
popup
- popup component to be installed into
root pane of the text component.public void uninstall(JComponent popup)
popup
- popup component to be removed from
root pane of the text component.public void install(JComponent popup, Rectangle cursorBounds, PopupManager.Placement placement, PopupManager.HorizontalBounds horizontalBounds, int horizontalAdjustment, int verticalAdjustment)
public void install(JComponent popup, Rectangle cursorBounds, PopupManager.Placement placement, PopupManager.HorizontalBounds horizontalBounds)
public void install(JComponent popup, Rectangle cursorBounds, PopupManager.Placement placement)
public JComponent get()
protected static Rectangle computeBounds(JComponent popup, JComponent view, Rectangle cursorBounds, PopupManager.Placement placement, PopupManager.HorizontalBounds horizontalBounds)
popup
- popup panel to be displayedview
- component over which the popup is displayed.cursorBounds
- the bounds of the caret or mouse cursor
relative to the upper-left corner of the visible view.placement
- where to place the popup panel according to
the cursor position.
null
if there is no place to display popup.protected static Rectangle computeBounds(JComponent popup, JComponent view, Rectangle cursorBounds, PopupManager.Placement placement)
protected static Rectangle computeBounds(JComponent popup, int viewWidth, int viewHeight, Rectangle cursorBounds, PopupManager.Placement placement, PopupManager.HorizontalBounds horizontalBounds)
popup.putClientProperty(Placement.class, actual-placement)
.
The actual placement is Above
if the original placement was Above
.
Or if the original placement was AbovePreferred
or Largest
and there is more space above the cursor than below it.
Below
if the original placement was Below
.
Or if the original placement was BelowPreferred
or Largest
and there is more space below the cursor than above it.
AbovePreferred
if the original placement
was AbovePreferred
and there is less space above the cursor than below it.
BelowPreferred
if the original placement
was BelowPreferred
and there is less space below the cursor than above it.
Once the placement client property is set
the popup.setSize()
is called with the size of the area
above/below the cursor (indicated by the placement).
The popup responds by updating its size to the equal or smaller
size. If it cannot physically fit into the requested area
it can call
putClientProperty(Placement.class, null)
on itself to indicate that it cannot fit. The method scans
the content of the client property upon return from
popup.setSize()
and if it finds null there it returns
null bounds in that case. The only exception is
if the placement was either AbovePreferred
or BelowPreferred
. In that case the method
gives it one more try
by attempting to fit the popup into (bigger) complementary
Below
and Above
areas (respectively).
The popup either fits into these (bigger) areas or it again responds
by returning null
in the client property in which case
the method finally gives up and returns null bounds.
popup
- popup panel to be displayedviewWidth
- width of the visible view area.viewHeight
- height of the visible view area.cursorBounds
- the bounds of the caret or mouse cursor
relative to the upper-left corner of the visible viewplacement
- where to place the popup panel according to
the cursor position
null
if there is no place to display popup.protected static Rectangle computeBounds(JComponent popup, int viewWidth, int viewHeight, Rectangle cursorBounds, PopupManager.Placement placement)
|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |