Package org.fife.ui.autocomplete
Class BasicCompletion
- java.lang.Object
-
- org.fife.ui.autocomplete.AbstractCompletion
-
- org.fife.ui.autocomplete.BasicCompletion
-
- All Implemented Interfaces:
java.lang.Comparable<Completion>
,Completion
- Direct Known Subclasses:
ShorthandCompletion
,VariableCompletion
public class BasicCompletion extends AbstractCompletion
A straightforwardCompletion
implementation. This implementation can be used if you have a relatively short number of static completions with no (or short) summaries.This implementation uses the replacement text as the input text. It also includes a "short description" field, which (if non-
null
), is used in the completion choices list.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
replacementText
private java.lang.String
shortDesc
private java.lang.String
summary
-
Constructor Summary
Constructors Constructor Description BasicCompletion(CompletionProvider provider, java.lang.String replacementText)
Constructor.BasicCompletion(CompletionProvider provider, java.lang.String replacementText, java.lang.String shortDesc)
Constructor.BasicCompletion(CompletionProvider provider, java.lang.String replacementText, java.lang.String shortDesc, java.lang.String summary)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getReplacementText()
Returns the text to insert as the result of this auto-completion.java.lang.String
getShortDescription()
Returns the short description of this completion, usually used in the completion choices list.java.lang.String
getSummary()
Returns the description of this auto-complete choice.void
setShortDescription(java.lang.String shortDesc)
Sets the short description of this completion.void
setSummary(java.lang.String summary)
Sets the summary for this completion.java.lang.String
toString()
Returns a string representation of this completion.-
Methods inherited from class org.fife.ui.autocomplete.AbstractCompletion
compareTo, getAlreadyEntered, getIcon, getInputText, getProvider, getRelevance, getToolTipText, setIcon, setRelevance
-
-
-
-
Constructor Detail
-
BasicCompletion
public BasicCompletion(CompletionProvider provider, java.lang.String replacementText)
Constructor.- Parameters:
provider
- The parent completion provider.replacementText
- The text to replace.
-
BasicCompletion
public BasicCompletion(CompletionProvider provider, java.lang.String replacementText, java.lang.String shortDesc)
Constructor.- Parameters:
provider
- The parent completion provider.replacementText
- The text to replace.shortDesc
- A short description of the completion. This will be displayed in the completion list. This may benull
.
-
BasicCompletion
public BasicCompletion(CompletionProvider provider, java.lang.String replacementText, java.lang.String shortDesc, java.lang.String summary)
Constructor.- Parameters:
provider
- The parent completion provider.replacementText
- The text to replace.shortDesc
- A short description of the completion. This will be displayed in the completion list. This may benull
.summary
- The summary of this completion. This should be HTML. This may benull
.
-
-
Method Detail
-
getReplacementText
public java.lang.String getReplacementText()
Description copied from interface:Completion
Returns the text to insert as the result of this auto-completion. This is the "complete" text, including any text that replaces what the user has already typed.- Returns:
- The replacement text.
- See Also:
Completion.getInputText()
-
getShortDescription
public java.lang.String getShortDescription()
Returns the short description of this completion, usually used in the completion choices list.- Returns:
- The short description, or
null
if there is none. - See Also:
setShortDescription(String)
-
getSummary
public java.lang.String getSummary()
Description copied from interface:Completion
Returns the description of this auto-complete choice. This can be used in a popup "description window."- Returns:
- This item's description. This should be HTML. It may be
null
if there is no description for this completion.
-
setShortDescription
public void setShortDescription(java.lang.String shortDesc)
Sets the short description of this completion.- Parameters:
shortDesc
- The short description of this completion.- See Also:
getShortDescription()
-
setSummary
public void setSummary(java.lang.String summary)
Sets the summary for this completion.- Parameters:
summary
- The summary for this completion.- See Also:
getSummary()
-
toString
public java.lang.String toString()
Returns a string representation of this completion. If the short description is notnull
, this method will return:getInputText() + " - " + shortDesc
otherwise, it will return
getInputText()
.- Overrides:
toString
in classAbstractCompletion
- Returns:
- A string representation of this completion.
-
-