Java Doc for AbstractIntelliHints.java in  » Swing-Library » jide-common » com » jidesoft » hints » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jide common » com.jidesoft.hints 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jidesoft.hints.AbstractIntelliHints

All known Subclasses:   com.jidesoft.hints.AbstractListIntelliHints,
AbstractIntelliHints
abstract public class AbstractIntelliHints implements IntelliHints(Code)
AbstractIntelliHints is an abstract implementation of com.jidesoft.hints.IntelliHints . It covers functions such as showing the hint popup at the correct position, delegating keystrokes, updating and selecting hint. The only thing that is left out to subclasses is the creation of the hint popup.
author:
   Santhosh Kumar T
author:
   JIDE Software, Inc.


Field Summary
final public static  StringCLIENT_PROPERTY_INTELLI_HINTS
     The key of a client property.

Constructor Summary
public  AbstractIntelliHints(JTextComponent textComponent)
     Creates an IntelliHints object for a given JTextComponent.

Method Summary
public  voidacceptHint(Object selected)
     After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint.

For JTextArea, the default implementation will insert the hint into current caret position. For JTextField, by default it will replace the whole content with the item user selected.

protected  JidePopupcreatePopup()
    
protected  intgetCaretPositionForPopup()
     Gets the caret position which is used as the anchor point to display the popup.
protected  RectanglegetCaretRectangleForPopup(int caretPosition)
     Gets the caret rectangle where caret is displayed.
protected  ObjectgetContext()
     Gets the context for hints.
abstract protected  JComponentgetDelegateComponent()
     Gets the delegate component in the hint popup.
abstract protected  KeyStroke[]getDelegateKeyStrokes()
     Gets the delegate keystrokes.

When hint popup is visible, the keyboard focus never leaves the text component. However the hint popup usually contains a component that user will try to use navigation key to select an item.

protected  KeyStrokegetShowHintsKeyStroke()
     Gets the keystroke that will trigger the hint popup.
public  JTextComponentgetTextComponent()
    
protected  voidhideHintsPopup()
     Hides the hints popup.
public  booleanisAutoPopup()
     Returns whether the hints popup is automatically displayed.
public  booleanisFollowCaret()
     Should the hints popup follows the caret. true if the popup shows up right below the caret.
public  booleanisHintsPopupVisible()
     Checks if the hints popup is visible. true if it's visible.
public  voidsetAutoPopup(boolean autoPopup)
     Sets whether the popup should be displayed automatically.
public  voidsetFollowCaret(boolean followCaret)
     Sets the position of the hints popup.
public  voidsetHintsEnabled(boolean enabled)
     Enables or disables the hints popup.
Parameters:
  enabled - true to enable the hints popup.
protected  voidshowHintsPopup()
     Shows the hints popup which contains the hints. It will call AbstractIntelliHints.updateHints(Object) .

Field Detail
CLIENT_PROPERTY_INTELLI_HINTS
final public static String CLIENT_PROPERTY_INTELLI_HINTS(Code)
The key of a client property. If a component has intellihints registered, you can use this client property to get the IntelliHints instance.




Constructor Detail
AbstractIntelliHints
public AbstractIntelliHints(JTextComponent textComponent)(Code)
Creates an IntelliHints object for a given JTextComponent.
Parameters:
  textComponent - the text component.




Method Detail
acceptHint
public void acceptHint(Object selected)(Code)
After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint.

For JTextArea, the default implementation will insert the hint into current caret position. For JTextField, by default it will replace the whole content with the item user selected. Subclass can always choose to override it to accept the hint in a different way. For example, com.jidesoft.hints.FileIntelliHints will append the selected item at the end of the existing text in order to complete a full file path.




createPopup
protected JidePopup createPopup()(Code)



getCaretPositionForPopup
protected int getCaretPositionForPopup()(Code)
Gets the caret position which is used as the anchor point to display the popup. By default, it AbstractIntelliHints.isFollowCaret() is true, it will return caret position. Otherwise it will return the caret position at the beginning of the caret line. Subclass can override to return any caret position. the caret position which is used as the anchor point to display the popup.



