Ejemplo n.º 1
0
    def onModuleLoad(self):

        self.remote = InfoServicePython()

        self.tree_width = 200

        self.tp = HorizontalPanel()
        self.tp.setWidth("%dpx" % (self.tree_width))
        self.treeview = Trees()
        self.treeview.fTree.addTreeListener(self)
        self.sp = ScrollPanel()
        self.tp.add(self.treeview)
        self.sp.add(self.tp)
        self.sp.setHeight("100%")

        self.horzpanel1 = HorizontalPanel()
        self.horzpanel1.setSize("100%", "100%")
        self.horzpanel1.setBorderWidth(1)
        self.horzpanel1.setSpacing("10px")

        self.rp = RightPanel()
        self.rps = ScrollPanel()
        self.rps.add(self.rp)
        self.rps.setWidth("100%")
        self.rp.setWidth("100%")

        self.cp1 = CollapserPanel(self)
        self.cp1.setWidget(self.sp)
        self.cp1.setHTML(" ")


        self.midpanel = MidPanel(self)
        self.cp2 = CollapserPanel(self)
        self.cp2.setWidget(self.midpanel)
        self.cp2.setHTML(" ")

        self.horzpanel1.add(self.cp1)
        self.horzpanel1.add(self.cp2)
        self.horzpanel1.add(self.rps)

        self.cp1.setInitialWidth("%dpx" % self.tree_width)
        self.cp2.setInitialWidth("200px")

        RootPanel().add(self.horzpanel1)

        width = Window.getClientWidth()
        height = Window.getClientHeight()

        self.onWindowResized(width, height)
        Window.addWindowResizeListener(self)
    def __init__(self, vertical=False, **kwargs):
        # set defaults
        if not 'StyleName' in kwargs:
            if vertical:    # vertical split panel
                kwargs['StyleName'] = "gwt-VerticalSplitPanel"
            else:
                kwargs['StyleName'] = "gwt-HorizontalSplitPanel"
        # splitter drag state vars
        self._drag_start = None
        self._pos = "50%"
        # orientation
        self._vertical = vertical
        # now init the bases
        AbsolutePanel.__init__(self, **kwargs)
        MouseHandler.__init__(self)
        # add our event support?
        self.addListenedEvent("Resize")
        # create the top/left widget container
        self._container1 = ScrollPanel()
        # create the bottom/right widget container
        self._container2 = ScrollPanel()
        # create the splitter
        self._splitter = SplitPanelSplitter(self)
        # add splitter handling
        self._splitter.addMouseListener(self)
        # add mouse event handling
        self.addMouseListener(self)
        # add the parts
        AbsolutePanel.add(self, self._container1, 0, 0)
        AbsolutePanel.add(self, self._splitter, 0, 0)
        AbsolutePanel.add(self, self._container2, 0, 0)

        # set the layout
        if vertical:    # vertical split panel
            self._splitter.setStyleName("vsplitter")
            self._splitter.setWidth("100%")
            self._container1.setWidth("100%")
            self._container2.setWidth("100%")
            # set drag cursor
            DOM.setStyleAttribute(self._splitter.getElement(),
                                    "cursor", "n-resize")
        else:   # horizontal split panel
            self._splitter.setStyleName("hsplitter")
            self._splitter.setHeight("100%")
            self._container1.setHeight("100%")
            self._container2.setHeight("100%")
            # set drag cursor
            DOM.setStyleAttribute(self._splitter.getElement(),
                                    "cursor", "e-resize")
Ejemplo n.º 3
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("100%")

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("99%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        authors = [("2008, 2009", "Kenneth Casson Leighton", "*****@*****.**")]
        for years, name, email in authors:
            authors_html = \
            '&copy; %s <a href="mailto:%s">%s</a><br />' %\
            (years, email, name)
        authors_panel = HTML()
        authors_panel.setStyleName("ks-Authors")
        authors_panel.setHTML(authors_html[:-6])

        left_panel = DockPanel(Height="100%")
        left_panel.add(self.sink_list, DockPanel.NORTH)
        left_panel.add(authors_panel, DockPanel.SOUTH)

        self.description.setStyleName("ks-Intro")

        self.panel.add(left_panel, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Ejemplo n.º 4
0
    def __init__(self):
        SimplePanel.__init__(self)
        vert = VerticalPanel()
        vert.setSpacing("10px")
        self.add(vert)

        panel = ScrollPanel(Size=("300px", "100px"))

        contents = HTML("<b>Tao Te Ching, Chapter One</b><p>" +
                        "The Way that can be told of is not an unvarying " +
                        "way;<p>The names that can be named are not " +
                        "unvarying names.<p>It was from the Nameless that " +
                        "Heaven and Earth sprang;<p>The named is but the " +
                        "mother that rears the ten thousand creatures, " +
                        "each after its kind.")
        panel.add(contents)
        vert.add(panel)

        container = SimplePanel(Width="400px", Height="200px")
        contents2 = HTML(
            50 *
            "Dont forget to grab the css for SuperScrollPanel in Showcase.css! "
        )
        panel2 = SuperScrollPanel(contents2)
        container.add(panel2)
        vert.add(container)
Ejemplo n.º 5
0
    def __init__(self, **kwargs):
        DockPanel.__init__(self, **kwargs)
        self.grid = Grid(StyleName="datagrid")
        self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
        self.header = Grid(Height="50px")
        self.add(self.header, DockPanel.NORTH)
        self.add(self.sp, DockPanel.CENTER)
        cf = self.setCellHeight(self.header, "50px")
        cf = self.setCellHeight(self.sp, "100%")

        self.sortcol = 0
Ejemplo n.º 6
0
    def __init__(self):
        Composite.__init__(self)

        self.vp_list = VerticalPanel()
        self.sinks = []
        self.selectedSink = -1

        self.sp = ScrollPanel(self.vp_list)
        self.sp.setWidth("24em")

        self.initWidget(self.sp)
        self.setStyleName("ks-List")

        self.resize(Window.getClientWidth(), Window.getClientHeight())
Ejemplo n.º 7
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("98%")
        self.sp.setHeight("%dpx" % (height - 200))

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Ejemplo n.º 8
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = ScrollPanel(Size=("300px", "100px"))

        contents = HTML("<b>Tao Te Ching, Chapter One</b><p>" +
                        "The Way that can be told of is not an unvarying " +
                        "way;<p>The names that can be named are not " +
                        "unvarying names.<p>It was from the Nameless that " +
                        "Heaven and Earth sprang;<p>The named is but the " +
                        "mother that rears the ten thousand creatures, " +
                        "each after its kind.")

        panel.add(contents)
        self.add(panel)
Ejemplo n.º 9
0
    def __init__(self, name, html):
        DialogBox.__init__(self)
        self.setText(name)

        closeButton = Button("Close", self)

        htp = HTMLPanel(html)
        self.sp = ScrollPanel(htp)

        dock = DockPanel()
        dock.setSpacing(4)

        dock.add(closeButton, DockPanel.SOUTH)
        dock.add(self.sp, DockPanel.CENTER)

        dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        dock.setCellWidth(self.sp, "100%")
        dock.setWidth("100%")
        self.setWidget(dock)
Ejemplo n.º 10
0
    def onModuleLoad(self):
        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()
        self.b = Button("load", self)

        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height - 110))

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        self.description.setStyleName("ks-Intro")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)
        RootPanel().add(self.b)

        self.loadSinks()
Ejemplo n.º 11
0
    def onModuleLoad(self):
        # build image display
        img = Image("babykatie_small.jpg", width="300px", height="300px")
        img.element.setAttribute("usemap", "#themap")
        img.element.setAttribute("ismap", "1")
        imagepanel = ScrollPanel()
        imagepanel.add(img)

        # build message display
        msgpanel = VerticalPanel()
        msgpanel.add(
            Label("move mouse over baby katie's eyes, nose and mouth."))
        msgarea1 = Label("movement messages")
        msgpanel.add(msgarea1)
        msgarea2 = Label("click messages")
        msgpanel.add(msgarea2)

        imageClickHandler = MapClickHandler(msgarea1, msgarea2)

        # build imagemap
        map = ImageMap("themap", width="300px", height="300px")
        areas = [ \
            NamedMapArea("right eye", "circle", "73, 97, 7"),
            NamedMapArea("left eye", "circle", "116, 88, 5"),
            NamedMapArea("nose", "rect", "88, 97, 115, 115", href="http://lkcl.net"),
            NamedMapArea("mouth", "polygon", "82, 129, 102, 124, 119, 119, 121, 125, 103, 132, 79, 133"),
            ]
        for nma in areas:
            nma.addMouseListener(imageClickHandler)
            nma.addClickListener(imageClickHandler)
            map.add(nma)

        # layout page
        hpanel = HorizontalPanel()
        hpanel.add(map)
        hpanel.add(imagepanel)
        hpanel.add(msgpanel)

        RootPanel().add(hpanel)
Ejemplo n.º 12
0
    def __init__(self):
        Composite.__init__(self)

        panel = VerticalPanel()
        headerPanel = VerticalPanel()
        self.subject = HTML()
        self.sender = HTML()
        self.recipient = HTML()
        self.body = HTML()
        self.scroller = ScrollPanel(self.body)

        self.body.setWordWrap(True)

        headerPanel.add(self.subject)
        headerPanel.add(self.sender)
        headerPanel.add(self.recipient)
        headerPanel.setWidth("100%")

        innerPanel = DockPanel()
        innerPanel.add(headerPanel, DockPanel.NORTH)
        innerPanel.add(self.scroller, DockPanel.CENTER)

        innerPanel.setCellHeight(self.scroller, "100%")
        panel.add(innerPanel)
        innerPanel.setSize("100%", "100%")
        self.scroller.setSize("100%", "100%")
        self.initWidget(panel)

        self.setStyleName("mail-Detail")
        headerPanel.setStyleName("mail-DetailHeader")
        innerPanel.setStyleName("mail-DetailInner")
        self.subject.setStyleName("mail-DetailSubject")
        self.sender.setStyleName("mail-DetailSender")
        self.recipient.setStyleName("mail-DetailRecipient")
        self.body.setStyleName("mail-DetailBody")
        Logger("Mail detail", " ")
