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 classA completion and its cached summary text.private classAction that actually updates the summary text displayed.(package private) classAction that moves to the previous description displayed.(package private) classAction that moves to the previous description displayed.Nested classes/interfaces inherited from class javax.swing.JWindow
JWindow.AccessibleJWindowNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AutoCompletionThe parent AutoCompletion instance.private ActionAction that goes to the previous description displayed.private ResourceBundleThe resource bundle for this window.private JEditorPaneRenders the HTML description.private JToolBarThe toolbar with "back" and "forward" buttons.private static final Stringprivate ActionAction that goes to the next description displayed.private List<AutoCompleteDescWindow.HistoryEntry> History of descriptions displayed.private intThe current position inhistory.private static final intThe amount of time to wait after the user changes the selected completion to refresh the description.private static final StringThe resource bundle name.private JScrollPaneThe scroll pane thatdescAreais in.private TimerProvides 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, rootPaneCheckingEnabledFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddToHistory(AutoCompleteDescWindow.HistoryEntry historyItem) Sets the currently displayed description and updates the history.private voidClears the history of viewed descriptions.private voidMakes the current history page the last one in the history.booleancopy()Copies from the description text area, if it is visible and there is a selection.private static BordergetReplacementForFlatLafBorder(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 StringReturns the localized message for the specified key.private static BordervoidCalled when a hyperlink is clicked.private static booleanisFlatLafBorder(Border border) private voidEnables or disables the back and forward actions as appropriate.voidsetDescriptionFor(Completion item) Sets the description displayed in this window.protected voidsetDescriptionFor(Completion item, boolean addToHistory) Sets the description displayed in this window.protected voidsetDescriptionFor(Completion item, String anchor, boolean addToHistory) Sets the description displayed in this window.private voidsetDisplayedDesc(Completion completion, String anchor, boolean addToHistory) voidsetVisible(boolean visible) voidshowSummaryFor(Completion completion, String anchor) Callback for customExternalURLHandlers.voidupdateUI()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, windowInitMethods 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, toFrontMethods 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, validateTreeMethods 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 thatdescAreais 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 forCompletions 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:
hyperlinkUpdatein 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, ornullif 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:
setVisiblein classWindow
-
showSummaryFor
Callback for customExternalURLHandlers.- Specified by:
showSummaryForin interfaceDescWindowCallback- Parameters:
completion- The completion to display.anchor- The anchor in the HTML to jump to, ornullif none.
-
updateUI
public void updateUI()Called by the parent completion popup window the LookAndFeel is updated.
-