本文整理汇总了Python中pyjamas.ui.VerticalPanel.addStyleName方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.addStyleName方法的具体用法?Python VerticalPanel.addStyleName怎么用?Python VerticalPanel.addStyleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.addStyleName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def __init__(self, ):
self.__init__._super()
outer = VerticalPanel()
outer.addStyleName(u"gwittit-Showcase-Groups_get")
self.addLoader(outer)
class _anonymous(AsyncCallback):
@java.typed(Throwable)
def onFailure(self, caught):
self.removeLoader(outer)
self.handleFailure(caught)
@java.typed(List)
def onSuccess(self, groups):
self.removeLoader(outer)
for g in groups:
membersWrapper = VerticalPanel()
membersWrapper.addStyleName(u"membersWrapper")
memberLink = Anchor(u"See Members")
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
self.displayMembers(membersWrapper, g.getGid())
memberLink.addClickHandler(_anonymous())
outer.add(HTML(java.str(u"<h4>Group: " + java.str(g.getName())) + u"</h4>"))
outer.add(memberLink)
outer.add(membersWrapper)
self.apiClient.groupsGet(None, _anonymous())
self.initWidget(outer)
示例2: renderPosts
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def renderPosts(self, addContentToPnl, posts):
"""
Render posts i a stream
"""
addContentToPnl.clear()
addContentToPnl.add(HTML(u"Number of posts: " + java.str(posts.__len__())))
for post in Util.iterate(posts):
try:
GWT.log(u"Render: " + java.str(JSONObject(post).toString()), None)
postContentPnl = VerticalPanel()
postContentPnl.addStyleName(u"postContent")
postContentPnl.add(HTML(java.str(FbName(post.getActorId())) + u" " + post.getMessage()))
if post.getAttachment().getName() is not None:
postContentPnl.add(self.createAttachmentUI(post.getAttachment()))
if post.getLikes().getCount() > 0:
postContentPnl.add(self.createLikesUI(post.getLikes()))
if post.getComments().getCount() > 0:
postContentPnl.add(self.createCommentsUI(post.getComments()))
p = HorizontalPanel() # Add profilepic on the left, postcontent on the right
p.addStyleName(u"post")
p.add(FbProfilePic(post.getActorId()))
p.add(postContentPnl)
addContentToPnl.add(p) # postPnl.add ( asJson ( "LikesAsJson: ", post.getLikes () ));
except Exception,e:
GWT.log(u"Unkown exception ", e)
示例3: __init__
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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)
示例4: createCommentsUI
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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
示例5: createFavoriteWidget
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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
示例6: ProfilePicsPanel
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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)
示例7: createEventInfoUi
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def createEventInfoUi(self, eventInfo):
p = VerticalPanel()
p.addStyleName(u"eventInfo")
html = java.str(u"<h4>" + java.str(eventInfo.getName())) + u"</h4>"
html += java.str(java.str(u"When: " + java.str(eventInfo.getStartTime())) + u", Where: " + eventInfo.getLocation()) + u"<br/>"
self.responsePanel.add(HTML(html))
mPanel = SimplePanel()
mLink = Anchor(u"See who's attending")
mLink.addClickHandler(self.GetMembersClickHandler(eventInfo.getEid(), mPanel))
p.add(mLink)
p.add(mPanel)
return p
示例8: handleCommentsResponse
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def handleCommentsResponse(self, comments):
for comment in comments:
box = VerticalPanel()
box.addStyleName(u"commentBox")
p = HorizontalPanel()
p.setSpacing(5)
p.add(FbProfilePic(comment.getFromId(), Size.square))
p.add(HTML(java.str(comment.getText()) + u" from " + FbName(comment.getFromId())))
box.add(p)
removeLink = Anchor(u"Remove")
removeLink.addClickHandler(self.CommentsRemoveClickHandler(comment.getId()))
box.add(removeLink)
self.outer.add(box)
Xfbml.parse(self.outer)
示例9: onSuccess
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def onSuccess(self, groups):
self.removeLoader(outer)
for g in groups:
membersWrapper = VerticalPanel()
membersWrapper.addStyleName(u"membersWrapper")
memberLink = Anchor(u"See Members")
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
self.displayMembers(membersWrapper, g.getGid())
memberLink.addClickHandler(_anonymous())
outer.add(HTML(java.str(u"<h4>Group: " + java.str(g.getName())) + u"</h4>"))
outer.add(memberLink)
outer.add(membersWrapper)
示例10: createAttachmentUI
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def createAttachmentUI(self, attachment):
"""
Create attachment UI
"""
p = VerticalPanel()
p.addStyleName(u"attachment fbColorLight rounded addSpace")
p.add(HTML(u"<h3>Attachment</h3> "))
thumbs = HorizontalPanel()
thumbs.setSpacing(10)
for m in Util.iterate(attachment.getMedia()):
p.add(HTML(u"<b>MediaContent:</b> " + java.str(m.getType())))
if m.getSrc() is not None:
thumbs.add(Image(m.getSrc()))
if m.getTypeEnum() == Type.video:
vLink = Anchor(u"See Video")
vLink.setHref(m.getVideo().getSourceUrl())
p.add(vLink)
p.add(thumbs)
return p
示例11: onSuccess
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
def onSuccess(self, result):
self.removeLoader(outer)
outer.add(HTML(u"Result Size " + java.str(result.size())))
for no in result:
tmp = VerticalPanel()
tmp.addStyleName(u"notification")
tmp.add(HTML(java.str(u"<h3>" + java.str(no.getTitleText())) + u"</h3>"))
tmp.add(HTML(no.getBodyHtml()))
tmp.add(HTML(no.getHref()))
if not no.getIsUnread():
tmp.add(HTML(u"Status : Old"))
markRead = Anchor(u"Mark as Read")
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
markRead.setHTML(u"Marked as Read")
markRead(no.getNotificationId())
markRead.addClickHandler(_anonymous())
tmp.add(markRead)
outer.add(tmp)
示例12: Stream_publishAttachment
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
class Stream_publishAttachment(Showcase):
"""
Let user choose top 3 favorite beatles album and publish stream.
"""
@java.init
def __init__(self, *a, **kw):
self.baseUrl = u"http://gwittit.appspot.com"
self.outer = VerticalPanel()
self.favPanel = HorizontalPanel()
self.publishButton = Button(u"Stream Publish")
self.images = [ None for i in range(12)]
self.favIdx = 0
self.top1 = Image(u"/imgsamples/top1.jpg")
self.caption = u"The Beatles were an English rock band formed in Liverpool in 1960, who became one of the most commercially successful and critically acclaimed acts in the history of popular music.[1] During their years of international stardom, the group consisted of John Lennon (rhythm guitar, vocals), Paul McCartney (bass guitar, vocals), George Harrison (lead guitar, vocals) and Ringo Starr (drums, vocals). "
self.link = u"http://en.wikipedia.org/wiki/The_Beatles"
self.header = HTML(u"<h3>Pick your top beatles album!</h3>")
@java.innerclass
@java.implements(AsyncCallbackJavaScriptObject)
class SimpleCallback(Object):
"""
Handle publish reponse
"""
@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):
pass
@java.private
@java.innerclass
@java.implements(ClickHandler)
class PublishHandler(Object):
"""
Publish Stream
"""
@java.init
def __init__(self, *a, **kw):
pass
@java.typed(ClickEvent)
def onClick(self, event):
self.doPublishStream()
self.sendStatisticInfo()
@java.private
@java.innerclass
@java.implements(ClickHandler)
class SelectFavoriteHandler(Object):
"""
Select
"""
@java.init
def __init__(self, *a, **kw):
self.selected = 0
@__init__.register
@java.typed(int)
def __init__(self, selected):
self.selected = selected
@java.typed(ClickEvent)
def onClick(self, event):
image = Image(self.images[self.selected].getUrl())
image.setWidth(u"80px")
self.top1 = image
self.favPanel.clear()
self.favPanel.add(image)
@java.private
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
@__init__.register
@java.typed()
def __init__(self, ):
self.__init__._super()
self.outer.addStyleName(u"gwittit-Stream_publishAttachment")
self.publishButton.addClickHandler(self.PublishHandler())
self.images[0] = Image(java.str(self.baseUrl) + u"/imgsamples/please.jpg")
#.........这里部分代码省略.........
示例13: Events_get
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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()
#.........这里部分代码省略.........
示例14: Stream_get
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [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>"))
#.........这里部分代码省略.........
示例15: ErrorResponseUI
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import addStyleName [as 别名]
class ErrorResponseUI(DecoratedPopupPanel):
"""
Wraps an errorresponse from facebook
Css Configuration
<ul>
<li>gwittit-ErrorResponse
<li>gwittit-ErrorResponse-header
<li>gwittit-ErrorResponse-userData
<li>gwittit-ErrorResponse-requestArgs
<li>gwittit-ErrorResponse .closeButton
</ul>
"""
@java.init
def __init__(self, *a, **kw):
self.outer = VerticalPanel()
self.userDataPanel = VerticalPanel()
self.requestArgsPanel = VerticalPanel()
self.closeButton = Button(u"Okay")
@__init__.register
@java.typed(Throwable)
def __init__(self, t):
self((t).getErrorMessage()) ##AltConstrInv
"""
Create new UI object
@param t original exception
"""
@__init__.register
@java.typed(ErrorResponse)
def __init__(self, errorResponse):
self.__init__._super()
"""
Create new UI error response
@param errorResponse original error response
"""
super(self.__class__,self).setAutoHideEnabled(True)
msg = errorResponse.getMessage()
# Check if the call resulted in an invalid session state.
if msg.matches(u".*Invalid session.*"):
msg = u"You must be logged in to do that..."
self.outer.setWidth(u"600px")
self.outer.addStyleName(u"gwittit-ErrorResponse") # Css
self.userDataPanel.addStyleName(u"gwittit-ErrorResponse-userData")
self.requestArgsPanel.addStyleName(u"gwittit-ErrorResponse-requestArgs")
self.closeButton.addStyleName(u"closeButton")
self.outer.add(HTML(java.str(u"<h3 class=gwittit-ErrorResponse-header> Error Response: " + java.str(msg)) + u"</h3>")) # Header
userData = errorResponse.getUserData() # User Data
if userData is not None:
userDataHtml = java.str(java.str(java.str(u"<h3>User Data </h3>" + u"<ul>") + u"<li>ErrorCode: " + userData.getErrorCode()) + u"<li>ErrorMessage: " + userData.getErrorMsg()) + u"</li>"
self.userDataPanel.add(HTML(userDataHtml))
self.outer.add(self.userDataPanel)
requestArgs = userData.getRequestArgs() # Request Args
if requestArgs.__len__() > 0:
self.requestArgsPanel.add(HTML(u"<h3> Request Args </h3>"))
self.requestArgsPanel.add(HTML(u"<ul>"))
for i in range(0,requestArgs.__len__()):
self.requestArgsPanel.add(HTML(java.str(u"<li> " + java.str(requestArgs.get(i).getKey())) + u": " + requestArgs.get(i).getValue()))
self.requestArgsPanel.add(HTML(u"</ul>"))
self.outer.add(self.requestArgsPanel)
class _anonymous(ClickHandler):
@java.typed(ClickEvent)
def onClick(self, event):
ErrorResponseUI.self###NOTIMPL QThis###.hide()
self.closeButton.addClickHandler(_anonymous()) # Close Button
self.outer.add(self.closeButton)
self.setWidget(self.outer)