getCaretRectangleForPopup
protected Rectangle getCaretRectangleForPopup(int caretPosition) throws BadLocationException(Code)
Gets the caret rectangle where caret is displayed. The popup will be show around the area so that the returned rectangle area is always visible. This method will be called twice.
Parameters:
  caretPosition - the caret position. the popup position relative to the text component.
Please note, this position is actually a rectangle area. The reason is the popup could beshown below or above the rectangle. Usually, the popup will be shown below the rectangle. In this case, the x and y of the rectangle willbe the top-left corner of the popup. However if there isn't enough space for the popup because it's close to screen bottom border, we willshow the popup above the rectangle. In this case, the bottom-left corner of the popup will be at x and (y - height). Simply speaking,the popup will never cover the area specified by the rectangle (either below it or above it).
throws:
  BadLocationException - if the given position does not represent a valid location in the associated document.



getContext
protected Object getContext()(Code)
Gets the context for hints. The context is the information that IntelliHints needs in order to generate a list of hints. For example, for code-completion, the context is current word the cursor is on. for file completion, the context is the full string starting from the file system root.

We provide a default context in AbstractIntelliHints. If it's a JTextArea, the context will be the string at the caret line from line beginning to the caret position. If it's a JTextField, the context will be whatever string in the text field. Subclass can always override it to return the context that is appropriate. the context.




getDelegateComponent
abstract protected JComponent getDelegateComponent()(Code)
Gets the delegate component in the hint popup. the component that will receive the keystrokes that are delegated to hint popup.



getDelegateKeyStrokes
abstract protected KeyStroke[] getDelegateKeyStrokes()(Code)
Gets the delegate keystrokes.

When hint popup is visible, the keyboard focus never leaves the text component. However the hint popup usually contains a component that user will try to use navigation key to select an item. For example, use UP and DOWN key to navigate the list. Those keystrokes, if the popup is visible, will be delegated to the the component that returns from AbstractIntelliHints.getDelegateComponent() . an array of keystrokes that will be delegate to AbstractIntelliHints.getDelegateComponent() when hint popup is shown.




getShowHintsKeyStroke
protected KeyStroke getShowHintsKeyStroke()(Code)
Gets the keystroke that will trigger the hint popup. Usually the hints popup will be shown automatically when user types. Only when the hint popup is hidden accidentally, this keystroke will show the popup again.

By default, it's the DOWN key for JTextField and CTRL+SPACE for JTextArea. the keystroek that will trigger the hint popup.




getTextComponent
public JTextComponent getTextComponent()(Code)



hideHintsPopup
protected void hideHintsPopup()(Code)
Hides the hints popup.



isAutoPopup
public boolean isAutoPopup()(Code)
Returns whether the hints popup is automatically displayed. Default is true true if the popup should be automatically displayed. False willnever show it automatically and then need the user to manually activateit via the getShowHintsKeyStroke() key binding.



isFollowCaret
public boolean isFollowCaret()(Code)
Should the hints popup follows the caret. true if the popup shows up right below the caret. False if the popup always showsat the bottom-left corner (or top-left if there isn't enough on the bottom of the screen)of the JTextComponent.



isHintsPopupVisible
public boolean isHintsPopupVisible()(Code)
Checks if the hints popup is visible. true if it's visible. Otherwise, false.



setAutoPopup
public void setAutoPopup(boolean autoPopup)(Code)
Sets whether the popup should be displayed automatically. If autoPopup is true then is the popup automatically displayed whenever updateHints() return true. If autoPopup is false it's not automatically displayed and will need the user to activate the key binding defined by getShowHintsKeyStroke().
Parameters:
  autoPopup - true or false



setFollowCaret
public void setFollowCaret(boolean followCaret)(Code)
Sets the position of the hints popup. If followCaret is true, the popup shows up right below the caret. Otherwise, it will stay at the bottom-left corner (or top-left if there isn't enough on the bottom of the screen) of JTextComponent.
Parameters:
  followCaret - true or false.



setHintsEnabled
public void setHintsEnabled(boolean enabled)(Code)
Enables or disables the hints popup.
Parameters:
  enabled - true to enable the hints popup. Otherwise false.



showHintsPopup
protected void showHintsPopup()(Code)
Shows the hints popup which contains the hints. It will call AbstractIntelliHints.updateHints(Object) . Only if it returns true, the popup will be shown.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.