Package org.fife.ui.autocomplete
Class AutoCompleteDescWindow
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
javax.swing.JWindow
org.fife.ui.autocomplete.AutoCompleteDescWindow
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,HyperlinkListener
,RootPaneContainer
,DescWindowCallback
The optional "description" window that describes the currently selected
item in the auto-completion window.
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A completion and its cached summary text.private class
Action that actually updates the summary text displayed.(package private) class
Action that moves to the previous description displayed.(package private) class
Action that moves to the previous description displayed.Nested classes/interfaces inherited from class javax.swing.JWindow
JWindow.AccessibleJWindow
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AutoCompletion
The parent AutoCompletion instance.private Action
Action that goes to the previous description displayed.private ResourceBundle
The resource bundle for this window.private JEditorPane
Renders the HTML description.private JToolBar
The toolbar with "back" and "forward" buttons.private static final String
private Action
Action that goes to the next description displayed.private List
<AutoCompleteDescWindow.HistoryEntry> History of descriptions displayed.private int
The current position inhistory
.private static final int
The amount of time to wait after the user changes the selected completion to refresh the description.private static final String
The resource bundle name.private JScrollPane
The scroll pane thatdescArea
is in.private Timer
Provides a slight delay between asking to set a description and actually displaying it, so that if the user is scrolling quickly through completions, those with slow-to-calculate summaries won't bog down the scrolling.The action that listens for the timer to fire.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addToHistory
(AutoCompleteDescWindow.HistoryEntry historyItem) Sets the currently displayed description and updates the history.private void
Clears the history of viewed descriptions.private void
Makes the current history page the last one in the history.boolean
copy()
Copies from the description text area, if it is visible and there is a selection.private static Border
getReplacementForFlatLafBorder
(Border border) FlatLaf adds insets to tool tips, and for some themes (usually light ones) also uses a line border, whereas for other themes (usually dark ones) there is no line border.private String
Returns the localized message for the specified key.private static Border
void
Called when a hyperlink is clicked.private static boolean
isFlatLafBorder
(Border border) private void
Enables or disables the back and forward actions as appropriate.void
setDescriptionFor
(Completion item) Sets the description displayed in this window.protected void
setDescriptionFor
(Completion item, boolean addToHistory) Sets the description displayed in this window.protected void
setDescriptionFor
(Completion item, String anchor, boolean addToHistory) Sets the description displayed in this window.private void
setDisplayedDesc
(Completion completion, String anchor, boolean addToHistory) void
setVisible
(boolean visible) void
showSummaryFor
(Completion completion, String anchor) Callback for customExternalURLHandler
s.void
updateUI()
Called by the parent completion popup window the LookAndFeel is updated.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, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBackground, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setOpacity, setShape, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
ac
The parent AutoCompletion instance. -
descArea
Renders the HTML description. -
scrollPane
The scroll pane thatdescArea
is in. -
backAction
Action that goes to the previous description displayed. -
forwardAction
Action that goes to the next description displayed. -
history
History of descriptions displayed. -
historyPos
private int historyPosThe current position inhistory
. -
timer
Provides a slight delay between asking to set a description and actually displaying it, so that if the user is scrolling quickly through completions, those with slow-to-calculate summaries won't bog down the scrolling. -
timerAction
The action that listens for the timer to fire. -
bundle
The resource bundle for this window. -
INITIAL_TIMER_DELAY
private static final int INITIAL_TIMER_DELAYThe amount of time to wait after the user changes the selected completion to refresh the description. This delay is in place to help performance forCompletion
s that may be slow to compute their summary text.- See Also:
-
MSG
The resource bundle name.- See Also:
-
FLAT_LAF_BORDER_PREFIX
- See Also:
-
-
Constructor Details
-
AutoCompleteDescWindow
AutoCompleteDescWindow(Window owner, AutoCompletion ac) Constructor.- Parameters:
owner
- The parent window.ac
- The parent auto-completion.
-
-
Method Details
-
addToHistory
Sets the currently displayed description and updates the history.- Parameters:
historyItem
- The item to add to the history.
-
clearHistory
private void clearHistory()Clears the history of viewed descriptions. -
clearHistoryAfterCurrentPos
private void clearHistoryAfterCurrentPos()Makes the current history page the last one in the history. -
copy
public boolean copy()Copies from the description text area, if it is visible and there is a selection.- Returns:
- Whether a copy occurred.
-
getReplacementForFlatLafBorder
FlatLaf adds insets to tool tips, and for some themes (usually light ones) also uses a line border, whereas for other themes (usually dark ones) there is no line border. We need to ensure our border has no insets so our draggable bottom component looks good, but we'd like to preserve the color of the line border, if any. This method allows us to do so without a compile-time dependency on flatlaf.- Parameters:
border
- The default tool tip border for the current Look and Feel.- Returns:
- The border to use for this window.
-
getString
Returns the localized message for the specified key.- Parameters:
key
- The key.- Returns:
- The localized message.
-
getToolTipBorder
-
hyperlinkUpdate
Called when a hyperlink is clicked.- Specified by:
hyperlinkUpdate
in interfaceHyperlinkListener
- Parameters:
e
- The event.
-
isFlatLafBorder
-
setActionStates
private void setActionStates()Enables or disables the back and forward actions as appropriate. -
setDescriptionFor
Sets the description displayed in this window. This clears the history.- Parameters:
item
- The item whose description you want to display.
-
setDescriptionFor
Sets the description displayed in this window.- Parameters:
item
- The item whose description you want to display.addToHistory
- Whether to add this page to the page history (as opposed to clearing it and starting anew).
-
setDescriptionFor
Sets the description displayed in this window.- Parameters:
item
- The item whose description you want to display.anchor
- The anchor to jump to, ornull
if none.addToHistory
- Whether to add this page to the page history (as opposed to clearing it and starting anew).
-
setDisplayedDesc
-
setVisible
public void setVisible(boolean visible) - Overrides:
setVisible
in classWindow
-
showSummaryFor
Callback for customExternalURLHandler
s.- Specified by:
showSummaryFor
in interfaceDescWindowCallback
- Parameters:
completion
- The completion to display.anchor
- The anchor in the HTML to jump to, ornull
if none.
-
updateUI
public void updateUI()Called by the parent completion popup window the LookAndFeel is updated.
-