sk.uniba.euromath.editor.textEditor.requests.editTextRequests
Class DeleteTextRequest

java.lang.Object
  extended by org.eclipse.gef.Request
      extended by sk.uniba.euromath.editor.textEditor.requests.editTextRequests.EditTextRequest
          extended by sk.uniba.euromath.editor.textEditor.requests.editTextRequests.DeleteTextRequest
All Implemented Interfaces:
IRequestSpecialization

public final class DeleteTextRequest
extends EditTextRequest
implements IRequestSpecialization

Request to delete text from specified position of specified size. Position is specified by ITextPieceKeeper and offset. Size specifies deletion direction and length of text to delete. So effect is deletion of text from offset(include offset character) in ITextPieceKeeper to offset + size.

Author:
Martin Kollar 17.11.2005

Nested Class Summary
 class DeleteTextRequest.DeleteInfo
          For structure purpose only.
 
Constructor Summary
DeleteTextRequest(ITextPieceKeeper source, int offset, int size)
          Constructor.
DeleteTextRequest(ITextPieceKeeper source, int offset, int size, List<DeleteTextRequest.DeleteInfo> structuredDeleteInfo)
          Constructor.
 
Method Summary
 int getOffset()
          Returns position in text piece from where text should be deleted.
 int getSize()
          Returns size - length of text to delete(absolute value of size) + deletion direction(signum of size).
 String getSpecialization()
          TODO Kollar ocakavam navrhy na zmenu mena tejto metody, ale getAction sa mi zda byt metuce, lebo od getAction() by som cakal ze vrati nejaku akciu.
 List<DeleteTextRequest.DeleteInfo> getStructuredDeleteInfo()
          Returns holded structured delete info.
 void setOffset(int offset)
           
 void setSize(int size)
           
 
Methods inherited from class sk.uniba.euromath.editor.textEditor.requests.editTextRequests.EditTextRequest
getDestination, getSource, setDestination
 
Methods inherited from class org.eclipse.gef.Request
getExtendedData, getType, setExtendedData, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeleteTextRequest

public DeleteTextRequest(ITextPieceKeeper source,
                         int offset,
                         int size)
Constructor.

Parameters:
source - ITextPieceKeeper where was the deletion called
offset - offset in text piece(ITextPieceKeeper's text) from where text should be deleted, must be valid (in range of text piece). Character at this offset position is also deleted.
size - length of text to delete(absolute value of size) + deletion direction(signum of size). Negative values are used to delete text before offset and positive to delete text after offset. Size can have any integer value(not bounded by text piece), but text of that size must exist (bounded by text of whole document), otherwise exception is thrown in process of execution. NOT ZERO.

DeleteTextRequest

public DeleteTextRequest(ITextPieceKeeper source,
                         int offset,
                         int size,
                         List<DeleteTextRequest.DeleteInfo> structuredDeleteInfo)
Constructor.

Parameters:
source - ITextPieceKeeper where was the deletion called
offset - offset in text piece(ITextPieceKeeper's text) from where text should be deleted, must be valid (in range of text piece). Character at this offset position is also deleted.
size - length of text to delete(absolute value of size) + deletion direction(signum of size). Negative values are used to delete text before offset and positive to delete text after offset. Size can have any integer value(not bounded by text piece), but text of that size must exist (bounded by text of whole document), otherwise exception is thrown in process of execution. NOT ZERO.
structuredDeleteInfo - Holds additional description what else should be deleted, but in different format. Can be empty, but in taht case should be used another contructor. Is used when transforming standard DeteleTextRequest to structured DeteleTextRequest for easy command creation and execution. DeleteInfo has big difference in length vs size.
Method Detail

getSize

public int getSize()
Returns size - length of text to delete(absolute value of size) + deletion direction(signum of size).

Returns:
size of text to delete.
See Also:
DeleteTextRequest(ITextPieceKeeper, int, int)

getOffset

public int getOffset()
Returns position in text piece from where text should be deleted. Character at this offset position should be also deleted.

Returns:
offset in text piece (ITextPieceKeeper's text)

getStructuredDeleteInfo

public List<DeleteTextRequest.DeleteInfo> getStructuredDeleteInfo()
Returns holded structured delete info. Holds additional description what else should be deleted.

Returns:
structuredDeleteInfo can be empty, is used when transforming standard DeteleTextRequest to structured DeteleTextRequest for easy command creation and execution. DeleteInfo has big difference in length vs size.

getSpecialization

public String getSpecialization()
Description copied from interface: IRequestSpecialization
TODO Kollar ocakavam navrhy na zmenu mena tejto metody, ale getAction sa mi zda byt metuce, lebo od getAction() by som cakal ze vrati nejaku akciu. Ak suhlasis s menom tejto metody, staci ze zmazes toto TODO Return request specialization unique string.

Specified by:
getSpecialization in interface IRequestSpecialization
Returns:
request specialization string

setOffset

public void setOffset(int offset)
Parameters:
offset - the offset to set

setSize

public void setSize(int size)
Parameters:
size - the size to set


Copyright © 2003-2006 null. All Rights Reserved.