当前位置: 首页>>代码示例>>Python>>正文


Python VerticalPanel.setSpacing方法代码示例

本文整理汇总了Python中pyjamas.ui.VerticalPanel.setSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.setSpacing方法的具体用法?Python VerticalPanel.setSpacing怎么用?Python VerticalPanel.setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.VerticalPanel的用法示例。


在下文中一共展示了VerticalPanel.setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createUserInputUI

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
 def createUserInputUI(self, saveButton):
     """
     Create user input UI
     
     @return user input ui
     """
     p = VerticalPanel()
     title = TextBox()
     content = TextBox()
     p.setSpacing(10)
     p.add(self.createInput(u"Title", title))
     p.add(self.createInput(u"Content", content))
     p.add(saveButton)
     class _anonymous(ClickHandler):
         
         @java.typed(ClickEvent)
         def onClick(self, event):
             note = Note.createNote(title.getValue(), content.getValue())
             class _anonymous(AsyncCallback):
                 
                 @java.typed(Throwable)
                 def onFailure(self, caught):
                     Notes_create.self###NOTIMPL QThis###.handleFailure(caught)
                 
                 @java.typed(Long)
                 def onSuccess(self, noteId):
                     p.add(HTML(u"Added note with id " + java.str(noteId)))
                     deleteNoteLink = Anchor(u"Delete")
                     deleteNoteLink.addClickHandler(self.DeleteNoteClickHandler(noteId))
                     p.add(deleteNoteLink)
             self.apiClient.notesCreate(note, _anonymous())
     saveButton.addClickHandler(_anonymous()) #  User clicks save, store it to facebook
     return p
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:35,代码来源:Notes_create.py

示例2: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):
        panel = DockPanel()
        RootPanel().add(panel)

        panel.setWidth("100%")
        panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>Hello</h1>')
        description = HTML("""""")
        panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.SOUTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Hello</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""<tt><a href="#Hello">Hello</a>&nbsp;World&nbsp;Example</tt>""")
        panel.add(docs, DockPanel.NORTH)


        modules = eval(r'''['<a href="pyjamas.DOM.html">pyjamas.DOM</a>', '<a href="pyjamas.Window.html">pyjamas.Window</a>']''')
        contents = self.multicolumn(modules)
        contents = self.bigsection('Modules', '#fffff', '#aa55cc', contents)

        panel.add(contents, DockPanel.NORTH)

        classes = eval(r'''['<dl>\n<dt><font face="helvetica, arial"><a href="Hello.html#Hello">Hello</a>\n</font></dt></dl>\n', '<p>\n<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">\n<tr bgcolor="#ffc8d8">\n<td colspan=3 valign=bottom>&nbsp;<br>\n<font color="#000000" face="helvetica, arial"><a name="Hello">class <strong>Hello</strong></a></font></td></tr>\n    \n<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>\n<td width="100%">Methods defined here:<br>\n<dl><dt><a name="Hello-onBrowserEvent"><strong>onBrowserEvent</strong></a>(self, event)</dt></dl>\n\n<dl><dt><a name="Hello-onModuleLoad"><strong>onModuleLoad</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onTimer"><strong>onTimer</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onWindowResized"><strong>onWindowResized</strong></a>(self, width, height)</dt></dl>\n\n</td></tr></table>']''')
        contents = self.multicolumn(modules)
        contents = self.bigsection(
                'Classes', '#ffffff', '#ee77aa', HTML('\n'.join(classes)))

        panel.add(contents, DockPanel.NORTH)

        functions = eval(r'''['<dl><dt><a name="-greet"><strong>greet</strong></a>(sender, event)</dt></dl>\n']''')
        contents = self.multicolumn(modules)
        contents = self.bigsection(
                'Functions', '#ffffff', '#eeaa77', HTML('\n'.join(functions)))

        panel.add(contents, DockPanel.NORTH)

        data = eval(r'''["<strong>test</strong> = 'hello'"]''')
        contents = self.multicolumn(modules)
        contents = self.bigsection(
                'Data', '#ffffff', '#55aa55', HTML('\n'.join(data)))

        panel.add(contents, DockPanel.NORTH)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:60,代码来源:docHello.py

示例3: createDefaultFrontpage

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
 def createDefaultFrontpage(self):
     pp = FbProfilePic(self.apiClient.getLoggedInUser(), Size.square)
     pp.setSize(u"30px", u"30px")
     name = FbName(self.apiClient.getLoggedInUser())
     name.setUseyou(False)
     name.setLinked(False)
     welcomePnl = VerticalPanel()
     welcomePnl.setSpacing(10)
     welcomePnl.add(HTML(java.str(java.str(java.str(u"<h4>Welcome, " + java.str(name)) + u" ") + java.str(pp)) + u"</h4> "))
     welcomePnl.add(HTML(self.wText))
     return welcomePnl
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:13,代码来源:ShowcaseClient.py

示例4: __init__

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))
        self.initWidget(panel)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:17,代码来源:Text.py

示例5: __init__

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
 def __init__(self):
     Sink.__init__(self)
     self.fDialogButton = Button("Show Dialog", self)
     self.fPopupButton = Button("Show Popup", self)
     
     panel = VerticalPanel()
     panel.add(self.fPopupButton)
     panel.add(self.fDialogButton)
     
     list = ListBox()
     list.setVisibleItemCount(5)
     for i in range(10):
         list.addItem("list item %d" % i)
     panel.add(list)
     
     panel.setSpacing(8)
     self.initWidget(panel)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:19,代码来源:Popups.py

示例6: __init__

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
 def __init__(self, ):
     self.__init__._super()
     """
     New Showcase
     """
     vPanel = VerticalPanel()
     vPanel.setStyleName(u"gwittit-Stream_publish")
     innerPanel = VerticalPanel()
     innerPanel.setStyleName(u"innerPanel")
     innerPanel.setSpacing(10)
     publishButton = Button(u"PublishStream #1")
     helpText = Label(u"This will display a dialog where you can publish stream to your wall")
     publishButton2 = Button(u"PublishStream #2")
     helpText2 = HTML(java.str(u"This will publish a stream with the text <b>" + java.str(self.__class__.defaultUserMessage)) + u"</b> ( publish_stream must be granted )")
     publishButton3 = Button(u"PublisStream #3")
     helpText3 = HTML(u"This will prompt user to update his or her status")
     innerPanel.add(publishButton)
     innerPanel.add(helpText)
     vPanel.add(innerPanel)
     publishButton.addClickHandler(self.PublishStreamClickHandler(innerPanel, True))
     innerPanel = VerticalPanel()
     innerPanel.setSpacing(10)
     innerPanel.setStyleName(u"innerPanel")
     innerPanel.add(publishButton2)
     innerPanel.add(helpText2)
     vPanel.add(innerPanel)
     publishButton2.addClickHandler(self.PublishStreamClickHandler(innerPanel, False))
     innerPanel = VerticalPanel()
     innerPanel.setStyleName(u"innerPanel")
     innerPanel.add(publishButton3)
     innerPanel.add(helpText3)
     innerPanel.setSpacing(10)
     vPanel.add(innerPanel)
     publishButton3.addClickHandler(self.PublishStreamSimpleHandler())
     self.initWidget(vPanel)
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:37,代码来源:Stream_publish.py

示例7: __init__

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def __init__(self):
        Sink.__init__(self)
        disabledButton = Button("Disabled Button")
        disabledCheck = CheckBox("Disabled Check")
        normalButton = Button("Normal Button")
        normalCheck = CheckBox("Normal Check")
        panel = VerticalPanel()
        radio0 = RadioButton("group0", "Choice 0")
        radio1 = RadioButton("group0", "Choice 1")
        radio2 = RadioButton("group0", "Choice 2 (Disabled)")
        radio3 = RadioButton("group0", "Choice 3")

        hp=HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(normalButton)
        hp.add(disabledButton)
        
        hp=HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(normalCheck)
        hp.add(disabledCheck)
        
        hp=HorizontalPanel()
        panel.add(hp)
        hp.setSpacing(8)
        hp.add(radio0)
        hp.add(radio1)
        hp.add(radio2)
        hp.add(radio3)
        
        disabledButton.setEnabled(False)
        disabledCheck.setEnabled(False)
        radio2.setEnabled(False)
        
        panel.setSpacing(8)
        self.initWidget(panel)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:40,代码来源:Buttons.py

示例8: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):

        Window.addWindowResizeListener(self)

        panel = DockPanel()
        RootPanel().add(panel)
        self.panel = panel

        panel.setWidth("100%")
        #panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>Timer</h1>')
        description = HTML("""""")
        #panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.NORTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Timer</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Timer.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Timer.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""""")
        panel.add(docs, DockPanel.NORTH)

        tp = TabPanel()
        tp.setWidth("100%")
        self.tp = tp
        panel.add(tp, DockPanel.SOUTH)
        #panel.setCellHeight(tp, "100%")


        classes = [
Proto('Timer'),
]

        class_content = {
'Timer': r'''<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Timer">class <strong>Timer</strong></a></font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Timer-__init__"><strong>__init__</strong></a>(self, time, notify)</dt></dl>

<dl><dt><a name="Timer-cancel"><strong>cancel</strong></a>(self)</dt></dl>

<dl><dt><a name="Timer-getID"><strong>getID</strong></a>(self)</dt></dl>

<dl><dt><a name="Timer-notify"><strong>notify</strong></a>(self, *args)</dt></dl>

</td></tr></table>''',
}

        self.class_doc = ClassDoc(classes, class_content)
        tp.add(self.class_doc, 'Classes')


        functions = ['<dl><dt><a name="-timeout_add"><strong>timeout_add</strong></a>(...)</dt></dl>\n']
        title = bigtitle('Functions')
        contents = section(title, 'functions', HTML('\n'.join(functions)))
        tp.add(contents, 'Functions')



        tp.addTabListener(self)
        tp.selectTab(0)

        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        DeferredCommand().add(self)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:87,代码来源:docTimer.py

示例9: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):

        Window.addWindowResizeListener(self)

        panel = DockPanel()
        RootPanel().add(panel)
        self.panel = panel

        panel.setWidth("100%")
        #panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>DeferredCommand</h1>')
        description = HTML("""""")
        #panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.NORTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>DeferredCommand</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/DeferredCommand.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/DeferredCommand.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""""")
        panel.add(docs, DockPanel.NORTH)

        tp = TabPanel()
        tp.setWidth("100%")
        self.tp = tp
        panel.add(tp, DockPanel.SOUTH)
        #panel.setCellHeight(tp, "100%")


        classes = [
Proto('DeferredCommand'),
]

        class_content = {
'DeferredCommand': r'''<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="DeferredCommand">class <strong>DeferredCommand</strong></a></font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="DeferredCommand-add"><strong>add</strong></a>(self, cmd)</dt></dl>

<dl><dt><a name="DeferredCommand-flushDeferredCommands"><strong>flushDeferredCommands</strong></a>(self)</dt></dl>

<dl><dt><a name="DeferredCommand-maybeSetDeferredCommandTimer"><strong>maybeSetDeferredCommandTimer</strong></a>(self)</dt></dl>

<dl><dt><a name="DeferredCommand-onTimer"><strong>onTimer</strong></a>(self, sender)</dt></dl>

</td></tr></table>''',
}

        self.class_doc = ClassDoc(classes, class_content)
        tp.add(self.class_doc, 'Classes')


        data = [r'''<strong>deferredCommands</strong> = []''',r'''<strong>timerIsActive</strong> = False''']
        title = bigtitle('Data')
        contents = section(title, 'data', HTML('\n'.join(data)))
        tp.add(contents, 'Data')



        tp.addTabListener(self)
        tp.selectTab(0)

        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        DeferredCommand().add(self)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:87,代码来源:docDeferredCommand.py

