JIDE 3.5.15

com.jidesoft.editor
Class AbstractListCodeEditorIntelliHints

java.lang.Object
  extended by com.jidesoft.editor.AbstractCodeEditorIntelliHints
      extended by com.jidesoft.editor.AbstractListCodeEditorIntelliHints
All Implemented Interfaces:
IntelliHints
Direct Known Subclasses:
ListDataCodeEditorIntelliHints

public abstract class AbstractListCodeEditorIntelliHints
extends AbstractCodeEditorIntelliHints

AbstractListCodeEditorIntelliHints extends AbstractCodeEditorIntelliHints and further implement most of the methods in interface IntelliHints. In this class, it assumes the hints can be represented as a JList, so it used JList in the hints popup.


Field Summary
protected  KeyStroke[] _keyStrokes
           
 
Fields inherited from interface com.jidesoft.hints.IntelliHints
CLIENT_PROPERTY_INTELLI_HINTS
 
Constructor Summary
AbstractListCodeEditorIntelliHints(CodeEditor codeEditor)
           
 
Method Summary
 JComponent createHintsComponent()
          Creates the component which contains hints.
protected  JList createList()
          Creates the list to display the hints.
 JComponent getDelegateComponent()
          Gets the delegate component.
 KeyStroke[] getDelegateKeyStrokes()
          Gets the delegate keystrokes.
protected  JList getList()
          Gets the list.
 int getMinimumPopupWidth()
          Gets the minimum popup width.
 Object getSelectedHint()
          Gets the selected value.
protected  void setListData(Object[] objects)
          Sets the list data.
protected  void setListData(Vector<?> objects)
          Sets the list data.
 void setMinimumPopupWidth(int minimumWidth)
          Sets the minimum popup width.
 
Methods inherited from class com.jidesoft.editor.AbstractCodeEditorIntelliHints
acceptHint, addShowHintsKeyStroke, createPopup, getAllShowHintsKeyStrokes, getCaretRectangleForPopup, getCodeEditor, getContext, getDelimiters, getIntelliHints, getShowHintsKeyStroke, hideHintsPopup, install, isAutoPopup, isHintsPopupVisible, removeShowHintsKeyStroke, setAutoPopup, setDelimiters, setHintsEnabled, showHintsPopup, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.hints.IntelliHints
updateHints
 

Field Detail

_keyStrokes

protected KeyStroke[] _keyStrokes
Constructor Detail

AbstractListCodeEditorIntelliHints

public AbstractListCodeEditorIntelliHints(CodeEditor codeEditor)
Method Detail

createHintsComponent

public JComponent createHintsComponent()
Description copied from interface: IntelliHints
Creates the component which contains hints. At this moment, the content should be empty. Following call IntelliHints.updateHints(Object) will update the content.

Returns:
the component which will be used to display the hints.

createList

protected JList createList()
Creates the list to display the hints. By default, we create a JList using the code below.
 return new JList() {
     public int getVisibleRowCount() {
         int size = getModel().getSize();
         return size < super.getVisibleRowCount() ? size : super.getVisibleRowCount();
     }
 

public Dimension getPreferredScrollableViewportSize() { if (getModel().getSize() == 0) { return new Dimension(0, 0); } else { return super.getPreferredScrollableViewportSize(); } } };

Returns:
the list.

getList

protected JList getList()
Gets the list.

Returns:
the list.

setListData

protected void setListData(Object[] objects)
Sets the list data.

Parameters:
objects -

setListData

protected void setListData(Vector<?> objects)
Sets the list data.

Parameters:
objects -

getSelectedHint

public Object getSelectedHint()
Description copied from interface: IntelliHints
Gets the selected value. This value will be used to complete the text component.

Returns:
the selected value.

getDelegateComponent

public JComponent getDelegateComponent()
Description copied from class: AbstractCodeEditorIntelliHints
Gets the delegate component.

Specified by:
getDelegateComponent in class AbstractCodeEditorIntelliHints
Returns:
the delegate component.

getDelegateKeyStrokes

public 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. 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 getDelegateComponent().

Specified by:
getDelegateKeyStrokes in class AbstractCodeEditorIntelliHints
Returns:
an array of keystrokes that will be delegate to getDelegateComponent() when hint popup is shown.

getMinimumPopupWidth

public int getMinimumPopupWidth()
Gets the minimum popup width.

Returns:
the minimum popup width.
See Also:
setMinimumPopupWidth(int)

setMinimumPopupWidth

public void setMinimumPopupWidth(int minimumWidth)
Sets the minimum popup width.

The default value is 100.

Parameters:
minimumWidth - the minimum popup width

JIDE 3.5.15