本文整理汇总了Python中pyjamas.ui.VerticalPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.add方法的具体用法?Python VerticalPanel.add怎么用?Python VerticalPanel.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
notesHolder = VerticalPanel()
friendSelector = FriendSelector()
outer.add(friendSelector)
outer.add(notesHolder)
class _anonymous(FriendSelectionHandler):
@java.typed(Long)
def onSelected(self, uid):
notesHolder.clear()
self.addLoader(notesHolder)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
self.removeLoader(notesHolder)
if result.size() == 0:
notesHolder.add(HTML(u"User has not created any notes "))
for n in result:
notesHolder.add(HTML(u"Note Title : " + java.str(n.getTitle())))
self.apiClient.notesGet(uid, _anonymous())
friendSelector.addFriendSelectionHandler(_anonymous()) # Let user select a friend and show notes
self.initWidget(outer)
示例2: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def __init__(self):
Composite.__init__(self)
self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>")
self.aboutLink = HTML("<a href='javascript:;'>About</a>")
outer = HorizontalPanel()
inner = VerticalPanel()
outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
links = HorizontalPanel()
links.setSpacing(4)
links.add(self.signOutLink)
links.add(self.aboutLink)
outer.add(inner)
inner.add(HTML("<b>Welcome back, [email protected]</b>"))
inner.add(links)
self.signOutLink.addClickListener(self)
self.aboutLink.addClickListener(self)
self.initWidget(outer)
inner.setStyleName("mail-TopPanel")
links.setStyleName("mail-TopPanelLinks")
示例3: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.add(self.getLoader())
result = VerticalPanel()
result.getElement().setId(u"friendsAreFriendsResult")
uids1 = ArrayList((Long),)
uids1.add(self.apiClient.getLoggedInUser())
uids1.add(Long(751836969))
uids1.add(Long(708775201))
uids2 = ArrayList((Long),)
uids2.add(Long(709281400))
uids2.add(Long(560635378))
uids2.add(Long(709281400))
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, friendInfoList):
outer.clear()
result.add(HTML(u"Size " + java.str(friendInfoList.size())))
for fi in friendInfoList:
result.add(HTML(java.str(java.str(FbName(fi.getUid1())) + u" friend with " + FbName(fi.getUid2())) + u" ? " + fi.getAreFriends()))
outer.add(result)
Xfbml.parse(result.getElement())
self.apiClient.friendsAreFriends(uids1, uids2, _anonymous())
self.initWidget(outer)
示例4: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def __init__(self, ):
self.__init__._super()
"""
Create showcase client.
"""
History.addValueChangeHandler(self)
self.outer.getElement().setId(u"ShowcaseClient")
self.showcaseWrapper.getElement().setId(u"ShowcaseWrapper")
self.horizontalSplit.setSpacing(10)
self.showcaseWrapper.setWidth(u"700px")
self.showcaseWrapper.addStyleName(u"showcaseWrapper")
self.treeMenu.addStyleName(u"treeMenu")
token = Window.Location.getHash()
if token == None or u"".equals(token):
self.doDisplayShowcase(self.__class__.DEFAULT_SHOW)
self.showcaseWrapper.insert(self.createDefaultFrontpage(), 0)
else:
self.doDisplayShowcase(token)
treeMenuWrapper = VerticalPanel()
treeMenuWrapper.addStyleName(u"treeMenuWrapper")
treeMenuWrapper.add(HTML(u"<h4>Methods: </h4>"))
treeMenuWrapper.add(self.treeMenu)
self.horizontalSplit.add(treeMenuWrapper) # Add left + right column
self.horizontalSplit.add(self.decorate(self.showcaseWrapper))
self.outer.add(self.horizontalSplit)
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例5: Comments_xfbml
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class Comments_xfbml(Showcase):
"""
Display facebook comments on the site.
@author ola
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.fbComments = FbComments(Comments_get.XID)
self.header = HTML(u"<h3>A comment would be great! Thanks :-)</h3>")
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
"""
Create example
"""
self.outer.getElement().setId(u"xfbml_comments")
self.outer.add(self.header)
self.outer.add(self.fbComments)
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例6: SinkList
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class SinkList(Composite):
def __init__(self):
Composite.__init__(self)
self.vp_list=VerticalPanel()
self.sinks=[]
self.selectedSink=-1
self.initWidget(self.vp_list)
self.setStyleName("ks-List")
def addSink(self, info):
name = info.getName()
link = Hyperlink(name, False, name)
link.setStyleName("ks-SinkItem")
self.vp_list.add(link)
self.sinks.append(info)
def find(self, sinkName):
for info in self.sinks:
if info.getName()==sinkName:
return info
return None
def setSinkSelection(self, name):
if self.selectedSink <> -1:
self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")
for i in range(len(self.sinks)):
info = self.sinks[i]
if (info.getName()==name):
self.selectedSink = i
widget=self.vp_list.getWidget(self.selectedSink)
widget.addStyleName("ks-SinkItem-selected")
return
示例7: onModuleLoad
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def onModuleLoad(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")
vp=VerticalPanel()
vp.setWidth("100%")
vp.add(self.description)
vp.add(self.sinkContainer)
self.description.setStyleName("ks-Info")
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%")
History().addHistoryListener(self)
RootPanel().add(self.panel)
#RootPanel().add(Logger())
#Show the initial screen.
initToken = History().getToken()
if len(initToken):
self.onHistoryChanged(initToken)
else:
self.showInfo()
示例8: Contacts
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class Contacts(Composite):
def __init__(self):
Composite.__init__(self)
self.contacts = []
self.contacts.append(Contact("Benoit Mandelbrot", "[email protected]"))
self.contacts.append(Contact("Albert Einstein", "[email protected]"))
self.contacts.append(Contact("Rene Descartes", "[email protected]"))
self.contacts.append(Contact("Bob Saget", "[email protected]"))
self.contacts.append(Contact("Ludwig von Beethoven", "[email protected]"))
self.contacts.append(Contact("Richard Feynman", "[email protected]"))
self.contacts.append(Contact("Alan Turing", "[email protected]"))
self.contacts.append(Contact("John von Neumann", "[email protected]"))
self.panel = VerticalPanel()
# Add all the contacts to the list.
i = 0
while (i < len(self.contacts)):
self.addContact(self.contacts[i])
i = i + 1
self.initWidget(self.panel)
self.setStyleName("mail-Contacts")
def addContact(self, contact):
link = HTML("<a href='javascript:;'>" + contact.name + "</a>")
self.panel.add(link)
# Add a click listener that displays a ContactPopup when it is clicked.
listener = ContactListener(contact, link)
link.addClickListener(listener)
示例9: Events_create
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class Events_create(Showcase):
"""
Showcase for method <code>events.create</code>
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
"""
Create showcase
"""
self.initWidget(self.outer)
def permissionGranted(self):
eventEditor = EventEditor()
self.outer.add(eventEditor)
def getNeedPermission(self):
return Permission.create_event
示例10: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
mutualFriends = VerticalPanel()
mutualFriends.getElement().setId(u"Friends_getMutualFriends-mutualFriends")
fs = FriendSelector() # Let the user pick a friends
class _anonymous(FriendSelectionHandler):
# Check if current logged in user has common friends with selected.
@java.typed(Long)
def onSelected(self, targetUid):
mutualFriends.clear()
self.addLoader(mutualFriends)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
self.removeLoader(mutualFriends)
mutualFriends.add(HTML(java.str(u"Number of mutual friends " + java.str(result.size())) + u" with " + FbName(targetUid)))
p = ProfilePicsPanel(result)
mutualFriends.add(p)
self.apiClient.friendsGetMutualFriends(targetUid, _anonymous()) # Call facebook
fs.addFriendSelectionHandler(_anonymous())
outer.add(fs)
outer.add(mutualFriends)
self.initWidget(outer)
示例11: createCommentsUI
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def createCommentsUI(self, comments):
"""
Create comments ui
"""
p = VerticalPanel()
p.addStyleName(u"comments fbColorLight rounded addSpace")
p.add(HTML(java.str(u"<h3>Comments on this post: " + java.str(comments.getCount())) + u"</h4>"))
return p
示例12: createFavoriteWidget
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def createFavoriteWidget(self):
wrapper = VerticalPanel()
wrapper.addStyleName(u"favPanel")
self.favPanel.setSpacing(10)
self.favPanel.add(self.top1)
wrapper.add(self.favPanel)
wrapper.add(self.publishButton)
return wrapper
示例13: ProfilePicsPanel
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class ProfilePicsPanel(Composite):
"""
Display Profile Pics in a panel.
CSS Configuration.
<ul>
<li>.gwittit-ProfilePicsPanel
<li>.gwittit-ProfilePicsPanel-pics
</ul>
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.pics = FlowPanel()
self.seeAllLink = Anchor(u"See All")
self.PAGE_SIZE = 10
self.uids = None
@__init__.register
@java.typed(List)
def __init__(self, uids):
self.__init__._super()
"""
Create a new Panel
"""
self.uids = uids
self.outer.getElement().setId(u"ProfilePicsPanel")
self.pics.getElement().setId(u"ProfilePicsPanel-pics-" + java.str(System.currentTimeMillis()))
self.outer.addStyleName(u"gwittit-ProfilePicsPanel")
self.pics.addStyleName(u"gwittit-ProfilePicsPanel-pics")
self.outer.add(self.pics)
self.renderProfilePics() # Add list of fbprofilepics to the pics panel
if uids.size() > PAGE_SIZE:
self.outer.add(self.seeAllLink)
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
popup = ProfilePicsPopup(uids)
popup.center()
popup.show()
self.seeAllLink.addClickHandler(_anonymous())
Xfbml.parse(self.pics)
self.initWidget(self.outer)
@java.private
def renderProfilePics(self):
i = 0
while i < PAGE_SIZE and i < self.uids.size():
i+= 1
uid = self.uids.get(i)
profilePic = FbProfilePic(uid, Size.square)
profilePic.setWidth(u"35px")
profilePic.setHeight(u"35px")
self.pics.add(profilePic)
示例14: createImage
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
def createImage(self, imageUrl):
image = Image(imageUrl)
image.setStyleName("ks-images-Image")
p = VerticalPanel()
p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
p.add(image)
return p
示例15: Connect_getUnconnectedFriendsCount
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import add [as 别名]
class Connect_getUnconnectedFriendsCount(Showcase):
"""
Showcase for method <code>connect.getUnconnectedFriendsCount</code>
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
# Handle response
@java.private
@java.innerclass
@java.implements(AsyncCallbackInteger)
class CountCallback(Object):
@java.init
def __init__(self, *a, **kw):
pass
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(Integer)
def onSuccess(self, count):
self.removeLoader(self.outer)
self.renderResponse(count)
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
"""
Create showcase
"""
self.addLoader(self.outer)
self.doGetUnconnctedFriendsCount()
self.initWidget(self.outer)
@java.private
def doGetUnconnctedFriendsCount(self):
"""
Get data from facebook
"""
self.apiClient.connectGetUnconnectedFriendsCount(self.CountCallback())
@java.private
@java.typed(Integer)
def renderResponse(self, count):
"""
Render response
@param count how many unconnected friends
"""
self.outer.add(HTML(u"<h4>Unconnected Friends Count</h4>"))
self.outer.add(HTML(u"Result : " + java.str(count)))