TV-Browser 3.3.3 API

util.ui.findasyoutype
Class TextComponentFindAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by util.ui.findasyoutype.FindAction
          extended by util.ui.findasyoutype.TextComponentFindAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, java.util.EventListener, javax.swing.Action, javax.swing.event.DocumentListener

public class TextComponentFindAction
extends FindAction
implements java.awt.event.FocusListener, java.awt.event.ComponentListener

This TextComponentFindAction is based on the Implementation of Santosh For Details look here: http://jroller.com/page/santhosh/20050707#incremental_search_jtextcomponent

Author:
Santhosh Changed for support of a search bar instead of a search popup by René Mach: - added the needed components for the search bar - added ComponentListener to initialize the search when the search bar becomes visible - added Runnable to support closing the search bar automatically if the search was started with a key type. - added Localizer - added MouseAdapter for the search bar buttons
See Also:
Serialized Form

Field Summary
 
Fields inherited from class util.ui.findasyoutype.FindAction
controlDown, metaDown, shiftDown
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
TextComponentFindAction(javax.swing.text.JTextComponent comp)
           
TextComponentFindAction(javax.swing.text.JTextComponent comp, boolean startAtKeyType)
           
 
Method Summary
protected  boolean changed(javax.swing.JComponent comp, java.lang.String str, javax.swing.text.Position.Bias bias)
           
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 javax.swing.JButton getCloseButton()
           
protected  int getNextMatch(javax.swing.text.JTextComponent textComp, java.lang.String str, int startingOffset, javax.swing.text.Position.Bias bias)
           
 javax.swing.JPanel getSearchBar()
           
 javax.swing.text.JTextComponent getTextComponent()
           
protected  void initSearch(java.awt.event.ActionEvent ae)
           
 void interrupt()
          Interrupts the closing Thread.
 boolean isAlwaysVisible()
           
 void run()
          Waits for closing of the panel.
 void showSearchBar()
          Shows the search bar
 
Methods inherited from class util.ui.findasyoutype.FindAction
actionPerformed, changedUpdate, getComponent, getMessageLabel, getSearchField, getThread, getWaitTime, insertUpdate, installKeyListener, isBlockAutoClosing, isIgnoreCase, keyPressed, keyReleased, keyTyped, next, prev, removeUpdate, reset, setBlockAutoClosing, setIgnoreCase, setWaitTime
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextComponentFindAction

public TextComponentFindAction(javax.swing.text.JTextComponent comp)

TextComponentFindAction

public TextComponentFindAction(javax.swing.text.JTextComponent comp,
                               boolean startAtKeyType)
Method Detail

initSearch

protected void initSearch(java.awt.event.ActionEvent ae)
Overrides:
initSearch in class FindAction

changed

protected boolean changed(javax.swing.JComponent comp,
                          java.lang.String str,
                          javax.swing.text.Position.Bias bias)
Specified by:
changed in class FindAction

getNextMatch

protected int getNextMatch(javax.swing.text.JTextComponent textComp,
                           java.lang.String str,
                           int startingOffset,
                           javax.swing.text.Position.Bias bias)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

getTextComponent

public javax.swing.text.JTextComponent getTextComponent()

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

run

public void run()
Waits for closing of the panel.

Specified by:
run in interface java.lang.Runnable

interrupt

public void interrupt()
Interrupts the closing Thread.


getSearchBar

public javax.swing.JPanel getSearchBar()
Returns:
The search bar

showSearchBar

public void showSearchBar()
Shows the search bar


isAlwaysVisible

public boolean isAlwaysVisible()
Returns:
If the search bar isVisible and will not be closed automatically.

getCloseButton

public javax.swing.JButton getCloseButton()
Returns:
The close button of the search bar.

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)