Debian Codegraph @

src/com/jidesoft/hints/IntelliHints.java

raw
1 /*
2 * @(#)IntelliHints.java 7/24/2005
3 *
4 * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
5 */
6 package com.jidesoft.hints;
7
8 import javax.swing.*;
9
10 /**
11 * <code>IntelliHints</code> is an interface that defines all necessary methods to implement showing a hint popup
12 * depending on a context and allows user to pick from a list of hints. {@link #createHintsComponent()} will create a
13 * component that contains the hints. It will be shown in a popup window. After hint popup is created, {@link
14 * #updateHints(Object, boolean)} will update the content of hints based on the context. Once user picks a hint from the hint
15 * popup, {@link #getSelectedHint()} will be called to find the hint that user selected and call {@link
16 * #acceptHint(Object)} to accept it.
17 */
18 public interface IntelliHints {
19 /**
20 * The key of a client property. If a component has IntelliHints registered, you can use this client property to get
21 * the IntelliHints instance.
22 */
23 String CLIENT_PROPERTY_INTELLI_HINTS = "INTELLI_HINTS"; //NOI18N
24
25 /**
26 * Creates the component which contains hints. At this moment, the content should be empty. Following call {@link
27 * #updateHints(Object, boolean)} will update the content.
28 *
29 * @return the component which will be used to display the hints.
30 */
31 JComponent createHintsComponent();
32
33 /**
34 * Update hints depending on the context. This method will be triggered for every key typed event in the text
35 * component. Subclass can override it to provide your own list of hints and call setListData to set it and returns
36 * true after that.
37 *
38 * @param context the current context
39 *
40 * @return true or false. If it is false, hint popup will not be shown.
41 * @deprecated replaced it by {{@link #updateHints(Object, boolean)}}
42 */
43 @Deprecated
44 boolean updateHints(Object context);
45
46 /**
47 * Update hints depending on the context. This method will be triggered for every key typed event in the text
48 * component. Subclass can override it to provide your own list of hints and call setListData to set it and returns
49 * true after that.
50 *
51 * @param context the current context
52 * @param autoPopup true or false. If true, it means this method was called through the auto-popup feature because
53 * of the show hint timer is triggered. If false, it means user pressed the show hint key stroke to
54 * show the popup.
55 *
56 * @return true or false. If it is false, hint popup will not be shown.
57 */
58 boolean updateHints(Object context, boolean autoPopup);
59
60 /**
61 * Gets the selected value. This value will be used to complete the text component.
62 *
63 * @return the selected value.
64 */
65 Object getSelectedHint();
66
67 /**
68 * Accepts the selected hint. Subclass can implements to decide how the new hint be set to the text component.
69 *
70 * @param hint the hint to be accepted.
71 */
72 void acceptHint(Object hint);
73 }