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

CompletionResultSet (NetBeans Editor Code Completion SPI) - NetBeans API Javadoc 5.0.0

 

org.netbeans.spi.editor.completion
Class CompletionResultSet

java.lang.Object
  extended byorg.netbeans.spi.editor.completion.CompletionResultSet

public final class CompletionResultSet
extends Object

Listener interface for passing the query results.

See Also:
CompletionProvider.createTask(int, javax.swing.text.JTextComponent)

Field Summary
static int PRIORITY_SORT_TYPE
          Sort type returned from getSortType() that prefers priority of the item (CompletionItem.getSortPriority()) over the text of the item (CompletionItem.getSortText()).
static int TEXT_SORT_TYPE
          Sort type returned from getSortType() that prefers text of the item (CompletionItem.getSortText()).
 
Method Summary
 boolean addAllItems(Collection items)
          Add the collection of the completion items to this result set.
 boolean addItem(CompletionItem item)
          Add the completion item to this result set.
 void estimateItems(int estimatedItemCount, int estimatedItemWidth)
          Indicate that adding of the items to this result set will likely need a long time so the resulting number of items and their visual size should be estimated so that the completion infrastructure can estimate the size of the popup window and display the items added subsequently without changing its bound extensively.
 void finish()
          Mark that this result set is finished and there will be no more modifications done to it.
 int getSortType()
          Get the sort type currently used by the code completion.
 boolean isFinished()
          Check whether this result set is finished.
 void setAnchorOffset(int anchorOffset)
          Set the document offset to which the returned completion items or documentation or tooltip should be anchored.
 void setDocumentation(CompletionDocumentation documentation)
          Set the documentation to this result set.
 void setTitle(String title)
          Set title that will be assigned to the completion popup window.
 void setToolTip(JToolTip toolTip)
          Set the tooltip to this result set.
 void setWaitText(String waitText)
          Set the explicit value displayed in a label when the completion results do not get computed during a certain timeout (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_SORT_TYPE

public static final int PRIORITY_SORT_TYPE
Sort type returned from getSortType() that prefers priority of the item (CompletionItem.getSortPriority()) over the text of the item (CompletionItem.getSortText()).

See Also:
Constant Field Values

TEXT_SORT_TYPE

public static final int TEXT_SORT_TYPE
Sort type returned from getSortType() that prefers text of the item (CompletionItem.getSortText()). over the priority of the item (CompletionItem.getSortPriority())

See Also:
Constant Field Values
Method Detail

setTitle

public void setTitle(String title)
Set title that will be assigned to the completion popup window.
It's only relevant to set the title when providing completion items for CompletionProvider.COMPLETION_QUERY_TYPE.
If there will be multiple completion providers setting this property for the given mime-type then only the first one (according to the xml-layer registration order) will be taken into account.


setAnchorOffset

public void setAnchorOffset(int anchorOffset)
Set the document offset to which the returned completion items or documentation or tooltip should be anchored.
If there will be multiple completion providers setting this property for the given mime-type then only the first one (according to the xml-layer registration order) will be taken into account.


addItem

public boolean addItem(CompletionItem item)
Add the completion item to this result set.
This method can be called multiple times until all the items have been added to ths result set.
After the adding is completed @link #finish()} must be called to confirm that the result set will no longer be modified.

Parameters:
item - non-null completion item.
Returns:
true if adding of the items can continue or false if there is already too many items to be practical to display in the listbox so subsequent adding should preferably be discontinued.

addAllItems

public boolean addAllItems(Collection items)
Add the collection of the completion items to this result set.
This method can be called multiple times until all the items have been added to ths result set.
After the adding is completed @link #finish()} must be called to confirm that the result set will no longer be modified.

Parameters:
items - collection of items to be added.
Returns:
true if adding of the items can continue or false if there is already too many items to be practical to display in the listbox so subsequent adding should preferably be discontinued.

estimateItems

public void estimateItems(int estimatedItemCount,
                          int estimatedItemWidth)
Indicate that adding of the items to this result set will likely need a long time so the resulting number of items and their visual size should be estimated so that the completion infrastructure can estimate the size of the popup window and display the items added subsequently without changing its bound extensively.
Without calling of this method the completion infrastructure will wait until finish() gets called on this result set before displaying any of the items added to this result set.

By calling of this method the task also confirms that the items added by addItem(CompletionItem) subsequently are already in the order corresponding to the getSortType().

Parameters:
estimatedItemCount - estimated number of the items that will be added to this result set by addItem(CompletionItem). If the estimate is significantly lower than the reality then the vertical scrollbar granularity may be decreased or the vertical scrollbar can be removed completely once the result set is finished. If the estimate is significantly higher than the reality then the vertical scrollbar granularity may be increased once the result set is finished.
estimatedItemWidth - estimated maximum visual width of a completion item.

setDocumentation

public void setDocumentation(CompletionDocumentation documentation)
Set the documentation to this result set.
Calling this method is only relevant for tasks created by CompletionProvider.createTask(int, javax.swing.text.JTextComponent) with CompletionProvider.DOCUMENTATION_QUERY_TYPE or for CompletionItem.createDocumentationTask().


setToolTip

public void setToolTip(JToolTip toolTip)
Set the tooltip to this result set.
Calling this method is only relevant for tasks created by CompletionProvider.createTask(int, javax.swing.text.JTextComponent) with CompletionProvider.TOOLTIP_QUERY_TYPE or for CompletionItem.createToolTipTask().


finish

public void finish()
Mark that this result set is finished and there will be no more modifications done to it.


isFinished

public boolean isFinished()
Check whether this result set is finished.

Returns:
true if the result set is already finished by previous call to finish().

getSortType

public int getSortType()
Get the sort type currently used by the code completion.
It's one of the PRIORITY_SORT_TYPE or TEXT_SORT_TYPE.


setWaitText

public void setWaitText(String waitText)
Set the explicit value displayed in a label when the completion results do not get computed during a certain timeout (e.g. 250ms).
If not set explicitly the completion infrastructure will use the default text.

Parameters:
waitText - description of what the query copmutation is currently (doing or waiting for).
After previous explicit setting null can be passed to restore using of the default text.
Since:
1.5

 

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