org.nakedobjects.plugins.dnd.viewer.view.field
Class TextField

java.lang.Object
  extended by org.nakedobjects.plugins.dnd.viewer.view.simple.AbstractView
      extended by org.nakedobjects.plugins.dnd.viewer.view.field.AbstractField
          extended by org.nakedobjects.plugins.dnd.viewer.view.field.TextParseableFieldAbstract
              extended by org.nakedobjects.plugins.dnd.viewer.view.field.TextField
All Implemented Interfaces:
java.lang.Cloneable, View, TextBlockTarget
Direct Known Subclasses:
PasswordField, SingleLineTextField, WrappedTextField

public abstract class TextField
extends TextParseableFieldAbstract
implements TextBlockTarget


Field Summary
protected  CursorPosition cursor
           
protected  TextSelection selection
           
protected static Text style
           
protected  TextContent textContent
           
 
Fields inherited from class org.nakedobjects.plugins.dnd.viewer.view.field.AbstractField
TEXT_WIDTH
 
Fields inherited from interface org.nakedobjects.plugins.dnd.View
HPADDING, VPADDING
 
Constructor Summary
TextField(TextParseableContent content, ViewSpecification specification, ViewAxis axis, boolean showLines, int wrapStyle)
           
 
Method Summary
protected abstract  void align()
           
protected  void changeMade()
           
protected  void clear()
           
 void contentMenuOptions(UserActionSet options)
          Called when the popup menu is being populated for this view.
protected  void copyToClipboard()
           
 void debug(DebugString debug)
          Returns debug details about this view.
 void delete()
          Delete the character to the left of the cursor.
 void deleteForward()
          Delete the character to the right of the cursor.
protected  void down(boolean shift)
           
 void drag(InternalDrag drag)
          Indicates the drag started within this view's bounds is continuing.
 Drag dragStart(DragStart drag)
           
 void dragTo(InternalDrag drag)
          Indicates the drag started within this view's bounds has been finished (although the location may now be outside of its bounds).
 void draw(Canvas canvas)
          Called by the frame, or the parent view, when this view must redraw itself.
protected abstract  void drawHighlight(Canvas canvas, int maxWidth)
           
protected abstract  void drawLines(Canvas canvas, Color color, int width)
           
protected abstract  void drawText(Canvas canvas, Color textColor, int width)
           
 void editComplete(boolean moveFocus, boolean toNextField)
          Indicates that editing has been completed and the entry should be saved.
protected  void end(boolean alt, boolean shift)
           
protected  boolean enter()
          Called when 'enter' has been pressed.
 void entered()
          Called as the mouse crosses the bounds, and ends up inside, of this view.
protected  void escape()
           
 void exited()
          Called as the mouse crosses the bounds, and ends up outside, of this view.
 void firstClick(Click click)
          Responds to first click by placing the cursor between the two characters nearest the point of the mouse.
 void focusLost()
           
 void focusReceived()
           
 int getBaseline()
           
 int getMaxFieldWidth()
          Maximum text entry width.
 Size getMaximumSize()
           
 Text getText()
           
 boolean hasInvalidEntry()
           
