org.jcreme.swing
Class DefaultCompletionModel

java.lang.Object
  extended byorg.jcreme.swing.DefaultCompletionModel
All Implemented Interfaces:
CompletionModel

public class DefaultCompletionModel
extends java.lang.Object
implements CompletionModel

This is a default implementation of the CompletionModel interface. When no completionListElementFormat is provided it uses the toString method to convert objects into Strings for completion. The default pattern has an empty prefix ("") and an open suffix ("%").

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $

Field Summary
 
Fields inherited from interface org.jcreme.swing.CompletionModel
COMPLETION_LIST_ELEMENT_FORMAT_PROPERTY
 
Constructor Summary
DefaultCompletionModel(java.util.Collection c)
          Creates a new DefaultCompletionModel.
DefaultCompletionModel(java.lang.Object[] array)
          Creates a new DefaultCompletionModel.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          This method ensures that the implementations of this interface provide bean services.
 java.text.Format getCompletionListElementFormat()
          This method gives access to the Format implementation that enables to perform the completion on objects.
 java.lang.String getCompletionPrefix()
          Gives access to the current prefix of the completion pattern.
 java.util.Collection getCompletions(java.lang.String seed)
          Enables to access a list of possible completions for a given String.
 java.lang.String getCompletionSuffix()
          Gives access to the current suffix of the completion pattern.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          This method ensures that the implementations of this interface provide bean services.
 void setCompletionList(java.util.Collection c)
          This method enables to set the collection of values from which to look for a completion.
 void setCompletionListElementFormat(java.text.Format f)
          This method enables to change the Format implementation that will be used to transform non String objects into Strings to perform the completion.
 void setCompletionPrefix(java.lang.String prefix)
          Enables to change the pattern that will be matched in front of the text to complete.
 void setCompletionSuffix(java.lang.String suffix)
          Enables to change the pattern that will be matched in after the text to complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCompletionModel

public DefaultCompletionModel(java.util.Collection c)
Creates a new DefaultCompletionModel.

Parameters:
c - the completionList to use.

DefaultCompletionModel

public DefaultCompletionModel(java.lang.Object[] array)
Creates a new DefaultCompletionModel.

Parameters:
array - the completionList to use.
Method Detail

getCompletionPrefix

public java.lang.String getCompletionPrefix()
Description copied from interface: CompletionModel
Gives access to the current prefix of the completion pattern.

Specified by:
getCompletionPrefix in interface CompletionModel
Returns:
the current prefix used.
See Also:
CompletionModel.getCompletionPrefix()

getCompletions

public java.util.Collection getCompletions(java.lang.String seed)
Description copied from interface: CompletionModel
Enables to access a list of possible completions for a given String.

Specified by:
getCompletions in interface CompletionModel
Parameters:
seed - the String to complete in the completionList.
Returns:
a Collection of possible completions.
See Also:
CompletionModel.getCompletions(java.lang.String)

getCompletionSuffix

public java.lang.String getCompletionSuffix()
Description copied from interface: CompletionModel
Gives access to the current suffix of the completion pattern.

Specified by:
getCompletionSuffix in interface CompletionModel
Returns:
the current suffix used.
See Also:
CompletionModel.getCompletionSuffix()

setCompletionListElementFormat

public void setCompletionListElementFormat(java.text.Format f)
Description copied from interface: CompletionModel
This method enables to change the Format implementation that will be used to transform non String objects into Strings to perform the completion.

Specified by:
setCompletionListElementFormat in interface CompletionModel
Parameters:
f - a Format implementation.
See Also:
CompletionModel.setCompletionListElementFormat(java.text.Format)

setCompletionList

public void setCompletionList(java.util.Collection c)
Description copied from interface: CompletionModel
This method enables to set the collection of values from which to look for a completion. The collection can contain Objects of different types (not necessarily Strings) as long as the completionListElementFormat can handle them.

Specified by:
setCompletionList in interface CompletionModel
Parameters:
c - the collection from which a completion has to be found.
See Also:
CompletionModel.setCompletionList(java.util.Collection)

setCompletionPrefix

public void setCompletionPrefix(java.lang.String prefix)
Description copied from interface: CompletionModel
Enables to change the pattern that will be matched in front of the text to complete.

Specified by:
setCompletionPrefix in interface CompletionModel
Parameters:
prefix - a pattern using % and ? as wildcards in the usual SQL manner.
See Also:
CompletionModel.setCompletionPrefix(java.lang.String)

setCompletionSuffix

public void setCompletionSuffix(java.lang.String suffix)
Description copied from interface: CompletionModel
Enables to change the pattern that will be matched in after the text to complete.

Specified by:
setCompletionSuffix in interface CompletionModel
Parameters:
suffix - a pattern using % and ? as wildcards in the usual SQL manner.
See Also:
CompletionModel.setCompletionSuffix(java.lang.String)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: CompletionModel
This method ensures that the implementations of this interface provide bean services.

Specified by:
addPropertyChangeListener in interface CompletionModel
Parameters:
l - a listener.
See Also:
CompletionModel.addPropertyChangeListener(java.beans.PropertyChangeListener)

getCompletionListElementFormat

public java.text.Format getCompletionListElementFormat()
Description copied from interface: CompletionModel
This method gives access to the Format implementation that enables to perform the completion on objects.

Specified by:
getCompletionListElementFormat in interface CompletionModel
Returns:
the Format implementation currently in use.
See Also:
CompletionModel.getCompletionListElementFormat()

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: CompletionModel
This method ensures that the implementations of this interface provide bean services.

Specified by:
removePropertyChangeListener in interface CompletionModel
Parameters:
l - a listener.
See Also:
CompletionModel.removePropertyChangeListener(java.beans.PropertyChangeListener)


Copyright 2006 null. All Rights Reserved.