Package library :: Package pyjamas :: Package ui :: Module RichTextToolbar :: Class RichTextToolbar
[hide private]
[frames] | no frames]

Class RichTextToolbar

source code

      object --+                
               |                
         Applier --+            
                   |            
   UIObject.UIObject --+        
                       |        
           Widget.Widget --+    
                           |    
         Composite.Composite --+
                               |
                  object --+   |
                           |   |
  ClickListener.ClickHandler --+
                               |
                  object --+   |
                           |   |
ChangeListener.ChangeHandler --+
                               |
                              RichTextToolbar

Instance Methods [hide private]
 
__init__(self, richText, _parent, **kwargs)
use this to apply properties as a dictionary, e.g.:
source code
 
createHeadingStyleList(self, caption) source code
 
createColorList(self, caption) source code
 
createFontList(self) source code
 
createFontSizes(self) source code
 
createPushButton(self, img, tip) source code
 
createToggleButton(self, img, tip) source code
 
updateStatus(self)
* Updates the status of all the stateful buttons.
source code
 
onChange(self, sender) source code
 
onClick(self, sender) source code
 
onKeyDown(self, sender, keyCode, modifiers) source code
 
onKeyPress(self, sender, keyCode, modifiers) source code
 
onKeyUp(self, sender, keyCode, modifiers) source code
 
onMouseLeave(self, event) source code
 
onMouseEnter(self, event) source code
 
onMouseUp(self, event, x, y) source code
 
onMouseMove(self, event, x, y) source code
 
onMouseDown(self, event, x, y) source code
 
onFocus(self, event) source code
 
onLostFocus(self, event)
lost focus
source code
 
onMouseOut(self, sender) source code
 
onMouseOver(self, sender) source code
 
setFocus(self, wid) source code
 
execute_set_focus(self) source code
 
findNodeByNumber(self, num) source code
 
selectNodes(self, startNode, startOffset, endNode=None, endOffset=None) source code
 
font1(self) source code
 
font2(self) source code
 
surround1(self) source code
 
surround2(self) source code
 
_surround(self, kls, cls)
this is possibly one of the most truly dreadful bits of code for manipulating DOM ever written.
source code
 
refresh(self) source code
 
delete(self) source code
 
toCursor(self, start) source code
 
run(self) source code
 
getSelection(self) source code
 
getWindow(self, iFrame=None) source code
 
captureSelection(self)
This captures the selection when the mouse leaves the RTE, because in IE the selection indicating the cursor position is lost once another widget gains focus.
source code
 
onSelectionChange(self, sel) source code
 
isOnTextBorder(self, sender) source code
 
startSelTimer(self) source code
 
endSelTimer(self) source code
 
getRange(self) source code
 
checkForChange(self) source code
 
setHtml(self, text) source code
 
getHtml(self) source code
 
getDocument(self) source code
 
getFormatter(self) source code

Inherited from Composite.Composite: initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget

Inherited from Widget.Widget: doAttachChildren, doDetachChildren, getID, getLayoutData, getParent, onLoad, removeFromParent, setContextMenu, setID, setLayoutData, setParent

Inherited from UIObject.UIObject: addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getClientHeight, getClientWidth, getElement, getHeight, getOffsetHeight, getOffsetWidth, getStyleAttribute, getStyleName, getStylePrimaryName, getTitle, getVisible, getWidth, isVisible, removeStyleDependentName, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleAttribute, setStyleName, setTitle, setVisible, setWidth, setzIndex, sinkEvents, unsinkEvents

Inherited from Applier: applyValues, retrieveValues, setDefaults, setElementProperties, updateInstance

Inherited from ClickListener.ClickHandler: addClickListener, addDoubleClickListener, clearClickListener, clearDoubleClickListener, onDoubleClick, removeClickListener, removeDoubleClickListener

Inherited from ChangeListener.ChangeHandler: addChangeListener, removeChangeListener

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from UIObject.UIObject (private): _getProps

Inherited from Applier (private): _getElementProps

Class Variables [hide private]
  fontSizesConstants = [RichTextAreaConsts.XX_SMALL, RichTextAre...
* * Creates a toolbar that drives the given rich text area.

Inherited from UIObject.UIObject (private): _props

Inherited from Applier (private): _elem_props

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, richText, _parent, **kwargs)
(Constructor)

source code 

use this to apply properties as a dictionary, e.g.:

   x = klass(..., StyleName='class-name')

will do:

   x = klass(...)
   x.setStyleName('class-name')

and:

   x = klass(..., Size=("100%", "20px"), Visible=False)

will do:

   x = klass(...)
   x.setSize("100%", "20px")
   x.setVisible(False)
Overrides: object.__init__
(inherited documentation)

onChange(self, sender)

source code 
Overrides: ChangeListener.ChangeHandler.onChange

onClick(self, sender)

source code 
Overrides: ClickListener.ClickHandler.onClick

_surround(self, kls, cls)

source code 

this is possibly one of the most truly dreadful bits of code for manipulating DOM ever written. its purpose is to add only the editor class required, and no more. unfortunately, DOM gets chopped up by the range thing, and a bit more besides. so we have to:

* extract the range contents * clean up removing any blank text nodes that got created above * slap a span round it * clean up removing any blank text nodes that got created above * remove any prior editor styles on the range contents * go hunting through the entire document for stacked editor styles

this latter is funfunfun because only "spans with editor styles which themselves have no child elements but a single span with an editor style" must be removed. e.g. if an outer editor span has another editor span and also some text, the outer span must be left alone.

captureSelection(self)

source code 

This captures the selection when the mouse leaves the RTE, because in IE the selection indicating the cursor position is lost once another widget gains focus. Could be implemented for IE only.


Class Variable Details [hide private]

fontSizesConstants

* * Creates a toolbar that drives the given rich text area. * * @param richText the rich text area to be controlled

Value:
[RichTextAreaConsts.XX_SMALL, RichTextAreaConsts.X_SMALL, RichTextArea\
Consts.SMALL, RichTextAreaConsts.MEDIUM, RichTextAreaConsts.LARGE, Ric\
hTextAreaConsts.X_LARGE, RichTextAreaConsts.XX_LARGE]