01: /*
02: * @(#)IntelliHints.java 7/24/2005
03: *
04: * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
05: */
06: package com.jidesoft.hints;
07:
08: import javax.swing.*;
09:
10: /**
11: * <code>IntelliHints</code> is an interface that defines all necessary methods to implement
12: * showing a hint popup depending on a context and allows user to pick from a list of hints.
13: * {@link #createHintsComponent()} will create a component that contains the hints. It will be
14: * shown in a popup window. After hint popup is created, {@link #updateHints(Object)} will update the
15: * content of hints based on the context. Once user picks a hint from the hint popup, {@link #getSelectedHint()}
16: * will be called to find the hint that user selected and call {@link #acceptHint(Object)} to accept it.
17: */
18: public interface IntelliHints {
19: /**
20: * Creates the component which contains hints. At this moment, the content should be empty. Following call
21: * {@link #updateHints(Object)} will update the content.
22: *
23: * @return the component which will be used to display the hints.
24: */
25: JComponent createHintsComponent();
26:
27: /**
28: * Update hints depending on the context.
29: *
30: * @param context the current context
31: * @return true or false. If it is false, hint popup will not be shown.
32: */
33: boolean updateHints(Object context);
34:
35: /**
36: * Gets the selected value. This value will be used to complete the text component.
37: *
38: * @return the selected value.
39: */
40: Object getSelectedHint();
41:
42: /**
43: * Accepts the selected hint.
44: *
45: * @param hint
46: */
47: void acceptHint(Object hint);
48: }
|