Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.text
Class BaseRichTextDisplay

java.lang.Object
  extended by Composite
      extended by ch.elexis.text.BaseRichTextDisplay
All Implemented Interfaces:
IRichTextDisplay

public class BaseRichTextDisplay
extends Composite
implements IRichTextDisplay

Base class for Views to display SimpleStructuredDocuments. The BaseRichTextDisplay does propagate user input into the underlying SimpleStructuredDocument and does reflect changes of the SSD to the UI.

Author:
gerry

Field Summary
 ElexisEventListenerImpl eeli_user
           
 IMenuListener globalMenuListener
           
 
Constructor Summary
BaseRichTextDisplay(Composite parent)
          Instantiates a new base rich text display.
 
Method Summary
 void addFocusListener(FocusListener fl)
           
 void addKeyListener(KeyListener kl)
           
 void addMenuListener(IMenuListener ml)
          Add a listener to the context menu of the control.
 void connectGlobalActions(IViewSite site)
          Connect global actions.
 void disconnectGlobalActions(IViewSite site)
          Disconnect global actions.
 GenericRange getCaretRange()
          find the position of the caret and the selected Range (if any)
 SimpleStructuredDocument getContents()
          Gets the contents.
 int getTextLocationAt(int x, int y)
          Find the caret position matching a given coordinate in the control
 java.lang.String getWordUnderCursor()
          Gibt das Wort des Inhalts zurück das durch den Cursor berührt wird.
 void makeActions()
          Make actions.
 void putCaretToEnd()
           
 void removeFocusListener(FocusListener fl)
           
 void removeKeyListener(KeyListener kl)
           
 void removeMenuListener(IMenuListener ml)
          remove a Menu listener
 void setCaretRange(GenericRange gr)
           
 void setColors(Color foreground, Color background)
          Sets the colors.
 boolean setFocus()
           
 void setReadOnly(boolean bReadOnly)
          Set read only state of the display
 void setSelectedRange(GenericRange gr)
          Sets the selected range.
 void setText(java.lang.String text)
          Shortcut fot getContents().loadText(text, false)
 void updateDisplay()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

globalMenuListener

public IMenuListener globalMenuListener

eeli_user

public ElexisEventListenerImpl eeli_user
Constructor Detail

BaseRichTextDisplay

public BaseRichTextDisplay(Composite parent)
Instantiates a new base rich text display.

Parameters:
parent - the parent
Method Detail

setReadOnly

public void setReadOnly(boolean bReadOnly)
Set read only state of the display

Parameters:
bReadOnly - true will set read only and darken the background.

setText

public void setText(java.lang.String text)
Shortcut fot getContents().loadText(text, false)

Parameters:
text - the new text (can be plaintext or XML compliant to the SSD Schema or the Samdas Schema

addFocusListener

public void addFocusListener(FocusListener fl)

removeFocusListener

public void removeFocusListener(FocusListener fl)

addKeyListener

public void addKeyListener(KeyListener kl)

removeKeyListener

public void removeKeyListener(KeyListener kl)

getContents

public SimpleStructuredDocument getContents()
Gets the contents.

Specified by:
getContents in interface IRichTextDisplay
Returns:
the contents
See Also:
IRichTextDisplay.getContents()

addMenuListener

public void addMenuListener(IMenuListener ml)
Description copied from interface: IRichTextDisplay
Add a listener to the context menu of the control. The listener will be called immerdiately before the menu opens.

Specified by:
addMenuListener in interface IRichTextDisplay

removeMenuListener

public void removeMenuListener(IMenuListener ml)
Description copied from interface: IRichTextDisplay
remove a Menu listener

Specified by:
removeMenuListener in interface IRichTextDisplay

setFocus

public boolean setFocus()

setColors

public void setColors(Color foreground,
                      Color background)
Sets the colors.

Parameters:
foreground - the foreground
background - the background

connectGlobalActions

public void connectGlobalActions(IViewSite site)
Connect global actions.

Parameters:
site - the site

disconnectGlobalActions

public void disconnectGlobalActions(IViewSite site)
Disconnect global actions.

Parameters:
site - the site

getWordUnderCursor

public java.lang.String getWordUnderCursor()
Gibt das Wort des Inhalts zurück das durch den Cursor berührt wird.

Returns:
Das mit dem Cursor berührte Wort des Textfelds, String.empty falls kein Wort berührt wird

getCaretRange

public GenericRange getCaretRange()
Description copied from interface: IRichTextDisplay
find the position of the caret and the selected Range (if any)

Specified by:
getCaretRange in interface IRichTextDisplay
Returns:
a GenericRange with the caret Position and the length of the selected text (may be 0).

setSelectedRange

public void setSelectedRange(GenericRange gr)
Sets the selected range.

Parameters:
gr - the new selected range

getTextLocationAt

public int getTextLocationAt(int x,
                             int y)
Description copied from interface: IRichTextDisplay
Find the caret position matching a given coordinate in the control

Specified by:
getTextLocationAt in interface IRichTextDisplay
Parameters:
x - number of pixels from the left upper corner to the right
y - number of pixels from the left upper corner down
Returns:
the caret location. If the coordinates wre outside the text, returns the end of the text.

setCaretRange

public void setCaretRange(GenericRange gr)
Specified by:
setCaretRange in interface IRichTextDisplay

makeActions

public void makeActions()
Make actions.


updateDisplay

public void updateDisplay()
                   throws ElexisException
Specified by:
updateDisplay in interface IRichTextDisplay
Throws:
ElexisException

putCaretToEnd

public void putCaretToEnd()

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis