本文整理汇总了Python中pyjamas.ui.VerticalPanel.getElement方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.getElement方法的具体用法?Python VerticalPanel.getElement怎么用?Python VerticalPanel.getElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.getElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [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)
示例2: Comments_xfbml
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [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)
示例3: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [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)
示例4: ProfilePicsPanel
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [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)
示例5: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.getElement().setId(u"WidgetShowcase")
outer.add(HTML(u"<h3>FbPromptPermission</h3>"))
promptPerm = FbPromptPermission(u"Click to see create_event, create_note and publish_stream permission dialog", Permission.create_event, Permission.create_note, Permission.publish_stream)
outer.add(promptPerm)
Xfbml.parse(outer)
self.initWidget(outer)
示例6: LoginBox
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
class LoginBox(Composite):
"""
Displays a rounded box ( firefox/safari ) with at facebook connect button.
And a link as backup in case the button is not rendered.
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.inner = HorizontalPanel()
self.loginButton = FbLoginButton(u"facebookConnectLogin()")
self.loginLink = Anchor(u"don't see a button? Click here to login")
self.loginCallback = None
@java.typed(LoginCallback)
def addLoginCallback(self, loginCallback):
self.loginCallback = loginCallback
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
self.outer.getElement().setId(u"OuterRouter")
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
GWT.log(u"Require session failed: " + java.str(caught))
@java.typed(Boolean)
def onSuccess(self, isLoggedIn):
if self.loginCallback is not None and isLoggedIn:
self.loginCallback.onLogin()
FacebookConnect.requireSession(_anonymous())
self.loginLink.addClickHandler(_anonymous()) # Login with the javascript api. GWT client doesnt render the fb:login-button
self.outer.getElement().setId(u"LoginBox")
self.inner.addStyleName(u"inner")
self.outer.add(HTML(u"<h1>Login with your facebook id: </h1>"))
self.outer.add(HTML(u"This demo uses facebook data heavily to demonstrate API calls etc so you might as well login right away"))
self.inner.setSpacing(10)
self.inner.add(HTML(u"Click the button to allow this application to access your facebook account"))
self.inner.add(self.loginButton)
self.outer.add(self.inner)
self.outer.add(self.loginLink)
sourceCode = HTML(u"<br/><br/>This project on Gogle code : <a target=_blank href=\"http://code.google.com/p/gwt-facebook/\"> http://code.google.com/p/gwt-facebook/ </a>")
sourceCode.addStyleName(u"sourceCode")
self.outer.setWidth(u"400px")
self.outer.add(sourceCode)
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例7: renderMainContent
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
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.
示例8: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
friendRequestWrapper = HorizontalPanel()
friendRequestWrapper.getElement().setId(u"friendRequestWrapper")
friendRequestWrapper.setSpacing(10)
groupInvitesWrapper = VerticalPanel()
groupInvitesWrapper.getElement().setId(u"groupInvitesWrapper")
eventInvitesWrapper = VerticalPanel()
eventInvitesWrapper.getElement().setId(u"eventInvitesWrapper")
self.addLoader(outer)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
self.removeLoader(outer)
for nc in result:
outer.add(HTML(java.str(u"<h3>" + java.str(nc.getType())) + u"</h3>"))
if nc.getUnread() is not None:
outer.add(HTML(u"Unread: " + java.str(nc.getUnread())))
# Friend requests.
if nc.getTypeEnum() == NotificationType.friend_requests and nc.getRequestIds().size() > 0:
outer.add(friendRequestWrapper)
for uid in nc.getRequestIds():
friendRequestWrapper.add(FbProfilePic(uid))
Xfbml.parse(friendRequestWrapper)
elif nc.getTypeEnum() == NotificationType.friend_requests and nc.getRequestIds().size() > 0:
outer.add(friendRequestWrapper)
for uid in nc.getRequestIds():
friendRequestWrapper.add(FbProfilePic(uid))
Xfbml.parse(friendRequestWrapper)
elif nc.getTypeEnum() == NotificationType.group_invites:
outer.add(groupInvitesWrapper)
for gid in nc.getRequestIds():
groupInvitesWrapper.add(HTML(u"GroupInvite: " + java.str(gid)))
groupInvitesWrapper.add(FbGroupLink(gid))
Xfbml.parse(groupInvitesWrapper)
else:
if nc.getTypeEnum() == NotificationType.event_invites:
outer.add(eventInvitesWrapper)
if nc.getRequestIds().size() > 0:
for eid in nc.getRequestIds():
eventInvitesWrapper.add(FbEventLink(eid))
Xfbml.parse(eventInvitesWrapper)
self.apiClient.notificationsGet(_anonymous()) # Get facebook data
self.initWidget(outer)
示例9: renderAlbums
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
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>"))
if a.hasCover():
p.add(HTML(u" CoverPid: " + java.str(a.getCoverPid())))
p.add(FbPhoto(a.getCoverPid(), FbPhoto.Size.small))
addContentToPnl.add(p)
Xfbml.parse(p)
示例10: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.getElement().setId(u"Friends_getAppUsers")
self.addLoader(outer)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
self.removeLoader(outer)
outer.add(ProfilePicsPanel(result))
self.apiClient.friendsGetAppUsers(_anonymous())
self.initWidget(outer)
示例11: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.getElement().setId(self.__class__.method)
self.addLoader(outer)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
self.removeLoader(outer)
for fl in result:
outer.add(HTML(java.str(fl.getFlid()) + u"/" + fl.getName()))
self.apiClient.friendsGetLists(_anonymous()) # Call facebook
self.initWidget(outer)
示例12: displayUsers
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def displayUsers(self, picsList, page):
startIdx = page * PAGE_SIZE
stopIdx = startIdx + (PAGE_SIZE - 1)
holder = VerticalPanel()
holder.getElement().setId(u"ProfilePics-Page_" + java.str(page))
i = startIdx
while i < self.uids.size() and i < stopIdx:
i+= 1
uid = self.uids.get(i)
wrapper = HorizontalPanel()
wrapper.setSpacing(10)
profilePic = FbProfilePic(uid, Size.square)
name = FbName(uid)
wrapper.add(profilePic)
wrapper.add(name)
holder.add(wrapper)
picsList.add(holder)
Xfbml.parse(holder)
示例13: XFBML_serverFbml
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
class XFBML_serverFbml(Showcase):
"""
Demonstrates serverFbml tag. Used to do invites etc.
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
# Display request form inside iframe(fb:serverFbml).
fbml = u"<script type=\"text/fbml\"> <fb:fbml> <fb:request-form action=\"/test\" method=\"POST\" invite=\"true\" type=\"XFBML\" content=\"This is a test invitation from XFBML test app <fb:req-choice url='see wiki page for fb:req-choice for details' label='Ignore the Connect test app!' /> \" > <fb:multi-friend-selector showborder=\"false\" actiontext=\"Invite your friends to use Connect.\"> </fb:request-form> </fb:fbml> </script>"
# Construct
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
self.outer.setWidth(u"800px")
self.outer.getElement().setId(u"XFBML_serverFbml")
self.outer.add(FbServerFbml(self.__class__.fbml))
Xfbml.parse(self.outer)
self.initWidget(self.outer)
示例14: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.add(self.getLoader())
outer.getElement().setId(u"ShowPhotosGetAlbums")
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, result):
outer.remove(self.getLoader())
outer.add(HTML(u"Result Size: " + java.str(result.size())))
for a in result:
html = java.str(java.str(u"<h2>Name: " + java.str(a.getName())) + u", Description: " + a.getDescription()) + u"</h2>"
outer.add(HTML(html))
if a.hasCover():
outer.add(FbPhoto(a.getCoverPid(), Size.small))
Xfbml.parse(outer)
self.apiClient.photosGetAlbums(_anonymous()) # Call facebook
self.initWidget(outer)
示例15: Events_get
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import getElement [as 别名]
class Events_get(Showcase):
"""
Showcase for method <code>events.get</code>
"""
@java.init
def __init__(self, *a, **kw):
self.eventIcon = Image(u"/cal_icon.gif")
self.outer = VerticalPanel()
self.responsePanel = VerticalPanel()
self.listBox = ListBox(False)
# Get members
@java.private
@java.innerclass
@java.implements(ClickHandler)
class GetMembersClickHandler(Object):
@java.init
def __init__(self, *a, **kw):
self.eid = None
self.addToPanel = None
@__init__.register
@java.typed(Long, Panel)
def __init__(self, eid, addToPanel):
self.eid = eid
self.addToPanel = addToPanel
@java.typed(ClickEvent)
def onClick(self, event):
members = Events_getMembers(self.eid)
self.addToPanel.clear()
self.addToPanel.add(members)
@java.private
@java.innerclass
@java.implements(ChangeHandler)
class FilterHandler(Object):
"""
Let user filter events
"""
@java.init
def __init__(self, *a, **kw):
pass
@java.typed(ChangeEvent)
def onChange(self, event):
idx = self.listBox.getSelectedIndex()
value = self.listBox.getValue(idx)
if u"All".equals(value):
self.doEventsGet(None)
else:
self.doEventsGet(RsvpStatus.valueOf(value))
@java.private
@java.innerclass
@java.implements(AsyncCallbackList)
class EventsGetCallback(Object):
"""
Handle events get
"""
@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):
GWT.log(u"Events get #" + java.str(result.size()), None)
self.handleResponse(result) # removeLoader ( outer );
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
"""
Create new showcase
"""
self.outer.getElement().setId(u"Events_get")
self.outer.addStyleName(u"gwittit-Events_get")
self.outer.add(self.createEventFilter())
self.outer.add(self.responsePanel)
self.doEventsGet(None)
self.listBox.addChangeHandler(self.FilterHandler())
self.initWidget(self.outer)
# Create ui for dropdown filter
@java.private
def createEventFilter(self):
filter = HorizontalPanel()
#.........这里部分代码省略.........