站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

CompletionQuery.ResultItem (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor.ext
Interface CompletionQuery.ResultItem

All Known Implementing Classes:
CompletionQuery.AbstractResultItem, CompletionQuery.DefaultResultItem
Enclosing interface:
CompletionQuery

public static interface CompletionQuery.ResultItem

An interface used as an item of List returned by CompletionQuery.Result.getData() Such items are then able to their part in Completion process themselves


Method Summary
 String getItemText()
          Says what text would this Element use if substituteText is called.
 Component getPaintComponent(JList list, boolean isSelected, boolean cellHasFocus)
          Prepare proper component for painting value of this.
 boolean substituteCommonText(JTextComponent c, int offset, int len, int subLen)
          Update the text in response to pressing TAB key (or any key mapped to this function) on this element
 boolean substituteText(JTextComponent c, int offset, int len, boolean shift)
          Update the text in response to pressing ENTER on this element.
 

Method Detail

substituteCommonText

boolean substituteCommonText(JTextComponent c,
                             int offset,
                             int len,
                             int subLen)
Update the text in response to pressing TAB key (or any key mapped to this function) on this element

Parameters:
c - the text component to operate on, enables implementation to do things like movement of caret.
offset - the offset where the item should be placed
len - the length of recognized text which should be replaced
subLen - the length of common part - the length of text that should be inserted after removal of recognized text
Returns:
whether the text was successfully updated

substituteText

boolean substituteText(JTextComponent c,
                       int offset,
                       int len,
                       boolean shift)
Update the text in response to pressing ENTER on this element.

Parameters:
c - the text component to operate on, enables implementation to do things like movement of caret.
offset - the offset where the item should be placed
len - the length of recognized text which should be replaced
shift - the flag that instructs completion to behave somehow differently - enables more kinds of invocation of substituteText
Returns:
whether the text was successfully updated

getItemText

String getItemText()
Says what text would this Element use if substituteText is called.

Returns:
the substitution text, usable e.g. for finding common text/its' length

getPaintComponent

Component getPaintComponent(JList list,
                            boolean isSelected,
                            boolean cellHasFocus)
Prepare proper component for painting value of this.

Parameters:
JList - the list this item will be drawn into, usefull e.g. for obtaining preferred colors.
isSelected - tells if this item is just selected, for using proper color scheme.
cellHasFocus - tells it this item is just focused.
Returns:
the component usable for painting this value

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.