de.lessvoid.nifty.controls.textfield
Class TextFieldLogic

java.lang.Object
  extended by de.lessvoid.nifty.controls.textfield.TextFieldLogic

public class TextFieldLogic
extends Object

TextField logic.

Author:
void

Constructor Summary
TextFieldLogic(String newText, Clipboard newClipboard, TextFieldView textFieldView)
          Create TextField with clipboard support.
 
Method Summary
 void backspace()
          Backspace.
 void copy(Character passwordChar)
          Copy currently selected text to clipboard.
 void cursorLeft()
          Move cursor left.
 void cursorRight()
          Move cursor right.
 void cut(Character passwordChar)
          Cut the selected text into the clipboard.
 void delete()
          Delete the character at the cursor position.
 void endSelecting()
          end selecting.
 int getCursorPosition()
          Get cursor position.
 String getSelectedText()
          Return the selected text or null when there is no selection.
 int getSelectionEnd()
          Get selection end.
 int getSelectionStart()
          Get selection start.
 String getText()
          Return the current text.
 boolean hasSelection()
          checks if we currently have a selection.
 void initWithText(String newText)
          init instance wit the given text.
 void insert(char c)
          Insert character at cursor position.
 void put()
          Put data from clipboard into textfield.
 void resetSelection()
          reset the selection.
 void setCursorPosition(int newIndex)
          Set new cursor position.
 void setMaxLength(int maxLen)
           
 void startSelecting()
          start selecting.
 void toFirstPosition()
          Position cursor to first character.
 void toLastPosition()
          Position cursor to last character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFieldLogic

public TextFieldLogic(String newText,
                      Clipboard newClipboard,
                      TextFieldView textFieldView)
Create TextField with clipboard support.

Parameters:
newText - init text
newClipboard - clipboard
Method Detail

initWithText

public void initWithText(String newText)
init instance wit the given text.

Parameters:
newText - new text

getText

public String getText()
Return the current text.

Returns:
the current text

getCursorPosition

public int getCursorPosition()
Get cursor position.

Returns:
current cursor position

cursorLeft

public void cursorLeft()
Move cursor left.


cursorRight

public void cursorRight()
Move cursor right.


delete

public void delete()
Delete the character at the cursor position.


hasSelection

public boolean hasSelection()
checks if we currently have a selection.

Returns:
true or false

toFirstPosition

public void toFirstPosition()
Position cursor to first character.


toLastPosition

public void toLastPosition()
Position cursor to last character.


backspace

public void backspace()
Backspace.


resetSelection

public void resetSelection()
reset the selection.


insert

public void insert(char c)
Insert character at cursor position.

Parameters:
c -

setCursorPosition

public void setCursorPosition(int newIndex)
Set new cursor position.

Parameters:
newIndex - index.

getSelectionStart

public int getSelectionStart()
Get selection start.

Returns:
selection start index

getSelectionEnd

public int getSelectionEnd()
Get selection end.

Returns:
selection end index

startSelecting

public void startSelecting()
start selecting.


endSelecting

public void endSelecting()
end selecting.


getSelectedText

public String getSelectedText()
Return the selected text or null when there is no selection.

Returns:
selected text or null

cut

public void cut(Character passwordChar)
Cut the selected text into the clipboard.

Parameters:
passwordChar - password character might be null

copy

public void copy(Character passwordChar)
Copy currently selected text to clipboard.

Parameters:
passwordChar - password character might be null

put

public void put()
Put data from clipboard into textfield.


setMaxLength

public void setMaxLength(int maxLen)


Copyright © 2011. All Rights Reserved.