palmed.edit.view
Class Viewport

java.lang.Object
  extended by palmed.edit.view.Viewport
All Implemented Interfaces:
ISelectionView, ITextView, IContent, IView, IViewport, ISerializable

public final class Viewport
extends java.lang.Object
implements IViewport, IContent, IView

This class implements a viewport on a content.

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

Constructor Summary
Viewport(IContent content)
          Create a content viewport.
 
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 modified(boolean status)
          Notify the modification flag has changed.
 void paste(java.io.InputStream stream)
          Paste the given text.
 void redo()
          Redo the last undo.
 void register(IScrollView view)
          Register a view to be notified of scroll events.
 void register(IView view)
          Register a view for events notification.
 void resize(int columns, int lines)
          Resize the viewport.
 void scroll(int columns, int lines)
          Scroll the viewport.
 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.
 void update(int columns, int lines)
          Notify the text bounding box has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Viewport

public Viewport(IContent content)
Create a content viewport.

Parameters:
content - the content to manage
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

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

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

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

scroll

public void scroll(int columns,
                   int lines)
Scroll the viewport.

Specified by:
scroll in interface IViewport
Parameters:
columns - the number of columns to scroll
lines - the number of lines to scroll

update

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

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

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

modified

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

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

resize

public void resize(int columns,
                   int lines)
Resize the viewport.

Specified by:
resize in interface IViewport
Parameters:
columns - the number of columns visible
lines - the number of lines visible

register

public void register(IScrollView view)
Register a view to be notified of scroll events.

The content viewport must be able to handle several views.

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

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

clear

public void clear()
Reset the content.

Specified by:
clear in interface IContent

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)
         throws java.io.IOException
Cut the current selected text.

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

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.