|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
javax.swing.JWindow
org.gjt.sp.jedit.gui.CompletionPopup
net.jakubholy.jedit.autocomplete.CompletionPopup
public class CompletionPopup
A pop-up window to display a list of available completions.
When visible it intercepts all keys and either passes them on
or handles them if they've a special meaning for it (such
as dispose or insert the selected completion). What keys
have what meaning is determined by a PreferencesManager
.
It could be extended to react also to other events such as
focus lost.
The window is absolutely unaware of the AutoComplete that's using it and that contains most of the logic to show/dispose the pop-up/update the list of completions.
NOTE: Re-implemented based on the completion pop-up being
part of the jEdit API. The implementation is inspired by
CompleteWord
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.gjt.sp.jedit.gui.CompletionPopup |
---|
org.gjt.sp.jedit.gui.CompletionPopup.Candidates |
Nested classes/interfaces inherited from class javax.swing.JWindow |
---|
javax.swing.JWindow.AccessibleJWindow |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected int |
DOWN
A constant used by moveSelection - down arrow pressed. |
protected int |
UP
A constant used by moveSelection - up arrow pressed. |
Fields inherited from class javax.swing.JWindow |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CompletionPopup(org.gjt.sp.jedit.View view,
java.awt.Point location)
Create a new (so far invisible) pop-up with its listeners at the given location. |
Method Summary | |
---|---|
void |
keyPressed(java.awt.event.KeyEvent evt)
Keys handling while the popup is visible. |
void |
keyTyped(java.awt.event.KeyEvent evt)
Handle key typed while intercepting any user input when popup visible. |
protected void |
moveSelection(java.awt.event.KeyEvent evt,
int direction)
Move selection in the popup completition list up or down. |
void |
setWord(java.lang.String word)
Set the prefix being completed. |
boolean |
showCompletions(net.jakubholy.jedit.autocomplete.Completion[] completions)
Display/update a popup with the given completions. |
Methods inherited from class org.gjt.sp.jedit.gui.CompletionPopup |
---|
dispose, doSelectedCompletion, getCandidates, getSelectedIndex, reset, setSelectedIndex |
Methods inherited from class javax.swing.JWindow |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update, windowInit |
Methods inherited from class java.awt.Window |
---|
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.jakubholy.jedit.autocomplete.ITextAutoCompletionPopup |
---|
dispose |
Field Detail |
---|
protected final int DOWN
protected final int UP
Constructor Detail |
---|
public CompletionPopup(org.gjt.sp.jedit.View view, java.awt.Point location)
Method Detail |
---|
public boolean showCompletions(net.jakubholy.jedit.autocomplete.Completion[] completions)
ITextAutoCompletionPopup
showCompletions
in interface ITextAutoCompletionPopup
completions
- The completions to set; if empty => dispose.
public void setWord(java.lang.String word)
ITextAutoCompletionPopup
setWord
in interface ITextAutoCompletionPopup
public void keyPressed(java.awt.event.KeyEvent evt)
keyPressed
in class org.gjt.sp.jedit.gui.CompletionPopup
protected void moveSelection(java.awt.event.KeyEvent evt, int direction)
public void keyTyped(java.awt.event.KeyEvent evt)
keyTyped
in class org.gjt.sp.jedit.gui.CompletionPopup
AutoComplete.update(java.util.Observable, Object)
,
WordTypedListener
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |