palmed.edit
Class Content

java.lang.Object
  extended by palmed.edit.Content
All Implemented Interfaces:
ISelectionView, IContent, ISerializable

public final class Content
extends java.lang.Object
implements IContent, ISelectionView

This class encapsulates text and selection manipulations.

Version:
$Revision$ $Date$
Author:
Mathieu Champlon

Constructor Summary
Content(IText text)
          Create a content.
 
Method Summary
 void accept(ILineVisitor visitor, int y)
          Visit a line of text.
 void backspace()
          Handle a backspace event.
 void clear()
          Reset the content.
 void click(int x, int y)
          Handle a click event at a given location.
 void copy(java.io.OutputStream stream)
          Copy the current selected text.
 void cut(java.io.OutputStream stream)
          Cut the current selected text.
 void drag(int x, int y)
          Handle a drag event to a given location.
 void enter()
          Handle an enter event.
 void marshall(java.io.OutputStream stream)
          Write to an output stream.
 void paste(java.io.InputStream stream)
          Paste the given text.
 void redo()
          Redo the last undo.
 void register(IView view)
          Register a view for events notification.
 void type(int keyCode)
          Handle a character typing.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Content

public Content(IText text)
Create a content.

Parameters:
text - the text
Method Detail

type

public void type(int keyCode)
Handle a character typing.

Specified by:
type in interface IContent
Parameters:
keyCode - the value of the key entered

enter

public void enter()
Handle an enter event.

Specified by:
enter in interface IContent

backspace

public void backspace()
Handle a backspace event.

Specified by:
backspace in interface IContent

drag

public void drag(int x,
                 int y)
Handle a drag event to a given location.

Specified by:
drag in interface IContent
Parameters:
x - destination column
y - destination line

click

public void click(int x,
                  int y)
Handle a click event at a given location.

Specified by:
click in interface IContent
Parameters:
x - location column
y - location line

accept

public void accept(ILineVisitor visitor,
                   int y)
Visit a line of text.

Specified by:
accept in interface IContent
Parameters:
visitor - the visitor
y - the line number

register

public void register(IView view)
Register a view for events notification.

Specified by:
register in interface IContent
Parameters:
view - the view to register

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

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

clear

public void clear()
Reset the content.

Specified by:
clear in interface IContent

update

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

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

copy

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

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

cut

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

Specified by:
cut in interface IContent
Parameters:
stream - the stream to write to

paste

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

Specified by:
paste in interface IContent
Parameters:
stream - the stream to read from

undo

public void undo()
Undo the last action.

Specified by:
undo in interface IContent

redo

public void redo()
Redo the last undo.

Specified by:
redo in interface IContent


Copyright © 2004-2006 PalmEd. All Rights Reserved.