|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.editor.textEditor.TextPieceContainer
public class TextPieceContainer
Base implementation of ITextpieceContainer. To resolve indexex, are used tree types of text: original, logical and rendered. Logical replaces transformed text, because transformed text is not available. Logical text is simply created from rendered, adding line breaks at end of lines and interpreting them as white space.
Constructor Summary | |
---|---|
TextPieceContainer(ITextPieceKeeper firstPieceKeeper,
String nodeId)
Constructor. |
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 offset)
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. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TextPieceContainer(ITextPieceKeeper firstPieceKeeper, String nodeId)
firstPieceKeeper
- first TextPieceKeeper in this containernodeId
- id of node corresponding to this TextPieceContaineroriginalNodeText
- original DOM node's textMethod Detail |
---|
public ITextPieceInfo add(ITextPieceKeeper pieceKeeper)
ITextPieceContainer
add
in interface ITextPieceContainer
pieceKeeper
- keeper to add
public ITextPieceKeeper getKeeper(int index)
ITextPieceContainer
getKeeper
in interface ITextPieceContainer
index
- of wanted keeper
public int size()
ITextPieceContainer
size
in interface ITextPieceContainer
public ITextPieceInfo getInfo(ITextPieceKeeper forPiece)
ITextPieceContainer
getInfo
in interface ITextPieceContainer
forPiece
- ITextPieceKeeper stored in this container
public ITextPieceKeeper getPrevious(ITextPieceKeeper keeper)
ITextPieceContainer
getPrevious
in interface ITextPieceContainer
keeper
- asked for predeccessor
piece
is the first partpublic ITextPieceKeeper getNext(ITextPieceKeeper keeper)
ITextPieceContainer
getNext
in interface ITextPieceContainer
keeper
- asked for successor
piece
is the last partpublic int indexOf(ITextPieceKeeper piece)
ITextPieceContainer
indexOf
in interface ITextPieceContainer
piece
- asked for index
public List<ITextPieceKeeper> getAll()
ITextPieceContainer
getAll
in interface ITextPieceContainer
public ITextPieceKeeper getKeeperByRenderedOffset(int offset)
ITextPieceContainer
getKeeperByRenderedOffset
in interface ITextPieceContainer
offset
- index in whole rendered text or one behind
public List<ITextPieceKeeper> getKeepers(int startIndex, int endIndex)
ITextPieceContainer
getKeepers
in interface ITextPieceContainer
startIndex
- of first wanted keeperendIndex
- of last wanted keeper
public List<ITextPieceKeeper> getKeepers(ITextPieceKeeper startKeeper, ITextPieceKeeper endKeeper)
ITextPieceContainer
getKeepers
in interface ITextPieceContainer
startKeeper
- first wanted keeperendKeeper
- last wanted keeper
public String getWholeRenderedText()
ITextPieceContainer
getWholeRenderedText
in interface ITextPieceContainer
public int resolveOriginalIndex(int indexInOriginalText, XMLAccess xmlAccess)
ITextPieceContainer
resolveOriginalIndex
in interface ITextPieceContainer
indexInOriginalText
- index in DOM node's original text or one behind
public int resolveRenderedIndex(int indexInRenderedText, XMLAccess xmlAccess)
ITextPieceContainer
resolveRenderedIndex
in interface ITextPieceContainer
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)
public boolean hasNext(ITextPieceKeeper keeper)
ITextPieceContainer
hasNext
in interface ITextPieceContainer
keeper
- asked for successor
public boolean hasPrevious(ITextPieceKeeper keeper)
ITextPieceContainer
hasPrevious
in interface ITextPieceContainer
keeper
- asked for predeccessor
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |