| org.itsnat.comp.ItsNatTextComponent
ItsNatTextComponent | public interface ItsNatTextComponent extends ItsNatElementComponent(Code) | | Is the base interface of text based components.
A text based component manages a single piece of text.
author: Jose Maria Arranz Santamaria |
Method Summary | |
public void | appendString(String str) Appends a new string at the end. | public Document | createDefaultDocument() Create a new instance of the default data model. | public Document | getDocument() Returns the current data model of this component. | public ItsNatTextComponentUI | getItsNatTextComponentUI() Returns the user interface manager of this component. | public String | getText() Returns the text contained in this component. | public String | getText(int offset, int length) Fetches the text contained within the given portion
of the text of this component. | public void | insertString(String str, int pos) Inserts a new string at the specified position. | public void | replaceString(String str, int start, int end) Replaces a text part with a new string at the specified position. | public void | setDocument(Document dataModel) Changes the data model of this component.
Current data model is disconnected from this component, and the new
data model is bound to this component, every change is tracked and
updates the user interfaces accordingly.
If the specified data model is the same instance as the current data model,
then is reset, component listener is removed and added again. | public void | setText(String t) Updates the text contained in this component. |
getItsNatTextComponentUI | public ItsNatTextComponentUI getItsNatTextComponentUI()(Code) | | Returns the user interface manager of this component.
the user interface manager. |
getText | public String getText(int offset, int length)(Code) | | Fetches the text contained within the given portion
of the text of this component.
This method is a direct wrapper of javax.swing.text.Document.getText(int,int) .
Parameters: offset - the offset into the document representing the desired start of the text >= 0 Parameters: length - the length of the desired string >= 0 See Also: ItsNatTextComponent.getText() See Also: ItsNatTextComponent.getDocument() See Also: |
replaceString | public void replaceString(String str, int start, int end)(Code) | | Replaces a text part with a new string at the specified position.
This method is a quick access to modify the data model text
(see javax.swing.text.Document.insertString(int,int,AttributeSet) ).
This method is a quick access to modify the data model text
(see javax.swing.text.Document.remove(int,int)
and javax.swing.text.Document.insertString(int,int,AttributeSet) ).
Parameters: str - the text. See Also: ItsNatTextComponent.getText() See Also: ItsNatTextComponent.getDocument() See Also: See Also: ItsNatTextComponent.appendString(String) See Also: |
setDocument | public void setDocument(Document dataModel)(Code) | | Changes the data model of this component.
Current data model is disconnected from this component, and the new
data model is bound to this component, every change is tracked and
updates the user interfaces accordingly.
If the specified data model is the same instance as the current data model,
then is reset, component listener is removed and added again. Use this technique if
you want to add a data model listener to be executed before the default component listener.
Parameters: dataModel - the new data model. See Also: ItsNatTextComponent.getDocument() |
setText | public void setText(String t)(Code) | | Updates the text contained in this component.
This method is a quick access to modify the data model text
(see javax.swing.text.Document.remove(int,int)
and javax.swing.text.Document.insertString(int,int,AttributeSet) ).
The component keeps track of data model changes the user interface is updated
accordingly.
Parameters: t - the text. See Also: ItsNatTextComponent.getText() See Also: ItsNatTextComponent.getDocument() See Also: |
|
|