sk.uniba.euromath.editor.textEditor
Class TextPieceInfoImpl

java.lang.Object
  extended by sk.uniba.euromath.editor.textEditor.TextPieceInfoImpl
All Implemented Interfaces:
ITextPieceInfo

public class TextPieceInfoImpl
extends Object
implements ITextPieceInfo

Info about text piece from textual node identified by nodeID.

Author:
Tomáš Studva 24.1.2006

Constructor Summary
TextPieceInfoImpl(ITextPieceKeeper keeper, String nodeID, int renderedOffset)
          Constructor.
 
Method Summary
static String buildID(String nodeID, int offset, int length)
          Deprecated.  
 DomPointer getDomPointer(int charGapIndex, XMLAccess xmlAccess)
          Returns pointer to original document specified by node assoc with this keeper and charGapIndex.
 String getID()
          Deprecated.  
 ITextPieceKeeper getKeeper()
          Returns associated text piece keeper.
 int getLastIndex()
          Returns last index in rendered text.
static int getLength(String id)
          Deprecated.  
 String getNodeID()
          Identification of node in original document(not XSLT-transformed) holding the text (text node, cdata node).
static String getNodeID(String id)
          Deprecated.  
static int getOffset(String id)
          Deprecated.  
 int getRenderedOffset()
          Index of the first character of this text piece in whole rendered text of textual node.
 String getRenderedText()
          Returns rendered keeper's text.
static boolean isTextPieceId(String id)
          Deprecated.  
 int resolveRenderedIndex(int indexInRenderedText, XMLAccess xmlAccess)
          Resolves index in this rendered text to index in associated DOM node's(not XSLT - transformed) original text .
static void tidyUpIds(List<String> ids)
          Deprecated.  
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextPieceInfoImpl

public TextPieceInfoImpl(ITextPieceKeeper keeper,
                         String nodeID,
                         int renderedOffset)
Constructor.

Parameters:
nodeID - id of text node of text piece
offset - of first character in rendered text of text node
renderedText - rendered text
Method Detail

getID

public String getID()
Deprecated. 

Returns id for text piece in this TextPieceInfo. Text piece id is unique identifier for substring of text of textual node from xml document. Id is build by adding offset and length to id of textual node containig this text. The id has format: id of node

Returns:
text piece id : id of node

getNodeID

public String getNodeID()
Description copied from interface: ITextPieceInfo
Identification of node in original document(not XSLT-transformed) holding the text (text node, cdata node).

Specified by:
getNodeID in interface ITextPieceInfo
Returns:
id of node containing this text

getNodeID

public static String getNodeID(String id)
Deprecated. 

Parses node id with multiplicity from id.

Parameters:
id - some id
Returns:
id of node

getOffset

public static int getOffset(String id)
Deprecated. 

Parses offset of text piece from text piece id. If id is not text piece id, IllegalArgumentException is thrown.

Parameters:
id - id of text piece
Returns:
offset of text piece

getLength

public static int getLength(String id)
Deprecated. 

Parses length of text piece from text piece's id. If id is not text piece id, IllegalArgumentException is thrown.

Parameters:
id - id of text piece
Returns:
length of text piece

isTextPieceId

public static boolean isTextPieceId(String id)
Deprecated. 

True if parameter id is text piece/selection id, it means of form int.

Parameters:
id - to examine
Returns:
true if id is textpiece/selection id

buildID

public static final String buildID(String nodeID,
                                   int offset,
                                   int length)
Deprecated. 

Static method to build text piece id from nodeID, offset and length.

Parameters:
nodeID - id of node of text piece
offset - of first character in text of text node
length - of text to identify
Returns:
nodeID

tidyUpIds

public static void tidyUpIds(List<String> ids)
Deprecated. 

Any text piece ids which are neighbour are joined together. Neighbour text piece ids are satisfiing these conditions: have same node id and offset + length - 1 == offset of second (where first ends, second starts).

Parameters:
ids - text piece ids to tidy up

getRenderedOffset

public int getRenderedOffset()
Description copied from interface: ITextPieceInfo
Index of the first character of this text piece in whole rendered text of textual node.

Specified by:
getRenderedOffset in interface ITextPieceInfo
Returns:
globaloffset of first character

getRenderedText

public String getRenderedText()
Description copied from interface: ITextPieceInfo
Returns rendered keeper's text.

Specified by:
getRenderedText in interface ITextPieceInfo
Returns:
rendered text piece of this keeper.

resolveRenderedIndex

public int resolveRenderedIndex(int indexInRenderedText,
                                XMLAccess xmlAccess)
Description copied from interface: ITextPieceInfo
Resolves index in this rendered text to index in associated DOM node's(not XSLT - transformed) original text .

Specified by:
resolveRenderedIndex in interface ITextPieceInfo
Parameters:
indexInRenderedText - index in this's rendered text (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

getLastIndex

public int getLastIndex()
Description copied from interface: ITextPieceInfo
Returns last index in rendered text. It is getRenderedText().length - 1.

Specified by:
getLastIndex in interface ITextPieceInfo
Returns:
last valid index in rendered text

toString

public String toString()
Overrides:
toString in class Object

getKeeper

public ITextPieceKeeper getKeeper()
Description copied from interface: ITextPieceInfo
Returns associated text piece keeper.

Specified by:
getKeeper in interface ITextPieceInfo
Returns:
associated keeper

getDomPointer

public DomPointer getDomPointer(int charGapIndex,
                                XMLAccess xmlAccess)
Description copied from interface: ITextPieceInfo
Returns pointer to original document specified by node assoc with this keeper and charGapIndex.

Specified by:
getDomPointer in interface ITextPieceInfo
Parameters:
charGapIndex - index of character gap in this's rendered text
Returns:
DOMPointer to text node assoc. with this keeper, pointing at gap in node assoc. with charGapIndex


Copyright © 2003-2006 null. All Rights Reserved.