palmed.edit
Class TextBox

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by palmed.ui.Container
              extended by palmed.edit.TextBox
All Implemented Interfaces:
ITextBox, ISelectionView, ITextView, IView, ISerializable, ILayoutManager

public final class TextBox
extends Container
implements IView, ITextBox

This class implements a custom text box component.

Version:
$Revision: 381 $ $Date: 2005-12-30 16:44:33 +0900 (ven., 30 déc. 2005) $
Author:
Mathieu Champlon

Field Summary
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
TextBox()
          Create a text box.
 
Method Summary
 void clear()
          Clear the text box.
 void copy(java.io.OutputStream stream)
          Copy the current selected text.
 void cut(java.io.OutputStream stream)
          Cut the current selected text.
 void delete()
          Delete any resource associated to the current content.
 boolean hasBeenModified()
          Test the modification flag.
protected  void keyPressed(int keyCode)
          
protected  void keyRepeated(int keyCode)
          
 void marshall(java.io.OutputStream stream)
          Write to an output stream.
 void modified(boolean status)
          Notify the modification flag has changed.
 void paste(java.io.InputStream stream)
          Paste the given text.
 void read(java.io.InputStream stream)
          Reset the text box and read text from a stream.
 void redo()
          Redo the last undo.
 void setFont(java.lang.String name)
          Change the font.
 void setLineSeparator(java.lang.String separator)
          Change the line separator.
 void undo()
          Undo the last action.
 void unmarshall(java.io.InputStream stream)
          Read from an input stream.
 void update(Coordinate position)
          Notify the insertion position has changed.
 void update(int columns, int lines)
          Notify the text bounding box has changed.
 void write(java.io.OutputStream stream)
          Write text to a stream.
 
Methods inherited from class palmed.ui.Container
add, paint, pointerDragged, pointerPressed, pointerReleased, refresh, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyReleased, repaint, repaint, serviceRepaints, setFullScreenMode, showNotify
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBox

public TextBox()
Create a text box.

Method Detail

keyPressed

protected void keyPressed(int keyCode)

Overrides:
keyPressed in class javax.microedition.lcdui.Canvas

keyRepeated

protected void keyRepeated(int keyCode)

Overrides:
keyRepeated in class javax.microedition.lcdui.Canvas

update

public void update(int columns,
                   int lines)
Notify the text bounding box has changed.

Specified by:
update in interface ITextView
Parameters:
columns - the number of columns
lines - the number of lines

update

public void update(Coordinate position)
Notify the insertion position has changed.

Specified by:
update in interface ISelectionView
Parameters:
position - the new position

unmarshall

public void unmarshall(java.io.InputStream stream)
                throws java.io.IOException
Read from an input stream.

Specified by:
unmarshall in interface ISerializable
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

marshall

public void marshall(java.io.OutputStream stream)
              throws java.io.IOException
Write to an output stream.

Specified by:
marshall in interface ISerializable
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

read

public void read(java.io.InputStream stream)
          throws java.io.IOException
Reset the text box and read text from a stream.

Specified by:
read in interface ITextBox
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

write

public void write(java.io.OutputStream stream)
           throws java.io.IOException
Write text to a stream.

Specified by:
write in interface ITextBox
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

hasBeenModified

public boolean hasBeenModified()
Test the modification flag.

Specified by:
hasBeenModified in interface ITextBox
Returns:
whether the text has been modified since it has been read or written

clear

public void clear()
Clear the text box.

Specified by:
clear in interface ITextBox

copy

public void copy(java.io.OutputStream stream)
          throws java.io.IOException
Copy the current selected text.

Specified by:
copy in interface ITextBox
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

cut

public void cut(java.io.OutputStream stream)
         throws java.io.IOException
Cut the current selected text.

Specified by:
cut in interface ITextBox
Parameters:
stream - the stream to write to
Throws:
java.io.IOException - an io exception occurs

paste

public void paste(java.io.InputStream stream)
           throws java.io.IOException
Paste the given text.

Specified by:
paste in interface ITextBox
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

modified

public void modified(boolean status)
Notify the modification flag has changed.

Specified by:
modified in interface ITextView
Parameters:
status - the new modification status

delete

public void delete()
Delete any resource associated to the current content.

Specified by:
delete in interface ITextBox

undo

public void undo()
Undo the last action.

Specified by:
undo in interface ITextBox

redo

public void redo()
Redo the last undo.

Specified by:
redo in interface ITextBox

setLineSeparator

public void setLineSeparator(java.lang.String separator)
Change the line separator.

To reset to the default mode preserving file format use null.

Specified by:
setLineSeparator in interface ITextBox
Parameters:
separator - a string value or null to reset

setFont

public void setFont(java.lang.String name)
Change the font.

Specified by:
setFont in interface ITextBox
Parameters:
name - the font resource name


Copyright © 2004-2006 PalmEd. All Rights Reserved.