com.inet.jortho
Class CheckerListener

java.lang.Object
  extended by com.inet.jortho.CheckerListener
All Implemented Interfaces:
LanguageChangeListener, java.util.EventListener, javax.swing.event.PopupMenuListener

public class CheckerListener
extends java.lang.Object
implements javax.swing.event.PopupMenuListener, LanguageChangeListener

Is used from CheckerMenu and CheckerPopup to handle the user events.


Method Summary
protected  void addMenuItemAddToDictionary(javax.swing.text.JTextComponent jText, java.lang.String word, boolean addSeparator)
          Add the menu item "Add to Dictionary" at the end of the menu if a user dictionary is available.
protected  void addSuggestionMenuItem(javax.swing.text.JTextComponent jText, int begOffs, int endOffs, java.util.List<com.inet.jortho.Suggestion> list, boolean needCapitalization)
          Add menu items to the with suggestions to the menu.
protected  int getCursorPosition(javax.swing.text.JTextComponent jText)
          Get the cursor position for the popup menu
 void languageChanged(LanguageChangeEvent ev)
          This method gets called when the language is changed.
 void popupMenuCanceled(javax.swing.event.PopupMenuEvent e)
          
 void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e)
          
 void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent ev)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

popupMenuCanceled

public void popupMenuCanceled(javax.swing.event.PopupMenuEvent e)

Specified by:
popupMenuCanceled in interface javax.swing.event.PopupMenuListener

popupMenuWillBecomeInvisible

public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e)

Specified by:
popupMenuWillBecomeInvisible in interface javax.swing.event.PopupMenuListener

popupMenuWillBecomeVisible

public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent ev)

Specified by:
popupMenuWillBecomeVisible in interface javax.swing.event.PopupMenuListener

getCursorPosition

protected int getCursorPosition(javax.swing.text.JTextComponent jText)
                         throws javax.swing.text.BadLocationException
Get the cursor position for the popup menu

Parameters:
jText - current JTextComponent
Returns:
the current position
Throws:
javax.swing.text.BadLocationException - should never occur

addSuggestionMenuItem

protected void addSuggestionMenuItem(javax.swing.text.JTextComponent jText,
                                     int begOffs,
                                     int endOffs,
                                     java.util.List<com.inet.jortho.Suggestion> list,
                                     boolean needCapitalization)
Add menu items to the with suggestions to the menu.

Parameters:
jText - current JTextComponent
begOffs - offset of the current word in the JTextComponent, need for replacement
endOffs - end of the current word in the JTextComponent, need for replacement
list - a list with suggestions
needCapitalization - if the first letter of the suggestion should capitalized

addMenuItemAddToDictionary

protected void addMenuItemAddToDictionary(javax.swing.text.JTextComponent jText,
                                          java.lang.String word,
                                          boolean addSeparator)
Add the menu item "Add to Dictionary" at the end of the menu if a user dictionary is available.

Parameters:
jText - current JTextComponent
word - current word, which can be add
addSeparator - true, add a separator before the menu item

languageChanged

public void languageChanged(LanguageChangeEvent ev)
This method gets called when the language is changed. This occurs if the user selects another language in the languages menu.

Specified by:
languageChanged in interface LanguageChangeListener
Parameters:
ev - A LanguageChangeEvent object describing the changes.


Copyright © 2005 - 2009 i-net software. All Rights Reserved.