protected  void home(boolean alt, boolean shift)
           
 boolean isIdentified()
           
 void keyPressed(KeyboardAction key)
          Called when the user presses any key on the keyboard while this view has the focus.
 void keyReleased(int keyCode, int modifiers)
          Called when the user releases any key on the keyboard while this view has the focus.
 void keyTyped(char keyCode)
          Called when the user presses a non-control key (i.e.
protected  void left(boolean alt, boolean shift)
           
protected  void pageDown(boolean shift, boolean ctrl)
           
protected  void pageUp(boolean shift, boolean ctrl)
           
protected  void pasteFromClipboard()
           
 void refresh()
          Refreshes this view by reaccessing its content and redisplaying it.
protected  void right(boolean alt, boolean shift)
           
protected  void save()
           
 void secondClick(Click click)
          Called when the user double-clicked this view.
 void setSize(Size size)
           
 void setWidth(int width)
          Set the width of the field, as a number of pixels
protected  void tab(boolean moveToNextField)
           
 void thirdClick(Click click)
          Called when the user triple-clicks the mouse buttone within this view.
protected  void up(boolean shift)
           
 
Methods inherited from class org.nakedobjects.plugins.dnd.viewer.view.field.TextParseableFieldAbstract
canChangeValue, cantClear, isEmpty, parseEntry, provideClearCopyPaste, saveValue
 
Methods inherited from class org.nakedobjects.plugins.dnd.viewer.view.field.AbstractField
canFocus, dragCancel, dragFrom, getIdentified, getPadding, getRoot, hasFocus, indicatesForView, initiateSave, toString, viewAreaType
 
Methods inherited from class org.nakedobjects.plugins.dnd.viewer.view.simple.AbstractView
addView, assignId, contains, containsFocus, debugStructure, dispose, drag, dragIn, dragOut, drop, drop, getAbsoluteLocation, getBounds, getContent, getFeedbackManager, getFocusManager, getId, getLocation, getParent, getRequiredSize, getSize, getSpecification, getState, getSubviews, getView, getViewAxis, getViewManager, getWorkspace, identify, invalidateContent, invalidateLayout, layout, limitBoundsWithin, limitBoundsWithin, markDamaged, markDamaged, mouseDown, mouseMoved, mouseUp, objectActionResult, pickupContent, pickupView, print, removeView, replaceOptions, replaceView, setBounds, setContent, setFocusManager, setLocation, setMaximumSize, setParent, setSpecification, setView, setViewAxis, subviewFor, update, updateView, viewMenuOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

style

protected static final Text style

cursor

protected CursorPosition cursor

selection

protected TextSelection selection

textContent

protected TextContent textContent
Constructor Detail

TextField

public TextField(TextParseableContent content,
                 ViewSpecification specification,
                 ViewAxis axis,
                 boolean showLines,
                 int wrapStyle)
Method Detail

align

protected abstract void align()

contentMenuOptions

public void contentMenuOptions(UserActionSet options)
Description copied from interface: View
Called when the popup menu is being populated for this view. Any content options that need to appear on the menu should be added to the menuOptions object.

Specified by:
contentMenuOptions in interface View
Overrides:
contentMenuOptions in class AbstractField

clear

protected void clear()
Overrides:
clear in class TextParseableFieldAbstract

copyToClipboard

protected void copyToClipboard()
Overrides:
copyToClipboard in class TextParseableFieldAbstract

debug

public void debug(DebugString debug)
Description copied from class: AbstractView
Returns debug details about this view.

Specified by:
debug in interface View
Overrides:
debug in class AbstractView

delete

public void delete()
Delete the character to the left of the cursor.


deleteForward

public void deleteForward()
Delete the character to the right of the cursor.


down

protected void down(boolean shift)

drag

public void drag(InternalDrag drag)
Description copied from class: AbstractField
Indicates the drag started within this view's bounds is continuing. By default does nothing.

Specified by:
drag in interface View
Overrides:
drag in class AbstractField

dragStart

public Drag dragStart(DragStart drag)
Specified by:
dragStart in interface View
Overrides:
dragStart in class AbstractView

dragTo

public void dragTo(InternalDrag drag)
Description copied from class: AbstractField
Indicates the drag started within this view's bounds has been finished (although the location may now be outside of its bounds). By default does nothing.

Specified by:
dragTo in interface View
Overrides:
dragTo in class AbstractField

draw

public void draw(Canvas canvas)
Description copied from interface: View
Called by the frame, or the parent view, when this view must redraw itself.

Specified by:
draw in interface View
Overrides:
draw in class AbstractField

drawHighlight

protected abstract void drawHighlight(Canvas canvas,
                                      int maxWidth)

drawLines

protected abstract void drawLines(Canvas canvas,
                                  Color color,
                                  int width)

drawText

protected abstract void drawText(Canvas canvas,
                                 Color textColor,
                                 int width)

editComplete

public void editComplete(boolean moveFocus,
                         boolean toNextField)
Description copied from interface: View
Indicates that editing has been completed and the entry should be saved. Will be called by the view manager when other action place within the parent.

Specified by:
editComplete in interface View
Overrides:
editComplete in class AbstractView
Parameters:
moveFocus - flags that focus should be moved from this field after the entry has been processed.
toNextField - flags that the focus should be moved to the next field (if true) or to the previous field (if false). This parameter is ignored if the moveFocus parameter is false.

end

protected void end(boolean alt,
                   boolean shift)

enter

protected boolean enter()
Called when 'enter' has been pressed. Return indicates whether event has been consumed; by default it hasn't. This default implementation marks field as having edit completed.


entered

public void entered()
Description copied from interface: View
Called as the mouse crosses the bounds, and ends up inside, of this view. Is also called as the mouse returns into this view from a contained view.

Specified by:
entered in interface View
Overrides:
entered in class AbstractField

escape

protected void escape()

exited

public void exited()
Description copied from interface: View
Called as the mouse crosses the bounds, and ends up outside, of this view.

Specified by:
exited in interface View
Overrides:
exited in class AbstractField

firstClick

public void firstClick(Click click)
Responds to first click by placing the cursor between the two characters nearest the point of the mouse.

Specified by:
firstClick in interface View
Overrides:
firstClick in class AbstractView
Parameters:
click - the location within the current view where the mouse click took place

focusLost

public void focusLost()
Specified by:
focusLost in interface View
Overrides:
focusLost in class AbstractView

focusReceived

public void focusReceived()
Specified by:
focusReceived in interface View
Overrides:
focusReceived in class AbstractView

getBaseline

public int getBaseline()
Specified by:
getBaseline in interface View
Overrides:
getBaseline in class AbstractField

getMaximumSize

public Size getMaximumSize()
Specified by:
getMaximumSize in interface View
Overrides:
getMaximumSize in class AbstractView

getMaxFieldWidth

public int getMaxFieldWidth()
Description copied from interface: TextBlockTarget
Maximum text entry width.

Specified by:
getMaxFieldWidth in interface TextBlockTarget

getText

public Text getText()
Specified by:
getText in interface TextBlockTarget

home

protected void home(boolean alt,
                    boolean shift)

changeMade

protected void changeMade()

isIdentified

public boolean isIdentified()

keyPressed

public void keyPressed(KeyboardAction key)
Called when the user presses any key on the keyboard while this view has the focus.

Specified by:
keyPressed in interface View
Overrides:
keyPressed in class AbstractField
Parameters:
key - TODO

keyReleased

public void keyReleased(int keyCode,
                        int modifiers)
Called when the user releases any key on the keyboard while this view has the focus.

Specified by:
keyReleased in interface View
Overrides:
keyReleased in class AbstractField

keyTyped

public void keyTyped(char keyCode)
Called when the user presses a non-control key (i.e. data entry keys and not shift, up-arrow etc). Such a key press will result in a prior call to keyPressed and a subsequent call to keyReleased.

Specified by:
keyTyped in interface View
Overrides:
keyTyped in class AbstractField

left

protected void left(boolean alt,
                    boolean shift)

pageDown

protected void pageDown(boolean shift,
                        boolean ctrl)

pageUp

protected void pageUp(boolean shift,
                      boolean ctrl)

pasteFromClipboard

protected void pasteFromClipboard()
Overrides:
pasteFromClipboard in class TextParseableFieldAbstract

refresh

public void refresh()
Description copied from interface: View
Refreshes this view by reaccessing its content and redisplaying it.

Specified by:
refresh in interface View
Overrides:
refresh in class AbstractView

right

protected void right(boolean alt,
                     boolean shift)

save

protected void save()
Specified by:
save in class AbstractField

secondClick

public void secondClick(Click click)
Description copied from interface: View
Called when the user double-clicked this view. This method will have been preceded by a call to click.

Specified by:
secondClick in interface View
Overrides:
secondClick in class AbstractView

setWidth

public void setWidth(int width)
Set the width of the field, as a number of pixels


setSize

public void setSize(Size size)
Specified by:
setSize in interface View
Overrides:
setSize in class AbstractView

tab

protected void tab(boolean moveToNextField)

thirdClick

public void thirdClick(Click click)
Description copied from interface: View
Called when the user triple-clicks the mouse buttone within this view. This method will have been preceded by a call to doubleClick.

Specified by:
thirdClick in interface View
Overrides:
thirdClick in class AbstractView

up

protected void up(boolean shift)

hasInvalidEntry

public boolean hasInvalidEntry()


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.