Ejemplo n.º 1
0
    def init(self):
        main = Window("CSS Tools Add-on Test")
        self.setMainWindow(main)

        testWindow = Window("Normal Window")
        testWindow.addComponent(Label("<p>This window is used as the component to measure.</p>", Label.CONTENT_XHTML))
        main.addWindow(testWindow)
        testWindow.center()

        title = Label("CSS Properties to Retrieve")
        title.addStyleName(Reindeer.LABEL_H2)
        main.addComponent(title)

        target = NativeSelect("Target Component")
        main.addComponent(target)

        get = Button("Refresh Properties", GetClickListener(self, target))
        main.addComponent(get)

        main.addComponent(self.buildLabels())

        target.addItem(main.getContent())
        target.setItemCaption(main.getContent(), "Root layout")
        target.addItem(testWindow)
        target.setItemCaption(testWindow, "Sub window")
        target.addItem(get)
        target.setItemCaption(get, "The '" + get.getCaption() + "' Button")
        target.setNullSelectionAllowed(False)
        target.select(testWindow)
Ejemplo n.º 2
0
    def init(self):
        main = Window('CSS Tools Add-on Test')
        self.setMainWindow(main)

        testWindow = Window('Normal Window')
        testWindow.addComponent(
            Label("<p>This window is used as the component to measure.</p>",
                  Label.CONTENT_XHTML))
        main.addWindow(testWindow)
        testWindow.center()

        title = Label('CSS Properties to Retrieve')
        title.addStyleName(Reindeer.LABEL_H2)
        main.addComponent(title)

        target = NativeSelect('Target Component')
        main.addComponent(target)

        get = Button('Refresh Properties', GetClickListener(self, target))
        main.addComponent(get)

        main.addComponent(self.buildLabels())

        target.addItem(main.getContent())
        target.setItemCaption(main.getContent(), 'Root layout')
        target.addItem(testWindow)
        target.setItemCaption(testWindow, 'Sub window')
        target.addItem(get)
        target.setItemCaption(get, 'The \'' + get.getCaption() + '\' Button')
        target.setNullSelectionAllowed(False)
        target.select(testWindow)
Ejemplo n.º 3
0
    def __init__(self):
        super(NativeSelectionExample, self).__init__()

        self.setSpacing(True)

        l = NativeSelect('Please select a city')

        for c in self._cities:
            l.addItem(c)

        l.setNullSelectionAllowed(False)
        l.setValue('Berlin')
        l.setImmediate(True)
        l.addListener(self, IValueChangeListener)
        self.addComponent(l)
Ejemplo n.º 4
0
    def __init__(self):
        super(NativeSelectionExample, self).__init__()

        self.setSpacing(True)

        l = NativeSelect('Please select a city')

        for c in self._cities:
            l.addItem(c)

        l.setNullSelectionAllowed(False)
        l.setValue('Berlin')
        l.setImmediate(True)
        l.addListener(self, IValueChangeListener)
        self.addComponent(l)
Ejemplo n.º 5
0
    def __init__(self):
        super(NotificationCustomExample, self).__init__()

        self.setSpacing(True)

        caption = TextField('Caption', 'Message sent')
        caption.setDescription(('Main info; a short caption-only '
                                'notification is often most effective.'))
        caption.setWidth('200px')
        self.addComponent(caption)

        description = RichTextArea()
        description.setWidth('100%')
        description.setValue('<p>to <i>[email protected]</i></p>')
        description.setCaption('Description')
        description.setDescription(('Additional information; '
                                    'try to keep it short.'))
        self.addComponent(description)

        horiz = HorizontalLayout()
        horiz.setSpacing(True)
        self.addComponent(horiz)

        position = NativeSelect('Position')
        position.setNullSelectionAllowed(False)
        horiz.addComponent(position)
        self.initPositionItems(position)

        style = NativeSelect('Style')
        style.setNullSelectionAllowed(False)
        horiz.addComponent(style)
        self.initTypeItems(style)
        delay = Slider('Delay (msec), -1 means click to hide')
        delay.setDescription(
            ('Delay before fading<br/>Pull all the way to '
             'the left to get -1, which means forever (click to hide).'))
        delay.setWidth('100%')  # 'description' will push width
        delay.setMin(Notification.DELAY_FOREVER)
        delay.setMax(10000)
        self.addComponent(delay)

        # TODO icon select

        l = ShowListener(self, caption, description, style, position, delay)
        show = Button('Show notification', l)
        self.addComponent(show)
        self.setComponentAlignment(show, Alignment.MIDDLE_RIGHT)
Ejemplo n.º 6
0
    def __init__(self):
        super(NotificationCustomExample, self).__init__()

        self.setSpacing(True)

        caption = TextField('Caption', 'Message sent')
        caption.setDescription(('Main info; a short caption-only '
                'notification is often most effective.'))
        caption.setWidth('200px')
        self.addComponent(caption)

        description = RichTextArea()
        description.setWidth('100%')
        description.setValue('<p>to <i>[email protected]</i></p>')
        description.setCaption('Description')
        description.setDescription(('Additional information; '
                'try to keep it short.'))
        self.addComponent(description)

        horiz = HorizontalLayout()
        horiz.setSpacing(True)
        self.addComponent(horiz)

        position = NativeSelect('Position')
        position.setNullSelectionAllowed(False)
        horiz.addComponent(position)
        self.initPositionItems(position)

        style = NativeSelect('Style')
        style.setNullSelectionAllowed(False)
        horiz.addComponent(style)
        self.initTypeItems(style)
        delay = Slider('Delay (msec), -1 means click to hide')
        delay.setDescription(('Delay before fading<br/>Pull all the way to '
                'the left to get -1, which means forever (click to hide).'))
        delay.setWidth('100%')  # 'description' will push width
        delay.setMin(Notification.DELAY_FOREVER)
        delay.setMax(10000)
        self.addComponent(delay)

        # TODO icon select

        l = ShowListener(self, caption, description, style, position, delay)
        show = Button('Show notification', l)
        self.addComponent(show)
        self.setComponentAlignment(show, Alignment.MIDDLE_RIGHT)