sk.uniba.euromath.editor.textEditor
Class TextPieceContainer

java.lang.Object
  extended by sk.uniba.euromath.editor.textEditor.TextPieceContainer
All Implemented Interfaces:
ITextPieceContainer

public class TextPieceContainer
extends Object
implements ITextPieceContainer

Container for ITextPieceKeepers. As logical unit represents one text node. Text of that node is formated into more lines or line segments(first and last can be segments). Each line or line segment keeps one ITextPieceKeeper and is located (or displayed) by ITextLocator. Ordering keepers is like lines of text are ordered in node and only in this ordering keepers can be added.

Author:
Tomáš Studva 29.9.2005

Constructor Summary
TextPieceContainer(ITextPieceKeeper firstPieceKeeper, String id, String fullText)
          Constructor.
 
Method Summary
 ITextPieceInfo add(ITextPieceKeeper pieceKeeper)
          Adds ITextPieceKeeper to container.
 List<ITextPieceKeeper> getAll()
          Returns all stored ITextPieceKeeper.
protected  String getFullText()
           
 ITextPieceInfo getInfo(ITextPieceKeeper forPiece)
          Returns ITextPieceInfo for ITextPieceKeeper.
 ITextPieceKeeper getNext(ITextPieceKeeper piece)
          Returns next stored ITextPieceKeeper in order they are stored.
 String getNodeID()
           
 ITextPieceKeeper getPiece(int index)
          Returns ITextPieceKeeper stored with index index.
 int getPieceCount()
          Returns number of all stored pieces.
 ITextPieceKeeper getPrevious(ITextPieceKeeper piece)
          Returns previous stored ITextPieceKeeper in order they are stored.
 String getWholeContainerText()
           
 int indexOf(ITextPieceKeeper piece)
          Returns index of ITextPieceKeeper piece in this container as is stored.
 ITextPieceKeeper OffsetInPieceKeeper(int offset)
           
 void setNodeID(String nodeID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextPieceContainer

public TextPieceContainer(ITextPieceKeeper firstPieceKeeper,
                          String id,
                          String fullText)
Constructor.

Parameters:
firstPieceKeeper - first TextPieceKeeper in this container
id - id of node corresponding to this TextPieceContainer
fullText - fullText of this container
Method Detail

add

public ITextPieceInfo add(ITextPieceKeeper pieceKeeper)
Adds ITextPieceKeeper to container. Returns for that keeper ITextPieceInfo.

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

getPiece

public ITextPieceKeeper getPiece(int index)
Description copied from interface: ITextPieceContainer
Returns ITextPieceKeeper stored with index index.

Specified by:
getPiece in interface ITextPieceContainer
Parameters:
index - index of piece
Returns:
ITextPieceKeeper or null if index is out of range
See Also:
ITextPieceContainer.getPiece(int)

getPieceCount

public int getPieceCount()
Description copied from interface: ITextPieceContainer
Returns number of all stored pieces.

Specified by:
getPieceCount in interface ITextPieceContainer
Returns:
number of all stored pieces
See Also:
sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceContainer#getPieceCount()

getInfo

public ITextPieceInfo getInfo(ITextPieceKeeper forPiece)
Description copied from interface: ITextPieceContainer
Returns ITextPieceInfo for ITextPieceKeeper. This info is the same as ITextPieceKeeper has set.

Specified by:
getInfo in interface ITextPieceContainer
Parameters:
forPiece - ITextPieceKeeper stored in this container
Returns:
ITextPieceInfo about ITextPieceKeeper forPiece
See Also:
sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceContainer#getInfo(sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceKeeper)

getNext

public ITextPieceKeeper getNext(ITextPieceKeeper piece)
Description copied from interface: ITextPieceContainer
Returns next stored ITextPieceKeeper in order they are stored. For ordering see coment for class.

Specified by:
getNext in interface ITextPieceContainer
Parameters:
piece - asked for successor
Returns:
successor or null if piece is the last part
See Also:
sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceContainer#getNext(sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceKeeper)

getPrevious

public ITextPieceKeeper getPrevious(ITextPieceKeeper piece)
Description copied from interface: ITextPieceContainer
Returns previous stored ITextPieceKeeper in order they are stored. For ordering see coment for class.

Specified by:
getPrevious in interface ITextPieceContainer
Parameters:
piece - asked for predeccessor
Returns:
predeccessor or null if piece is the first part
See Also:
sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceContainer#getPrevious(sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceKeeper)

indexOf

public int indexOf(ITextPieceKeeper piece)
Description copied from interface: ITextPieceContainer
Returns index of ITextPieceKeeper piece in this container as is stored. For ordering see coment for class.

Specified by:
indexOf in interface ITextPieceContainer
Parameters:
piece - asked for index
Returns:
returns index of piece
See Also:
sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceContainer#indexOf(sk.uniba.euromath.editor.textEditor.xmlTexts.TextPieceKeeper)

getNodeID

public String getNodeID()
Returns:
Returns the nodeID.

setNodeID

public void setNodeID(String nodeID)
Parameters:
nodeID - The nodeID to set.

getAll

public List<ITextPieceKeeper> getAll()
Description copied from interface: ITextPieceContainer
Returns all stored ITextPieceKeeper. If is correctly filled by ITextPieceKeepers, than returns all ITexPieceKeepers for node.

Specified by:
getAll in interface ITextPieceContainer
Returns:
all stored ITextPieceKeeper

getFullText

protected String getFullText()
Returns:
Returns the fullText.

OffsetInPieceKeeper

public ITextPieceKeeper OffsetInPieceKeeper(int offset)
Specified by:
OffsetInPieceKeeper in interface ITextPieceContainer
Parameters:
offset - offset of whole text in textual Node
Returns:
ITextPieceKeeper in that is this offset

getWholeContainerText

public String getWholeContainerText()
Specified by:
getWholeContainerText in interface ITextPieceContainer
Returns:
Text in the Container, that should by not very different from text in TextNode TODO: give a description of that difference and it can occur
See Also:
ITextPieceContainer.getWholeContainerText()


Copyright © 2003-2006 null. All Rights Reserved.