com.ibm.hi.customizer.beans.scci
Interface SCTextComponent

All Superinterfaces:
SCCustomComponent
All Known Subinterfaces:
SCLabel, SCTextfield

public interface SCTextComponent
extends SCCustomComponent

SCTextComponent is the parent class for classes containing a cursor.

See Also:
SCTextfield, SCLabel

Method Summary
 void clearSelection()
          Deselects all selected text in this text component.
 void copy()
          Copies any selected text to the clipboard.
 int getCaretPosition()
          Gets the position of the text insertion caret for this text component.
 int getColumns()
          Gets the number of columns in this text component.
 java.lang.String getSelectedText()
          Gets the selected text.
 int getSelectionEnd()
          Gets the end position of the selected text in this text component.
 int getSelectionStart()
          Gets the start position of the selected text in this text component.
 java.lang.String getText()
          Gets the text.
 java.lang.String getText(int offset, int length)
          Gets the text starting at the specified offset of the specified length.
 void select(int selectionStart, int selectionEnd)
          Selects the text between the specified start and end positions.
 void selectAll()
          Selects all the text in this text component.
 void setCaretPosition(int position)
          Sets the position of the text insertion caret for this text component.
 void setSelectionEnd(int selectionEnd)
          Sets the selection end for this text component to the specified position.
 void setSelectionStart(int selecitonStart)
          Sets the selection start for this text component to the specified position.
 void setText(int offset, java.lang.String text)
          Sets the text starting at the specified offset of a specified string.
 void setText(java.lang.String text)
          Sets the text.
 
Methods inherited from interface com.ibm.hi.customizer.beans.scci.SCCustomComponent
getBackgroundColor, getCaption, getForegroundColor, getGlobalRead, getGlobalWrite, getHelpCaption, getHostLinkLength, getHostLinkPosition, getTabNumber, hasFocus, isTempHidden, isVisible, readGlobalVariable, requestFocus, setBackgroundColor, setCaption, setForegroundColor, setGlobalRead, setGlobalWrite, setHelpCaption, setTempHidden, setVisible, toString, writeGlobalVariable
 

Method Detail

getText

public java.lang.String getText()
Gets the text.
Returns:
the text
See Also:
setText(java.lang.String), SCCustomComponent.getCaption()

setText

public void setText(java.lang.String text)
Sets the text. If the textComponent is host-linked, the operation is ignored.
Parameters:
text - the text to set
See Also:
getText(), SCCustomComponent.setCaption(java.lang.String)

getText

public java.lang.String getText(int offset,
                                int length)
Gets the text starting at the specified offset of the specified length.
Parameters:
offset - the offset
length - the length
Returns:
the text starting at the specified offset of the specified length
See Also:
setText(java.lang.String), SCCustomComponent.getCaption()

setText

public void setText(int offset,
                    java.lang.String text)
Sets the text starting at the specified offset of a specified string. If the textComponent is host-linked, the operation is ignored.
Parameters:
offset - the offset
text - the text to set
See Also:
getText(), SCCustomComponent.setCaption(java.lang.String)

getColumns

public int getColumns()
Gets the number of columns in this text component.
Returns:
the number of columns.

getSelectedText

public java.lang.String getSelectedText()
Gets the selected text.
Returns:
the selected text.
See Also:
select(int, int)

setSelectionStart

public void setSelectionStart(int selecitonStart)
Sets the selection start for this text component to the specified position. The new start point is constrained to be at or before the current selection end. It also cannot be set to less than zero (the beginning of the component's text). If the caller supplies a value for selectionStart that is out of bounds, the method enforces these constraints silently, and without failure.
Parameters:
selectionStart - the start position of the selected text.
Since:
JDK1.1
See Also:
getSelectionStart(), setSelectionEnd(int)

getSelectionStart

public int getSelectionStart()
Gets the start position of the selected text in this text component.
Returns:
the start position of the selected text.
See Also:
setSelectionStart(int), getSelectionEnd()

setSelectionEnd

public void setSelectionEnd(int selectionEnd)
Sets the selection end for this text component to the specified position. The new end point is constrained to be at or after the current selection start. It also cannot be set beyond the end of the component's text. If the caller supplies a value for selectionEnd that is out of bounds, the method enforces these constraints silently, and without failure.
Parameters:
selectionEnd - the end position of the selected text.
See Also:
getSelectionEnd(), setSelectionStart(int)

getSelectionEnd

public int getSelectionEnd()
Gets the end position of the selected text in this text component.
Returns:
the end position of the selected text.
See Also:
setSelectionEnd(int), getSelectionStart()

select

public void select(int selectionStart,
                   int selectionEnd)
Selects the text between the specified start and end positions.

This method sets the start and end positions of the selected text, enforcing the restriction that the end position must be greater than or equal to the start position. The start position must be greater than or equal to zero, and the end position must note be beyond the end of the text component's text. If the caller supplies values that are inconsistent or out of bounds, the method enforces these constraints silently, and without failure.

Note that the indexing scheme is based on caret indices, not character indices. For example, to select "def" from a component with "abcdefgh" as the text, the call would be: select(3, 6);. This would start the selection at the 4th caret index (caret indexes are zero-based) which is between the 'c' and 'd', and end the selection at the 7th caret index which between the 'f' and 'g'.

Parameters:
selectionStart - the start position of the text to select.
selectionEnd - the end position of the text to select.
See Also:
setSelectionStart(int), setSelectionEnd(int), selectAll()

selectAll

public void selectAll()
Selects all the text in this text component.
See Also:
select(int, int)

clearSelection

public void clearSelection()
Deselects all selected text in this text component.
See Also:
select(int, int)

copy

public void copy()
Copies any selected text to the clipboard.

setCaretPosition

public void setCaretPosition(int position)
Sets the position of the text insertion caret for this text component. Valid caret positions are 0 (just before the first character) to #columns (which whould place the caret right after the last character). It should also be noted that the caret will be placed at the last appropriate position if a value greater than the width of the field is passed in.
Parameters:
position - the position of the text insertion caret.
Throws:
java.lang.IllegalArgumentException - if the value supplied for position is less than zero.
See Also:
getCaretPosition()

getCaretPosition

public int getCaretPosition()
Gets the position of the text insertion caret for this text component.
Returns:
the position of the text insertion caret.
See Also:
setCaretPosition(int)