示例#1
0
class RichTextArea(FocusWidget):
    """*
    * Creates a new, blank {@link RichTextArea} object with no stylesheet.
    """
    def __init__(self, **kwargs):
        if not kwargs.has_key('StyleName'):
            kwargs['StyleName'] = "gwt-RichTextArea"
        self.impl = RichTextAreaImplStandard()
        FocusWidget.__init__(self, self.impl.getElement(), **kwargs)

    def setCssStyling(self, style):
        """ sets whether cloning is to be done of the main document's
            CSS Style elements into the iframe of the editor
        """
        if style:
            self.impl.setCssStyling()

    """*
    * Gets the basic rich text formatting interface.
    *
    * @return <code>None</code> if basic formatting is not supported
    """

    def getBasicFormatter(self):
        if self.impl.isBasicEditingSupported():
            return self.impl

        return None

    """*
    * Gets the full rich text formatting interface.
    *
    * @return <code>None</code> if full formatting is not supported
    """

    def getExtendedFormatter(self):
        if self.impl.isExtendedEditingSupported():
            return self.impl

        return None

    def getHTML(self):
        return self.impl.getHTML()

    def getText(self):
        return self.impl.getText()

    def setFocus(self, focused):
        # There are different problems on each browser when you try to focus an
        # unattached rich text iframe, so just cut it off early.
        if self.isAttached():
            self.impl.setFocus(focused)

    def setHTML(self, html):
        self.impl.setHTML(html)

    def setText(self, text):
        self.impl.setText(text)

    def onAttach(self):
        FocusWidget.onAttach(self)
        self.impl.initElement()

    def onDetach(self):
        FocusWidget.onDetach(self)
        self.impl.uninitElement()
示例#2
0
文件: RichTextArea.py 项目: Afey/pyjs
class RichTextArea (FocusWidget) :

    """*
    * Creates a new, blank {@link RichTextArea} object with no stylesheet.
    """
    def __init__(self, **kwargs):
        if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-RichTextArea"
        self.impl = RichTextAreaImplStandard()
        FocusWidget.__init__(self, self.impl.getElement(), **kwargs)


    def setCssStyling(self, style):
        """ sets whether cloning is to be done of the main document's
            CSS Style elements into the iframe of the editor
        """
        if style:
            self.impl.setCssStyling()

    """*
    * Gets the basic rich text formatting interface.
    *
    * @return <code>None</code> if basic formatting is not supported
    """
    def getBasicFormatter(self):
        if self.impl.isBasicEditingSupported():
            return self.impl

        return None


    """*
    * Gets the full rich text formatting interface.
    *
    * @return <code>None</code> if full formatting is not supported
    """
    def getExtendedFormatter(self):
        if self.impl.isExtendedEditingSupported():
            return self.impl

        return None


    def getHTML(self):
        return self.impl.getHTML()


    def getText(self):
        return self.impl.getText()


    def setFocus(self, focused):
        # There are different problems on each browser when you try to focus an
        # unattached rich text iframe, so just cut it off early.
        if self.isAttached():
            self.impl.setFocus(focused)



    def setHTML(self, html):
        self.impl.setHTML(html)


    def setText(self, text):
        self.impl.setText(text)


    def onAttach(self):
        FocusWidget.onAttach(self)
        self.impl.initElement()


    def onDetach(self):
        FocusWidget.onDetach(self)
        self.impl.uninitElement()