com.inet.html.actions
Class BeginEndLineAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by javax.swing.text.TextAction
          extended by javax.swing.text.StyledEditorKit.StyledTextAction
              extended by com.inet.html.actions.InetHtmlAction
                  extended by com.inet.html.actions.BeginEndLineAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class BeginEndLineAction
extends InetHtmlAction

Replace the wrong working class DefaultEditorKit.EndLineAction and DefaultEditorKit.BeginLineAction

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
BeginEndLineAction(java.lang.String name, boolean begin, boolean select)
          The constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          
static int getRowBeginEnd(javax.swing.text.JTextComponent textComp, int offs, boolean begin)
          Replace the wrong method Utilities.getRowEnd().
static java.awt.Rectangle modelToView(javax.swing.text.JTextComponent textComp, int offs)
          A call of HtmlRootView.nativeModelToView.
 
Methods inherited from class javax.swing.text.TextAction
augmentList
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeginEndLineAction

public BeginEndLineAction(java.lang.String name,
                          boolean begin,
                          boolean select)
The constructor.

Parameters:
name - the action name
select - whether to extend the selection when changing the caret position.
begin - whether move the cursor to begin or end of the line
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)


getRowBeginEnd

public static int getRowBeginEnd(javax.swing.text.JTextComponent textComp,
                                 int offs,
                                 boolean begin)
                          throws javax.swing.text.BadLocationException
Replace the wrong method Utilities.getRowEnd(). Find the cursor position at end of the row.

Parameters:
textComp - the JTextComponent
offs - the current position
begin - true to find the start of the row, false to find the end
Returns:
the position at end of row.
Throws:
javax.swing.text.BadLocationException - if a position does not represent a valid location in the associated document

modelToView

public static java.awt.Rectangle modelToView(javax.swing.text.JTextComponent textComp,
                                             int offs)
                                      throws javax.swing.text.BadLocationException
A call of HtmlRootView.nativeModelToView. This call can not be overridden and is independent from Zoom or Rotation of the editor.

Parameters:
textComp - current text editor
offs - chachter offset
Returns:
the bounding box, in view coordinate space, of the character at the specified position
Throws:
javax.swing.text.BadLocationException - if the specified position does not represent a valid location in the associated document