class LabelRichExample(VerticalLayout, IClickListener): def __init__(self): super(LabelRichExample, self).__init__() self.setSpacing(True) self._editor = RichTextArea() self._richText = Label('<h1>Rich text example</h1>' '<p>The <b>quick</b> brown fox jumps <sup>over</sup> ' 'the <b>lazy</b> dog.</p>' '<p>This text can be edited with the <i>Edit</i> -button</p>') self._richText.setContentMode(Label.CONTENT_XHTML) self.addComponent(self._richText) self._b = Button('Edit') self._b.addListener(self, IClickListener) self.addComponent(self._b) self._editor.setWidth('100%') def buttonClick(self, event): if self.getComponentIterator().next() == self._richText: self._editor.setValue(self._richText.getValue()) self.replaceComponent(self._richText, self._editor) self._b.setCaption('Apply') else: self._richText.setValue(self._editor.getValue()) self.replaceComponent(self._editor, self._richText) self._b.setCaption('Edit')
class LabelRichExample(VerticalLayout, IClickListener): def __init__(self): super(LabelRichExample, self).__init__() self.setSpacing(True) self._editor = RichTextArea() self._richText = Label( '<h1>Rich text example</h1>' '<p>The <b>quick</b> brown fox jumps <sup>over</sup> ' 'the <b>lazy</b> dog.</p>' '<p>This text can be edited with the <i>Edit</i> -button</p>') self._richText.setContentMode(Label.CONTENT_XHTML) self.addComponent(self._richText) self._b = Button('Edit') self._b.addListener(self, IClickListener) self.addComponent(self._b) self._editor.setWidth('100%') def buttonClick(self, event): if self.getComponentIterator().next() == self._richText: self._editor.setValue(self._richText.getValue()) self.replaceComponent(self._richText, self._editor) self._b.setCaption('Apply') else: self._richText.setValue(self._editor.getValue()) self.replaceComponent(self._editor, self._richText) self._b.setCaption('Edit')
def __init__(self): super(TooltipsExample, self).__init__() self.setSpacing(True) # Plain tooltip (description) plain = Button("Mouse over for plain tooltip") plain.setStyleName(BaseTheme.BUTTON_LINK) # add the tooltip: plain.setDescription("A simple plaintext tooltip") self.addComponent(plain) # Richtext tooltip (description) rich = Button("Mouse over for richtext tooltip") rich.setStyleName(BaseTheme.BUTTON_LINK) # add the tooltip: rich.setDescription( ( '<h2><img src="../VAADIN/themes/sampler/' 'icons/comment_yellow.gif"/>A richtext tooltip</h2>' "<ul>" "<li>HTML formatting</li><li>Images<br/>" "</li><li>etc...</li></ul>" ) ) self.addComponent(rich) # Edit rte = RichTextArea() rte.setValue(("Click <b>" + self._editTxt + "</b> to edit this tooltip, then <b>" + self._applyTxt + "</b>")) rte.setVisible(False) # hide editor initially rte.setWidth("100%") self.addComponent(rte) aply = Button(self._editTxt, EditListener(self, rte)) aply.setDescription(rte.getValue()) self.addComponent(aply)
def __init__(self): super(TooltipsExample, self).__init__() self.setSpacing(True) # Plain tooltip (description) plain = Button('Mouse over for plain tooltip') plain.setStyleName(BaseTheme.BUTTON_LINK) # add the tooltip: plain.setDescription('A simple plaintext tooltip') self.addComponent(plain) # Richtext tooltip (description) rich = Button('Mouse over for richtext tooltip') rich.setStyleName(BaseTheme.BUTTON_LINK) # add the tooltip: rich.setDescription( ('<h2><img src=\"../VAADIN/themes/sampler/' 'icons/comment_yellow.gif\"/>A richtext tooltip</h2>' '<ul>' '<li>HTML formatting</li><li>Images<br/>' '</li><li>etc...</li></ul>')) self.addComponent(rich) # Edit rte = RichTextArea() rte.setValue( ('Click <b>' + self._editTxt + '</b> to edit this tooltip, then <b>' + self._applyTxt + '</b>')) rte.setVisible(False) # hide editor initially rte.setWidth('100%') self.addComponent(rte) aply = Button(self._editTxt, EditListener(self, rte)) aply.setDescription(rte.getValue()) self.addComponent(aply)