com.mucommander.ui.autocomplete.completers
Class Completer

java.lang.Object
  extended by com.mucommander.ui.autocomplete.completers.Completer
Direct Known Subclasses:
ComboboxOptionsCompleter, LocationCompleter, PathCompleter

public abstract class Completer
extends java.lang.Object

Interface that each type of completion must implement. It defines 2 methods: *

Author:
Arik Hadas, based on the code of Santhosh Kumar: http://www.jroller.com/santhosh/entry/file_path_autocompletion

Constructor Summary
Completer()
           
 
Method Summary
protected  java.util.Vector getPossibleCompletionsFromServices(java.lang.String path)
          Gather the possible completions for the given path from all the services registered to this completer.
protected abstract  java.util.Vector getUpdatedSuggestions(AutocompleterTextComponent component)
          This function gets an AutocompleterTextComponent and returns a Vector of suggestions for completion, for the component's value.
protected  void registerService(CompletionService service)
          Add service to this completer.
protected  java.lang.String tryToCompleteFromServices(java.lang.String selectedString)
          Given the selected string (from the auto-completion's list), try to get a completion from the registered services.
 boolean updateListData(javax.swing.JList list, AutocompleterTextComponent comp)
          update list model depending on the data in text component
abstract  void updateTextComponent(java.lang.String selected, AutocompleterTextComponent comp)
          update text component according to the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Completer

public Completer()
Method Detail

getUpdatedSuggestions

protected abstract java.util.Vector getUpdatedSuggestions(AutocompleterTextComponent component)
This function gets an AutocompleterTextComponent and returns a Vector of suggestions for completion, for the component's value.

Parameters:
component - - an AutocompleterTextComponent.
Returns:
Vector of suggestions for completion.

updateListData

public boolean updateListData(javax.swing.JList list,
                              AutocompleterTextComponent comp)
update list model depending on the data in text component

Parameters:
list - - auto-completion popup's list that should be updated.
comp - - text component
Returns:
true if an auto-completion popup with the updated list should be shown, false otherwise.

updateTextComponent

public abstract void updateTextComponent(java.lang.String selected,
                                         AutocompleterTextComponent comp)
update text component according to the given string.

Parameters:
selected - - selected item from auto-completion popup list.
comp - - text component.

registerService

protected void registerService(CompletionService service)
Add service to this completer. The order in which the services is being registered is important, see: tryToCompleteFromServices.

Parameters:
service - - Service to be added.

getPossibleCompletionsFromServices

protected java.util.Vector getPossibleCompletionsFromServices(java.lang.String path)
Gather the possible completions for the given path from all the services registered to this completer.

Parameters:
path - - The path to be completed.
Returns:
Vector that contain all the possible completions which were retured from the registered services.

tryToCompleteFromServices

protected java.lang.String tryToCompleteFromServices(java.lang.String selectedString)
Given the selected string (from the auto-completion's list), try to get a completion from the registered services. The first completion that found will be returned, thus the order in which the services are registered is significant.

Parameters:
selectedString - - selected string (from the auto-completion's list).
Returns:
null if could not found any completion for the given string from the registered services, otherwise the founded completion is returned.


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard