jimm.datavision.gui
Class TextFieldWidget

java.lang.Object
  extended by jimm.datavision.gui.FieldWidget
      extended by jimm.datavision.gui.TextFieldWidget
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, java.util.Observer, javax.swing.event.MouseInputListener

public class TextFieldWidget
extends FieldWidget

A text field widget is a field widget that is editable.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  boolean changingEditState
           
protected  int lineHeight
           
protected  int origHeight
           
protected  TypingCommand typingCommand
           
 
Fields inherited from class jimm.datavision.gui.FieldWidget
action, ACTION_INACTION, ACTION_MOVE, ACTION_POPPING_UP_MENU, ACTION_STRETCH_BOTTOM, ACTION_STRETCH_LEFT, ACTION_STRETCH_RIGHT, ACTION_STRETCH_TOP, actionStartedYet, aggregatesMenuItem, alignSubmenu, componentMap, formatMenuItem, GRAB_EDGE_WIDTH, MIN_SIZE, mouseChangedSelectedState, nameItem, popup, POPUP_FONT, preMoveInfo, preStretchInfo, sectionWidget, selected, showOrHide, sizeSubmenu, swingField
 
Constructor Summary
TextFieldWidget(SectionWidget sw, Field field)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Performs some action based on the action command string (the menu item text).
protected  void addCustomPopupItems()
          This hook lets subclasses customize the popup menu.
protected  void cursorForPosition(java.awt.event.MouseEvent e)
          If this field is being edited, show text cursor.
protected  void doSelect(boolean makeSelected)
          Perform selection; if becoming deselected, ends editing.
protected  void endEditing()
          Stores new value and bounds from self into field and makes text non-editable.
protected  java.lang.String getPopupNameText()
          Returns string to use for popup menu's first item, the (disabled) name of this field.
 void keyTyped(java.awt.event.KeyEvent e)
          Handles return key by expanding height of editor and backspace and delete by shrinking height if newline is deleted.
 void mouseClicked(java.awt.event.MouseEvent e)
          if this is a double-click, start editing; else handle the mouse event like a normal field widget.
 void startEditing()
          Makes our text editable and starts editing.
 
Methods inherited from class jimm.datavision.gui.FieldWidget
actionFromPosition, align, buildPopupMenu, delete, doDelete, doDrag, doSetVisibility, dragEnter, dragExit, dragOver, drop, dropActionChanged, enableMenuItems, finalize, findFieldWidgetOwning, getColor, getComponent, getField, getPreMoveInfo, getSectionWidget, isSelected, keyPressed, keyReleased, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mousePressReleaseCommon, mouseReleased, moveToSection, pickUp, putDown, resetCursor, select, setVisibilityLook, showPopupMenu, size, snapBack, startStretching, stopStretching, toggleVisibility, toString, update, usesFormat
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

origHeight

protected int origHeight

lineHeight

protected int lineHeight

changingEditState

protected boolean changingEditState

typingCommand

protected TypingCommand typingCommand
Constructor Detail

TextFieldWidget

public TextFieldWidget(SectionWidget sw,
                       Field field)
Constructor.

Parameters:
sw - section widget in which the field's new widget will reside
field - a report field
Method Detail

getPopupNameText

protected java.lang.String getPopupNameText()
Description copied from class: FieldWidget
Returns string to use for popup menu's first item, the (disabled) name of this field.

Overrides:
getPopupNameText in class FieldWidget

addCustomPopupItems

protected void addCustomPopupItems()
Description copied from class: FieldWidget
This hook lets subclasses customize the popup menu. By default, nothing happens.

Overrides:
addCustomPopupItems in class FieldWidget

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Performs some action based on the action command string (the menu item text).

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class FieldWidget

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
if this is a double-click, start editing; else handle the mouse event like a normal field widget.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class FieldWidget
Parameters:
e - mouse event

startEditing

public void startEditing()
Makes our text editable and starts editing.


endEditing

protected void endEditing()
Stores new value and bounds from self into field and makes text non-editable.


doSelect

protected void doSelect(boolean makeSelected)
Perform selection; if becoming deselected, ends editing.

Overrides:
doSelect in class FieldWidget
Parameters:
makeSelected - new selection state

cursorForPosition

protected void cursorForPosition(java.awt.event.MouseEvent e)
If this field is being edited, show text cursor. Else call superclass method.

Overrides:
cursorForPosition in class FieldWidget
Parameters:
e - a mouse event

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Handles return key by expanding height of editor and backspace and delete by shrinking height if newline is deleted.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Overrides:
keyTyped in class FieldWidget
Parameters:
e - key event