sk.uniba.euromath.editor.textEditor
Interface ITextLocator

All Superinterfaces:
IEMFigure, org.eclipse.draw2d.IFigure

public interface ITextLocator
extends IEMFigure

Locates(draws) text into (segment of) one text line. Supposed to implement by classes drawing text into segment of line. Characters of text are indexed. First character have index 0. All methods works with rendered(drawn) text.

Author:
Tomáš Studva

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets
 
Field Summary
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Method Summary
 org.eclipse.draw2d.geometry.Point getEnd(int charIndex)
          Returns top right point of rectangle bounding character with index charIndex.
 int getNearestCharGapIndexAtPos(int x)
          Computes index of nearest chararacter gap placed at given horizontal x coordinate.
 int getNearestCharIndexAtPos(int x)
          Computes index of nearest character placed at given horizontal x coordinate.
 org.eclipse.draw2d.geometry.Point getStart(int charIndex)
          Returns top left point of rectangle bounding character with index charIndex.
 String getText()
          Returns text located by this ITextLocator
 org.eclipse.draw2d.geometry.Rectangle getTextBounds()
          Bounds of whole text.
 org.eclipse.draw2d.geometry.Rectangle getTextBounds(int start, int end)
          Computes bounds of text substring between start and end.
 void updateText(String text)
          Stores the new Text.
 
Methods inherited from interface sk.uniba.euromath.editor.figures.IEMFigure
getID, getModel, needsEditPart
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 

Method Detail

getStart

org.eclipse.draw2d.geometry.Point getStart(int charIndex)
Returns top left point of rectangle bounding character with index charIndex.

Parameters:
charIndex - index of character in text, charIndex have to be correct index - non negative and less than text length
Returns:
new Point reference

getEnd

org.eclipse.draw2d.geometry.Point getEnd(int charIndex)
Returns top right point of rectangle bounding character with index charIndex.

Parameters:
charIndex - index of character in text, charIndex have to be correct index - non negative and less than text length
Returns:
new Point reference

getNearestCharIndexAtPos

int getNearestCharIndexAtPos(int x)
Computes index of nearest character placed at given horizontal x coordinate. If coordinate is out of text bounds, returns zero or last index, depending on x.

Parameters:
x - horizontal relative coordinate
Returns:
index of nearest character to coordinate x

getNearestCharGapIndexAtPos

int getNearestCharGapIndexAtPos(int x)
Computes index of nearest chararacter gap placed at given horizontal x coordinate. Character gap is gap between characters, specialls are gaps at start and end of text. Are index from zero to length of text. First gap(index 0) is before first character(index 0), last gap(index length) is after last character(index length -1).
If coordinate is out of text bounds, returns zero or last gap index, depending on x.

Parameters:
x - horizontal relative coordinate
Returns:
index of nearest gap to coordinate x

getTextBounds

org.eclipse.draw2d.geometry.Rectangle getTextBounds()
Bounds of whole text. Smallest rectangle completely surrounding located text.

Returns:
rectangle completely surrounding diplayed text.

getTextBounds

org.eclipse.draw2d.geometry.Rectangle getTextBounds(int start,
                                                    int end)
Computes bounds of text substring between start and end. This substring includes character with index start,but don't include character with index end.

Parameters:
start - index of first character in result bounds
end - index of first character that is not in result bounds
Returns:
Rectangle that bounds substring

getText

String getText()
Returns text located by this ITextLocator

Returns:
rendered text.

updateText

void updateText(String text)
Stores the new Text.

Parameters:
text - newText


Copyright © 2003-2006 null. All Rights Reserved.