示例10: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):

        Window.addWindowResizeListener(self)

        panel = DockPanel()
        RootPanel().add(panel)
        self.panel = panel

        panel.setWidth("100%")
        #panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>Location</h1>')
        description = HTML("""""")
        #panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.NORTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>Location</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Location.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/Location.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""""")
        panel.add(docs, DockPanel.NORTH)

        tp = TabPanel()
        tp.setWidth("100%")
        self.tp = tp
        panel.add(tp, DockPanel.SOUTH)
        #panel.setCellHeight(tp, "100%")


        modules = [r'''<a href="docpyjslib.html">pyjslib</a>''']
        contents = self.multicolumn(modules)
        title = bigtitle('Modules')
        contents = section(title, 'module', contents)
        tp.add(contents, 'Modules')


        classes = [
Proto('Location'),
]

        class_content = {
'Location': r'''<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Location">class <strong>Location</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Retrieve&nbsp;this&nbsp;class&nbsp;by&nbsp;calling&nbsp;Window.getLocation().<br>
&nbsp;<br>
This&nbsp;provides&nbsp;a&nbsp;pyjs&nbsp;wrapper&nbsp;for&nbsp;the&nbsp;current&nbsp;location,<br>
with&nbsp;some&nbsp;utility&nbsp;methods&nbsp;for&nbsp;convenience.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Location-__init__"><strong>__init__</strong></a>(self, location)</dt></dl>

<dl><dt><a name="Location-getHash"><strong>getHash</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getHashDict"><strong>getHashDict</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getHost"><strong>getHost</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getHostname"><strong>getHostname</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getHref"><strong>getHref</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getPageHref"><strong>getPageHref</strong></a>(self)</dt><dd><tt>Return&nbsp;href&nbsp;with&nbsp;any&nbsp;search&nbsp;or&nbsp;hash&nbsp;stripped</tt></dd></dl>

<dl><dt><a name="Location-getPathname"><strong>getPathname</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getPort"><strong>getPort</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getProtocol"><strong>getProtocol</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getSearch"><strong>getSearch</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getSearchDict"><strong>getSearchDict</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-getSearchVar"><strong>getSearchVar</strong></a>(self, key)</dt></dl>

<dl><dt><a name="Location-reload"><strong>reload</strong></a>(self)</dt></dl>

<dl><dt><a name="Location-setHash"><strong>setHash</strong></a>(self, hash)</dt></dl>

<dl><dt><a name="Location-setHashDict"><strong>setHashDict</strong></a>(self, hashDict)</dt></dl>

<dl><dt><a name="Location-setHref"><strong>setHref</strong></a>(self, href)</dt></dl>
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:103,代码来源:docLocation.py

示例11: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):

        Window.addWindowResizeListener(self)

        panel = DockPanel()
        RootPanel().add(panel)
        self.panel = panel

        panel.setWidth("100%")
        #panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>EventDelegate</h1>')
        description = HTML("""""")
        #panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.NORTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>EventDelegate</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/EventDelegate.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/EventDelegate.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""""")
        panel.add(docs, DockPanel.NORTH)

        tp = TabPanel()
        tp.setWidth("100%")
        self.tp = tp
        panel.add(tp, DockPanel.SOUTH)
        #panel.setCellHeight(tp, "100%")


        classes = [
Proto('EventDelegate'),
]

        class_content = {
'EventDelegate': r'''<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="EventDelegate">class <strong>EventDelegate</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Create&nbsp;the&nbsp;equivalent&nbsp;of&nbsp;a&nbsp;bound&nbsp;method.&nbsp;&nbsp;This&nbsp;also&nbsp;prepends&nbsp;extra&nbsp;<br>
args,&nbsp;if&nbsp;any,&nbsp;to&nbsp;the&nbsp;called&nbsp;method's&nbsp;argument&nbsp;list&nbsp;when&nbsp;it&nbsp;calls&nbsp;it.<br>
&nbsp;<br>
Pass&nbsp;the&nbsp;method&nbsp;name&nbsp;you&nbsp;want&nbsp;to&nbsp;implement&nbsp;(javascript&nbsp;doesn't<br>
support&nbsp;callables).<br>
&nbsp;<br>
@type&nbsp;args:&nbsp;list<br>
@param&nbsp;args:&nbsp;If&nbsp;given,&nbsp;the&nbsp;arguments&nbsp;will&nbsp;be&nbsp;prepended&nbsp;to&nbsp;the&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arguments&nbsp;passed&nbsp;to&nbsp;the&nbsp;event&nbsp;callback<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="EventDelegate-__init__"><strong>__init__</strong></a>(self, eventMethodName, obj, method, *args)</dt></dl>

<dl><dt><a name="EventDelegate-onEvent"><strong>onEvent</strong></a>(self, *args)</dt></dl>

</td></tr></table>''',
}

        self.class_doc = ClassDoc(classes, class_content)
        tp.add(self.class_doc, 'Classes')



        tp.addTabListener(self)
        tp.selectTab(0)

        # Call the window resized handler to get the initial sizes setup. Doing
        # this in a deferred command causes it to occur after all widgets' sizes
        # have been computed by the browser.

        DeferredCommand().add(self)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:87,代码来源:docEventDelegate.py

示例12: onModuleLoad

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
    def onModuleLoad(self):

        Window.addWindowResizeListener(self)

        panel = DockPanel()
        RootPanel().add(panel)
        self.panel = panel

        panel.setWidth("100%")
        #panel.setHeight("100%")
        panel.setSpacing(5)

        title = HTML('<h1>History</h1>')
        description = HTML("""""")
        #panel.add(title, DockPanel.NORTH)
        panel.add(description, DockPanel.NORTH)

        links = VerticalPanel()
        links.setSpacing(8)

        panel.add(links, DockPanel.NORTH)

        head = HTML("""
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>History</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/History.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/pyjamas/History.py</a></font></td></tr></table>
    """)
        panel.add(head, DockPanel.NORTH)

        docs = HTML("""""")
        panel.add(docs, DockPanel.NORTH)

        tp = TabPanel()
        tp.setWidth("100%")
        self.tp = tp
        panel.add(tp, DockPanel.SOUTH)
        #panel.setCellHeight(tp, "100%")


        classes = [
Proto('History'),
]

        class_content = {
'History': r'''<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="History">class <strong>History</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Simple&nbsp;<a href="#History">History</a>&nbsp;management&nbsp;class&nbsp;for&nbsp;back/forward&nbsp;button&nbsp;support.<br>
&nbsp;<br>
This&nbsp;class&nbsp;allows&nbsp;your&nbsp;AJAX&nbsp;application&nbsp;to&nbsp;use&nbsp;a&nbsp;history.&nbsp;&nbsp;Each&nbsp;time&nbsp;you<br>
call&nbsp;<a href="#History-newItem">newItem</a>(),&nbsp;a&nbsp;new&nbsp;item&nbsp;is&nbsp;added&nbsp;to&nbsp;the&nbsp;history&nbsp;and&nbsp;the&nbsp;history<br>
listeners&nbsp;are&nbsp;notified.&nbsp;&nbsp;If&nbsp;the&nbsp;user&nbsp;clicks&nbsp;the&nbsp;browser's&nbsp;forward&nbsp;or&nbsp;back&nbsp;<br>
buttons,&nbsp;the&nbsp;appropriate&nbsp;item&nbsp;(a&nbsp;string&nbsp;passed&nbsp;to&nbsp;newItem)&nbsp;is&nbsp;fetched<br>
from&nbsp;the&nbsp;history&nbsp;and&nbsp;the&nbsp;history&nbsp;listeners&nbsp;are&nbsp;notified.<br>
&nbsp;<br>
The&nbsp;address&nbsp;bar&nbsp;of&nbsp;the&nbsp;browser&nbsp;contains&nbsp;the&nbsp;current&nbsp;token,&nbsp;using&nbsp;<br>
the&nbsp;"#"&nbsp;seperator&nbsp;(for&nbsp;implementation&nbsp;reasons,&nbsp;not&nbsp;because&nbsp;we&nbsp;love&nbsp;<br>
the&nbsp;#&nbsp;mark).<br>
&nbsp;<br>
You&nbsp;may&nbsp;want&nbsp;to&nbsp;check&nbsp;whether&nbsp;the&nbsp;hash&nbsp;already&nbsp;contains&nbsp;a&nbsp;history<br>
token&nbsp;when&nbsp;the&nbsp;page&nbsp;loads&nbsp;and&nbsp;use&nbsp;that&nbsp;to&nbsp;show&nbsp;appropriate&nbsp;content;<br>
this&nbsp;allows&nbsp;users&nbsp;of&nbsp;the&nbsp;site&nbsp;to&nbsp;store&nbsp;direct&nbsp;links&nbsp;in&nbsp;their<br>
bookmarks&nbsp;or&nbsp;send&nbsp;them&nbsp;in&nbsp;emails.<br>
&nbsp;<br>
To&nbsp;make&nbsp;this&nbsp;work&nbsp;properly&nbsp;in&nbsp;all&nbsp;browsers,&nbsp;you&nbsp;must&nbsp;add&nbsp;a&nbsp;specially<br>
named&nbsp;iframe&nbsp;to&nbsp;your&nbsp;html&nbsp;page,&nbsp;like&nbsp;this:<br>
&nbsp;<br>
&lt;iframe&nbsp;id='__pygwt_historyFrame'&nbsp;style='width:0;height:0;border:0'&gt;&lt;/iframe&gt;<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="History-addHistoryListener"><strong>addHistoryListener</strong></a>(self, listener)</dt></dl>

<dl><dt><a name="History-back"><strong>back</strong></a>(self)</dt></dl>

<dl><dt><a name="History-fireHistoryChangedAndCatch"><strong>fireHistoryChangedAndCatch</strong></a>(self)</dt><dd><tt>#&nbsp;TODO</tt></dd></dl>

<dl><dt><a name="History-fireHistoryChangedImpl"><strong>fireHistoryChangedImpl</strong></a>(self, historyToken)</dt></dl>

<dl><dt><a name="History-forward"><strong>forward</strong></a>(self)</dt></dl>

<dl><dt><a name="History-getToken"><strong>getToken</strong></a>(self)</dt></dl>

<dl><dt><a name="History-newItem"><strong>newItem</strong></a>(self, historyToken)</dt></dl>

<dl><dt><a name="History-onHistoryChanged"><strong>onHistoryChanged</strong></a>(self, historyToken)</dt><dd><tt>#&nbsp;TODO&nbsp;-&nbsp;fireHistoryChangedAndCatch&nbsp;not&nbsp;implemented</tt></dd></dl>

<dl><dt><a name="History-removeHistoryListener"><strong>removeHistoryListener</strong></a>(self, listener)</dt></dl>

</td></tr></table>''',
}

        self.class_doc = ClassDoc(classes, class_content)
        tp.add(self.class_doc, 'Classes')
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:103,代码来源:docHistory.py

示例13: Stream_get

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
class Stream_get(Showcase):

    """
    Showcase for method call <code>stream.get</code>
    
    @author olamar72
    """
    
    @java.init
    def __init__(self, *a, **kw):
        self.outer = VerticalPanel()
        self.stream = None
    method = u"stream.get"
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        self.outer.setSpacing(5)
        self.outer.addStyleName(u"gwittit-Stream_get")
        self.outer.getElement().setId(self.__class__.method)
        self.initWidget(self.outer)
    
    def getNeedPermission(self):
        """
        Need read stream to render showcase
        """
        return Permission.read_stream
    
    def permissionGranted(self):
        self.renderMainContent(self.outer)
    
    def getMessage(self):
        return u"Click to access your NewsFeed"
    
    @java.typed(VerticalPanel)
    def renderMainContent(self, addContentToPnl):
        """
        Render when user granted us permission to read stream
        """
        streamBody = VerticalPanel()
        streamBody.getElement().setId(u"streamBody")
        menu = HorizontalPanel()
        menu.addStyleName(u"streamMenu")
        menu.setSpacing(5)
        postsLink = Anchor(u"Posts") #  Create menu
        profilesLink = Anchor(u"Profiles")
        albumsLink = Anchor(u"Albums")
        menu.add(HTML(u"<b> Choose Stream : </b> "))
        menu.add(postsLink)
        menu.add(albumsLink)
        menu.add(profilesLink)
        class _anonymous(ClickHandler):
            
            @java.typed(ClickEvent)
            def onClick(self, event):
                self.renderPosts(streamBody, self.stream.getPosts())
                Xfbml.parse(streamBody)
        postsLink.addClickHandler(_anonymous()) #  Click posts link
        class _anonymous(ClickHandler):
            
            @java.typed(ClickEvent)
            def onClick(self, event):
                streamBody.clear()
                self.renderProfiles(streamBody, self.stream.getProfiles())
        profilesLink.addClickHandler(_anonymous()) #  Click profiles link
        class _anonymous(ClickHandler):
            
            @java.typed(ClickEvent)
            def onClick(self, event):
                self.renderAlbums(streamBody, self.stream.getAlbums())
        albumsLink.addClickHandler(_anonymous()) #  Click album links
        addContentToPnl.add(streamBody)
        self.addLoader(streamBody) #  Start loading
        class _anonymous(AsyncCallback):
            
            @java.typed(Throwable)
            def onFailure(self, caught):
                self.handleFailure(caught)
            
            @java.typed(Stream)
            def onSuccess(self, result):
                self.stream = result
                addContentToPnl.insert(menu, 0)
                self.removeLoader(streamBody)
                self.renderPosts(streamBody, result.getPosts())
                Xfbml.parse(streamBody)
        self.apiClient.streamGet(_anonymous()) #  Get stream from facebook.
    
    @java.typed(VerticalPanel, JsArray)
    def renderAlbums(self, addContentToPnl, albums):
        """
        Render list of albums in stream
        """
        addContentToPnl.clear()
        p = VerticalPanel()
        p.getElement().setId(u"ProfilAlbums")
        p.add(HTML(u"<h3>Albums in Stream</h3>"))
        for a in Util.iterate(albums):
            p.add(HTML(java.str(u"<h4>" + java.str(a.getName())) + u"</h4>"))
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:103,代码来源:Stream_get.py

示例14: Notifications_send

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
class Notifications_send(Showcase):

    """
    Showcase for <code>notifications.send</code>
    """

    @java.init
    def __init__(self, *a, **kw):
        self.outer = VerticalPanel()
        self.notificationText = TextArea()

    def getNeedPermission(self):
        """
        Get email permissions.
        """
        return Permission.email

    def permissionGranted(self):
        self.renderUI()

    #  Send notification

    @java.private
    @java.innerclass
    @java.implements(ClickHandler)
    class NotificationSendHandler(Object):
        @java.init
        def __init__(self, *a, **kw):
            pass

        @java.typed(ClickEvent)
        def onClick(self, event):
            self.sendToServer()

    #  Notification sent

    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackList)
    class NotificationSent(Object):
        @java.init
        def __init__(self, *a, **kw):
            pass

        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)

        @java.typed(List)
        def onSuccess(self, result):
            self.notificationText.setValue(None)
            self.outer.add(HTML(u"<h3>Email Sent!</h3> <br/> Recepients: "))
            for uid in result:
                self.outer.add(FbName(uid))
            Xfbml.parse(self.outer)

    @__init__.register
    @java.typed()
    def __init__(self,):
        self.__init__._super()
        """
        Create showcase
        """
        self.initWidget(self.outer)

    @java.private
    def renderUI(self):
        fbName = FbName(self.apiClient.getLoggedInUser())
        fbName.setUseyou(False)
        text = HTML(java.str(u"This will send an email notification to  " + java.str(fbName)) + u"(you).")
        text.getElement().setId(u"text")
        self.notificationText.setWidth(u"500px")
        self.notificationText.setHeight(u"100px")
        self.notificationText.setFocus(True)
        self.outer.setSpacing(10)
        submit = Button(u"Send")
        submit.addClickHandler(self.NotificationSendHandler())
        self.outer.add(text)
        self.outer.add(self.notificationText)
        self.outer.add(submit)
        Xfbml.parse(text)

    #  Send notiication.

    @java.private
    def sendToServer(self):
        toIds = ArrayList((Long))
        toIds.add(self.apiClient.getLoggedInUser())
        self.apiClient.notificationsSendEmail(
            toIds, u"Notification Send Email", self.notificationText.getValue(), None, self.NotificationSent()
        )  #  toIds.add ( new Long ( FacebookConnect.getLoggedInUser () ) );
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:93,代码来源:Notifications_send.py

示例15: Comments_add

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import setSpacing [as 别名]
class Comments_add(Showcase):

    """
    Showcase for method call <code>comments.add</code>
    
    @author olamar72
    """
    
    @java.init
    def __init__(self, *a, **kw):
        self.outer = VerticalPanel()
        self.inputWrapper = VerticalPanel()
        self.responseWrapper = SimplePanel()
        self.commentsListPanel = VerticalPanel()
        self.text = TextArea()
        self.submitButton = Button(u"Add Comment ")
    #  Handle add comment
    
    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackJavaScriptObject)
    class AddCommentCallback(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)
        
        @java.typed(JavaScriptObject)
        def onSuccess(self, result):
            self.removeLoader(self.outer)
            self.text.setValue(None)
            self.responseWrapper.add(HTML(u" Thanks :-)"))
            self.displayComments()
    #  User adds comment
    
    @java.private
    @java.innerclass
    @java.implements(ClickHandler)
    class AddCommentClickHandler(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(ClickEvent)
        def onClick(self, event):
            comment = Comment.createComment(u"comments_test", self.text.getValue())
            self.apiClient.commentsAdd(comment, self.AddCommentCallback())
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        """
        New demo
        """
        self.inputWrapper.setSpacing(10)
        self.outer.setSpacing(10)
        self.inputWrapper.getElement().setId(u"CommentsAdd-Input") #  ID's
        self.submitButton.getElement().getStyle().setProperty(u"float", u"right") #  Styles
        self.submitButton.getElement().getStyle().setProperty(u"marginTop", u"10px")
        self.inputWrapper.add(HTML(u"A comment would be great! Thanks."))
        self.inputWrapper.add(self.createInputUi())
        self.outer.add(self.inputWrapper)
        self.outer.add(self.responseWrapper) #  Thank you
        self.outer.add(self.commentsListPanel) #  Show list of comments
        self.displayComments()
        self.submitButton.addClickHandler(self.AddCommentClickHandler())
        Xfbml.parse(self.inputWrapper)
        self.initWidget(self.outer)
    
    @java.private
    def createInputUi(self):
        """
        * Create input text area and submit button.
        """
        vp = VerticalPanel()
        p = HorizontalPanel()
        p.setSpacing(10)
        p.add(FbProfilePic(self.apiClient.getLoggedInUser(), FbProfilePic.Size.square))
        self.text.setHeight(u"100px")
        self.text.setWidth(u"400px")
        vp.add(self.text)
        vp.add(self.submitButton)
        p.add(vp)
        return p
    
    def displayComments(self):
        self.commentsListPanel.clear()
        comments = Comments_get()
        self.commentsListPanel.add(comments)
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:99,代码来源:Comments_add.py


注:本文中的pyjamas.ui.VerticalPanel.setSpacing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。