Ejemplo n.º 13
0
    def __init__(self):
        Sink.__init__(self)

        text = """This is a <code>ScrollPanel</code> contained at 
        the center of a <code>DockPanel</code>. 
        By putting some fairly large contents 
        in the middle and setting its size explicitly, it becomes a 
        scrollable area within the page, but without requiring the use of 
        an IFRAME.
        Here's quite a bit more meaningless text that will serve primarily 
        to make this thing scroll off the bottom of its visible area.  
        Otherwise, you might have to make it really, really small in order 
        to see the nifty scroll bars!"""

        contents = HTML(text)
        scroller = ScrollPanel(contents, StyleName="ks-layouts-Scroller")

        dock = DockPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                         Spacing=10)
        north0 = HTML("This is the <i>first</i> north component", True)
        east = HTML("<center>This<br>is<br>the<br>east<br>component</center>",
                    True)
        south = HTML("This is the south component")
        west = HTML("<center>This<br>is<br>the<br>west<br>component</center>",
                    True)
        north1 = HTML("This is the <b>second</b> north component", True)
        dock.add(north0, DockPanel.NORTH)
        dock.add(east, DockPanel.EAST)
        dock.add(south, DockPanel.SOUTH)
        dock.add(west, DockPanel.WEST)
        dock.add(north1, DockPanel.NORTH)
        dock.add(scroller, DockPanel.CENTER)

        #Logger.write("Layouts", "TODO: flowpanel")
        flow = FlowPanel()
        for i in range(8):
            flow.add(CheckBox("Flow %d" % i))

        horz = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        horz.add(Button("Button"))
        horz.add(HTML("<center>This is a<br>very<br>tall thing</center>",
                      True))
        horz.add(Button("Button"))

        vert = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        vert.add(Button("Small"))
        vert.add(Button("--- BigBigBigBig ---"))
        vert.add(Button("tiny"))

        menu = MenuBar()
        menu0 = MenuBar(True)
        menu1 = MenuBar(True)
        menu.addItem("menu0", menu0)
        menu.addItem("menu1", menu1)
        menu0.addItem("child00")
        menu0.addItem("child01")
        menu0.addItem("child02")
        menu1.addItem("child10")
        menu1.addItem("child11")
        menu1.addItem("child12")

        #Logger.write("Layouts", "TODO: htmlpanel")
        id = HTMLPanel.createUniqueId()
        text = """This is an <code>HTMLPanel</code>.  It allows you to add 
            components inside existing HTML, like this: <span id='%s' />
            Notice how the menu just fits snugly in there?  Cute.""" % id
        html = HTMLPanel(text)

        DOM.setStyleAttribute(menu.getElement(), "display", "inline")
        html.add(menu, id)

        disclose = DisclosurePanel("Click to disclose")
        disclose.add(
            HTML("""<b>Ta-daaaaa!</b><br />Ok - it could have
                             been<br />more of a surprise."""))

        panel = VerticalPanel(Spacing=8,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER)

        panel.add(self.makeLabel("Dock Panel"))
        panel.add(dock)
        panel.add(self.makeLabel("Flow Panel"))
        panel.add(flow)
        panel.add(self.makeLabel("Horizontal Panel"))
        panel.add(horz)
        panel.add(self.makeLabel("Vertical Panel"))
        panel.add(vert)
        panel.add(self.makeLabel("HTML Panel"))
        panel.add(html)
        panel.add(self.makeLabel("Disclosure Panel"))
        panel.add(disclose)

        self.initWidget(panel)
        self.setStyleName("ks-layouts")
Ejemplo n.º 14
0
    def onModuleLoad(self):
        """ Dynamically build our user interface when the web page is loaded.
        """
        self._root = RootPanel()
        self._tree = Tree()
        self._rightPanel = SimplePanel()
        self._curContents = None

        intro = HTML(
            '<h3>Welcome to the Pyjamas User Interface Showcase</h3>' +
            '<p/>Please click on an item to start.')

        self._introPanel = VerticalPanel()
        self._introPanel.add(uiHelpers.indent(intro, left=20))

        self._demos = [
        ]  # List of all installed demos.  Each item in this list
        # is a dictionary with the following entries:
        #
        #     'name'
        #
        #         The name for this demo.
        #
        #     'section'
        #
        #         The name of the section of the demo tree
        #         this demo should be part of.
        #
        #     'doc'
        #
        #         The documentation for this demo.
        #
        #     'src'
        #
        #         The source code for this demo.
        #
        #     'example'
        #
        #         The Panel which holds the example output for
        #         this demo.

        self.loadDemos()
        self.buildTree()

        self._tree.setSize("0%", "100%")

        divider = VerticalPanel()
        divider.setSize("1px", "100%")
        divider.setBorderWidth(1)

        scroller = ScrollPanel(self._rightPanel)
        scroller.setSize("100%", "100%")

        hPanel = HorizontalPanel()
        hPanel.setSpacing(4)

        hPanel.add(self._tree)
        hPanel.add(divider)
        hPanel.add(scroller)

        hPanel.setHeight("100%")
        self._root.add(hPanel)

        self._tree.addTreeListener(self)
        self.showDemo(None)