ilog.views
Interface IlvTextInterface

All Superinterfaces:
IlvLabelInterface
All Known Implementing Classes:
IlvFilledLabel, IlvLabel, IlvText

public interface IlvTextInterface
extends IlvLabelInterface

The IlvTextInterface defines an interface for WYSIWYG editing with the IlvTextSelection and IlvTextEditor classes.

This interface provides a caret shape for use while editing text. Call getCaretShape(IlvTextSelection.Range, IlvTransformer) to show the cursor insert position and currently selected text.

Call pickCharacter(IlvPoint, IlvTransformer) to test the character clicked by the user in a label.

Graphic objects implementing this interface have automatic in-place WYSIWYG editing.

Since:
JViews 7.5
See Also:
IlvTextSelection, IlvTextEditor

Method Summary
 Shape getCaretShape(IlvTextSelection.Range range, IlvTransformer t)
          This method returns a Shape object enveloping the characters specified by range.
 int lineCount()
          Returns the line count for multi-line text.
 int lineOffset(int index)
          Returns the line offset for a given line.
 int pickCharacter(IlvPoint click, IlvTransformer t)
          Returns the index of the character clicked by the user.
 
Methods inherited from interface ilog.views.IlvLabelInterface
getLabel, getLabelBBox, setLabel, supportMultiline
 

Method Detail

getCaretShape

Shape getCaretShape(IlvTextSelection.Range range,
                    IlvTransformer t)
This method returns a Shape object enveloping the characters specified by range. The returned Shape is used to highlight the background behind characters selected.

If the range has collapsed, that is no characters are selected, the shape used to render the insertion caret is returned.

Parameters:
range - A Range indicating the number and position of selected characters.
t - The transformer used while drawing the graphic object being edited.
Returns:
A Shape used to highlight the selected characters. If null is returned, the text is not editable and the caret shape should not be displayed.

pickCharacter

int pickCharacter(IlvPoint click,
                  IlvTransformer t)
Returns the index of the character clicked by the user.

Parameters:
click - The position clicked on with the mouse. The coordinates have already been transformed by the IlvTransformer, t.
t - The transformer used to draw the label.
Returns:
The index of the character clicked by the mouse. When no character has been selected, -1 is returned.

lineCount

int lineCount()
Returns the line count for multi-line text.

Returns:
The line count for multi-line text. For a single line text, the value 1 is returned.
See Also:
lineOffset(int)

lineOffset

int lineOffset(int index)
Returns the line offset for a given line.

This method is used for determining the line number for a given character.

Note: the offset of line N + 1 is not always the offset of line N plus the number of characters displayed on line N. To improve the label layout, whitespace and control characters are sometimes omitted in the label seen by the user.

Parameters:
index - The line index. The first line in the label has index 0.
Returns:
The line offset for the selected character in a label. Returns 0 for single line label or -1 if the specified index is out of range.
See Also:
lineCount()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.