sk.uniba.euromath.editor.textEditor
Interface ITextPieceContainer

All Known Implementing Classes:
TextPieceContainer

public interface ITextPieceContainer

Container for ITextPieceKeepers. As logical unit represents one text node in XSLT-transformed document. Text of that node is rendered(formated into more lines or line segments(first and last can be segments), where each line or line segment keeps one ITextPieceKeeper and is located (drawn) by ITextLocator. Keepers are ordered and indexed as follows text in node they keeps. Only in noticed order can be added to container. Container creates ItextPieceInfo for each added keeper and stores it.

Author:
Tomáš Studva
See Also:
ITextPieceKeeper, ITextPieceInfo

Method Summary
 ITextPieceInfo add(ITextPieceKeeper pieceKeeper)
          Adds ITextPieceKeeper to container.
 List<ITextPieceKeeper> getAll()
          Returns all stored ITextPieceKeeper.
 ITextPieceInfo getInfo(ITextPieceKeeper forPiece)
          Returns ITextPieceInfo for ITextPieceKeeper.
 ITextPieceKeeper getKeeper(int index)
          Returns ITextPieceKeeper stored with index index.
 ITextPieceKeeper getKeeperByRenderedOffset(int indexInRenderedText)
          Returns keeper holding rendered text where index falls.
 List<ITextPieceKeeper> getKeepers(int startIndex, int endIndex)
          Returns ITextPieceKeepers stored with index in closed interval startIndex, endIndex.
 List<ITextPieceKeeper> getKeepers(ITextPieceKeeper startKeeper, ITextPieceKeeper endKeeper)
          Returns ITextPieceKeepers stored after startKeeper including and before endKeeper including.
 ITextPieceKeeper getNext(ITextPieceKeeper keeper)
          Returns next stored ITextPieceKeeper in order they are stored.
 ITextPieceKeeper getPrevious(ITextPieceKeeper keeper)
          Returns previous stored ITextPieceKeeper in order they are stored.
 String getWholeRenderedText()
          Returns rendered text of all stored keepers, exactly the same as is rendered.
 boolean hasNext(ITextPieceKeeper keeper)
          Returns if keeper is last or not.
 boolean hasPrevious(ITextPieceKeeper keeper)
          Returns if keeper is first or not.
 int indexOf(ITextPieceKeeper piece)
          Returns index of ITextPieceKeeper piece in this container as is stored.
 int resolveOriginalIndex(int indexInOriginalText, XMLAccess xmlAccess)
          Resolves index in DOM node's text of original document(not XSLT-transformed) to index in node's rendered text.
 int resolveRenderedIndex(int indexInRenderedText, XMLAccess xmlAccess)
          Resolves index in container rendered text to DOM node's text of original document(not XSLT-transformed).
 int size()
          Returns number of all stored pieces.
 

Method Detail

getKeeper

ITextPieceKeeper getKeeper(int index)
Returns ITextPieceKeeper stored with index index.

Parameters:
index - of wanted keeper
Returns:
ITextPieceKeeper with index index

getKeepers

List<ITextPieceKeeper> getKeepers(int startIndex,
                                  int endIndex)
Returns ITextPieceKeepers stored with index in closed interval startIndex, endIndex.

Parameters:
startIndex - of first wanted keeper
endIndex - of last wanted keeper
Returns:
List of ITextPieceKeeper within interval

getKeepers

List<ITextPieceKeeper> getKeepers(ITextPieceKeeper startKeeper,
                                  ITextPieceKeeper endKeeper)
Returns ITextPieceKeepers stored after startKeeper including and before endKeeper including.

Parameters:
startKeeper - first wanted keeper
endKeeper - last wanted keeper
Returns:
List of ITextPieceKeeper within interval

add

ITextPieceInfo add(ITextPieceKeeper pieceKeeper)
Adds ITextPieceKeeper to container. Returns for that keeper ITextPieceInfo. Keepers are ordered and indexed as follows text in node they keeps. Only in noticed order can be added to container.

Parameters:
pieceKeeper - keeper to add
Returns:
ITextPieceInfo for pieceKeeper

size

int size()
Returns number of all stored pieces.

Returns:
number of all stored pieces

getInfo

ITextPieceInfo getInfo(ITextPieceKeeper forPiece)
Returns ITextPieceInfo for ITextPieceKeeper. This info is the same as ITextPieceKeeper has set.

Parameters:
forPiece - ITextPieceKeeper stored in this container
Returns:
ITextPieceInfo about ITextPieceKeeper forPiece

getAll

List<ITextPieceKeeper> getAll()
Returns all stored ITextPieceKeeper. If is correctly filled by ITextPieceKeepers, than returns all ITexPieceKeepers for node.

Returns:
all stored ITextPieceKeeper

getNext

ITextPieceKeeper getNext(ITextPieceKeeper keeper)
Returns next stored ITextPieceKeeper in order they are stored.

Parameters:
keeper - asked for successor
Returns:
successor or IllegalArgumentException if piece is the last part

hasNext

boolean hasNext(ITextPieceKeeper keeper)
Returns if keeper is last or not.

Parameters:
keeper - asked for successor
Returns:
true if keeper is not last in container

getPrevious

ITextPieceKeeper getPrevious(ITextPieceKeeper keeper)
Returns previous stored ITextPieceKeeper in order they are stored.

Parameters:
keeper - asked for predeccessor
Returns:
predeccessor or IllegalArgumentException if piece is the first part

hasPrevious

boolean hasPrevious(ITextPieceKeeper keeper)
Returns if keeper is first or not.

Parameters:
keeper - asked for predeccessor
Returns:
true if keeper is not first in container

indexOf

int indexOf(ITextPieceKeeper piece)
Returns index of ITextPieceKeeper piece in this container as is stored.

Parameters:
piece - asked for index
Returns:
returns index of piece

resolveOriginalIndex

int resolveOriginalIndex(int indexInOriginalText,
                         XMLAccess xmlAccess)
Resolves index in DOM node's text of original document(not XSLT-transformed) to index in node's rendered text.

Parameters:
indexInOriginalText - index in DOM node's original text or one behind
Returns:
index in rendered text of container (node) or one behind

resolveRenderedIndex

int resolveRenderedIndex(int indexInRenderedText,
                         XMLAccess xmlAccess)
Resolves index in container rendered text to DOM node's text of original document(not XSLT-transformed).

Parameters:
indexInRenderedText - index in rendered text of container (node) (0 to text.length-1)or index one behind the text(for example when index is character gap index, can be text lenght)
Returns:
index in DOM node's original text or one behind the text

getKeeperByRenderedOffset

ITextPieceKeeper getKeeperByRenderedOffset(int indexInRenderedText)
Returns keeper holding rendered text where index falls.

Parameters:
indexInRenderedText - index in whole rendered text or one behind
Returns:
ITextPieceKeeper keeper holding rendered text where index falls

getWholeRenderedText

String getWholeRenderedText()
Returns rendered text of all stored keepers, exactly the same as is rendered.

Returns:
whole rendered text of node associated with this container


Copyright © 2003-2006 null. All Rights Reserved.