Пример #1
0
    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)
Пример #2
0
    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)