palmed.edit.selection
Class Selection

java.lang.Object
  extended by palmed.edit.selection.Selection
All Implemented Interfaces:
ISelection, ISerializable

public final class Selection
extends java.lang.Object
implements ISelection

This class manages the text selection.

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

Constructor Summary
Selection(IText text)
          Create a selection.
 
Method Summary
 void accept(ILineVisitor visitor, int y)
          Visit a line of text.
 void backward()
          Extend selection one character backward.
 void clear()
          Clear selection.
 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 selection.
 void extend(int x, int y)
          Extend selection up to the given point.
 void forward()
          Extend selection one character forward.
 boolean isEmpty()
          Test if the selection is empty.
 void marshall(java.io.OutputStream stream)
          Write to an output stream.
 void paste(java.io.InputStream stream)
          Paste the given text.
 void read(java.io.InputStream stream)
          Replace the current selection with the text from the given stream.
 void register(ISelectionView view)
          Register a view to receive insertion point notification changes.
 void reset()
          Reset selection.
 void unmarshall(java.io.InputStream stream)
          Read from an input stream.
 void write(java.io.OutputStream stream)
          Write the current selected text to the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Selection

public Selection(IText text)
Create a selection.

Parameters:
text - the text
Method Detail

isEmpty

public boolean isEmpty()
Test if the selection is empty.

Specified by:
isEmpty in interface ISelection
Returns:
whether the selection is empty or not

forward

public void forward()
Extend selection one character forward.

Specified by:
forward in interface ISelection

backward

public void backward()
Extend selection one character backward.

Specified by:
backward in interface ISelection

extend

public void extend(int x,
                   int y)
Extend selection up to the given point.

Specified by:
extend in interface ISelection
Parameters:
x - the destination column
y - the destination line

clear

public void clear()
Clear selection.

Specified by:
clear in interface ISelection

delete

public void delete()
Delete selection.

Specified by:
delete in interface ISelection

accept

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

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

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

reset

public void reset()
Reset selection.

Specified by:
reset in interface ISelection

register

public void register(ISelectionView view)
Register a view to receive insertion point notification changes.

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

copy

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

Specified by:
copy in interface ISelection
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 ISelection
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 ISelection
Parameters:
stream - the stream to read from
Throws:
java.io.IOException - an io exception occurs

read

public void read(java.io.InputStream stream)
          throws java.io.IOException
Replace the current selection with the text from the given stream.

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

write

public void write(java.io.OutputStream stream)
           throws java.io.IOException
Write the current selected text to the given stream.

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


Copyright © 2004-2006 PalmEd. All Rights Reserved.